libjboss-xml-binding-java-2.0.3.GA.orig/0000755000175000017500000000000011620316770017636 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/.classpath0000644000175000017500000000122011374713342021616 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/pom.xml0000644000175000017500000001725411502163247021162 0ustar twernertwerner org.jboss jboss-parent 5 4.0.0 jbossxb jar 2.0.3.GA JBoss XML Binding http://www.jboss.org JBoss XML Binding scm:svn:https://svn.jboss.org/repos/common/jbossxb/tags/2.0.3.GA scm:svn:https://svn.jboss.org/repos/common/jbossxb/tags/2.0.3.GA http://anonsvn.jboss.org/repos/common/jbossxb/tags/2.0.3.GA jboss-xml-binding maven-release-plugin https://svn.jboss.org/repos/common/jbossxb/tags maven-surefire-plugin false true **/*TestCase.java org/jboss/test/xml/RepeatedElementsUnitTestCase.java org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatablePropertyAllUnmarshallingTestCase.java unordered-sequence-true-test test false true org/jboss/test/xml/RepeatedElementsUnitTestCase.java org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatablePropertyAllUnmarshallingTestCase.java org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatablePropertySequenceUnmarshallingTestCase.java org/jboss/test/xb/builder/repeatableterms/test/RepeatableTermsUnitTestCase.java org/jboss/test/xb/validator/test/BasicBindingValidatorUnitTestCase.java xb.builder.useUnorderedSequence true repeatable-handlers-false-test test false true org/jboss/test/xml/RepeatedElementsUnitTestCase.java org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatablePropertyAllUnmarshallingTestCase.java org/jboss/test/xb/validator/test/BasicBindingValidatorUnitTestCase.java xb.builder.repeatableParticleHandlers false repository.jboss.org JBoss Repository default http://repository.jboss.org/maven2/ false snapshots.jboss.org JBoss Snapshot Repository default http://snapshots.jboss.org/maven2/ false true org.jboss.logging jboss-logging-spi 2.0.5.GA compile org.jboss jboss-common-core 2.2.9.GA org.jboss jboss-reflect 2.0.2.GA compile jboss jboss-common-logging-spi xml-apis xml-apis 1.3.04 compile xerces xercesImpl 2.9.1 compile com.wutka dtdparser 1.21 javax.activation activation 1.1.1 compile sun-jaxb jaxb-api 2.1.9 compile org.jboss.test jboss-test 1.1.4.GA test junit junit 4.4 test libjboss-xml-binding-java-2.0.3.GA.orig/src/0000755000175000017500000000000011620316770020425 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/0000755000175000017500000000000011620316756021410 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/0000755000175000017500000000000011620316762023417 5ustar twernertwerner././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/DefaultSchemaResolverUnitTestCase_testRedefine_redefining.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/DefaultSchemaResolverUnitTestCase_testRed0000644000175000017500000000111610766470761033570 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/0000755000175000017500000000000011620316757024212 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/0000755000175000017500000000000011620316757025332 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/0000755000175000017500000000000011620316760026303 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/0000755000175000017500000000000011620316760030052 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/0000755000175000017500000000000011620316760031031 5ustar twernertwerner././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestAmbiguityInt.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestAmbiguit0000644000175000017500000000034010763015442033352 0ustar twernertwerner 123 ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/StaticClassMethodInstantiate.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/StaticClassM0000644000175000017500000000033410763015442033306 0ustar twernertwerner ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConstructorFactory.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConstruc0000644000175000017500000000312710763033236033420 0ustar twernertwerner anObjectValue StringValue 12 true x 123 1234 12345 3.14 3.14e12 Jan 01 00:00:00 CET 2001 12e4 123456 12 true y 123 1234 12345 3.14 3.14e12 12345 StringValue XYZ abc ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/SimpleInstantiate.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/SimpleInstan0000644000175000017500000000024510763015442033363 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConstructorAmbiguityString.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConstruc0000644000175000017500000000037610763033236033423 0ustar twernertwerner SomeString ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConfigure20WithCtorFactory.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConfigur0000644000175000017500000000374710763015442033403 0ustar twernertwerner anObjectValue StringValue 12 true x 123 1234 12345 3.14 3.14e12 Jan 01 00:00:00 CET 2001 12e4 123456 12 true y 123 1234 12345 3.14 3.14e12 12345 StringValue XYZ abc ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/PropertyWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/PropertyWild0000644000175000017500000000042410763015442033420 0ustar twernertwerner ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestInstantiate.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestInstanti0000644000175000017500000000020610763015442033403 0ustar twernertwerner ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConfigure20.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConfigur0000644000175000017500000000233110763015442033367 0ustar twernertwerner StringValue 12 true 123 1234 12345 3.14 3.14e12 Jan 01 00:00:00 CET 2001 12e4 123456 12 true 123 1234 12345 3.14 3.14e12 12345 StringValue XYZ abc ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConstructorAmbiguityInt.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConstruc0000644000175000017500000000040310763033236033412 0ustar twernertwerner 123 ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/ParameterInstantiate.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/ParameterIns0000644000175000017500000000041510763015442033346 0ustar twernertwerner Hello 5 ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConfigure20WithCtor.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConfigur0000644000175000017500000000366210763015442033377 0ustar twernertwerner anObjectValue StringValue 12 true x 123 1234 12345 3.14 3.14e12 Jan 01 00:00:00 CET 2001 12e4 123456 12 true y 123 1234 12345 3.14 3.14e12 12345 StringValue XYZ abc ././@LongLink0000000000000000000000000000022100000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConfigure20WithCtorExplicitFactoryClassAndParams.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConfigur0000644000175000017500000000416710763015442033400 0ustar twernertwerner anObjectValue StringValue 12 true x 123 1234 12345 3.14 3.14e12 Jan 01 00:00:00 CET 2001 12e4 123456 12 true y 123 1234 12345 3.14 3.14e12 12345 StringValue XYZ abc ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestAmbiguityString.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestAmbiguit0000644000175000017500000000034610763015442033360 0ustar twernertwerner SomeString ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConfigure20WithCtorExplicitFactoryClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConfigur0000644000175000017500000000363210763015442033374 0ustar twernertwerner anObjectValue StringValue 12 true x 123 1234 12345 3.14 3.14e12 Jan 01 00:00:00 CET 2001 12e4 123456 12 true y 123 1234 12345 3.14 3.14e12 12345 StringValue XYZ abc ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConstructorExplicitFactoryClassAndParams.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConstruc0000644000175000017500000000326310763033236033421 0ustar twernertwerner anObjectValue StringValue 12 true x 123 1234 12345 3.14 3.14e12 Jan 01 00:00:00 CET 2001 12e4 123456 12 true y 123 1234 12345 3.14 3.14e12 12345 StringValue XYZ abc ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/StaticMethodInstantiate.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/StaticMethod0000644000175000017500000000033110763015442033341 0ustar twernertwerner ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/Property.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/Property.xml0000644000175000017500000000224010763015442033375 0ustar twernertwerner StringValue 12 true 123 1234 12345 3.14 3.14e12 12e4 123456 12 true 123 1234 12345 3.14 3.14e12 12345 StringValue XYZ abc ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConfigure.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConfigur0000644000175000017500000000233110763015442033367 0ustar twernertwerner StringValue 12 true 123 1234 12345 3.14 3.14e12 Jan 01 00:00:00 CET 2001 12e4 123456 12 true 123 1234 12345 3.14 3.14e12 12345 StringValue XYZ abc ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConstructor.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/javabean/test/TestConstruc0000644000175000017500000000306210763033236033416 0ustar twernertwerner anObjectValue StringValue 12 true x 123 1234 12345 3.14 3.14e12 Jan 01 00:00:00 CET 2001 12e4 123456 12 true y 123 1234 12345 3.14 3.14e12 12345 StringValue XYZ abc libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/0000755000175000017500000000000011620316760026714 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/0000755000175000017500000000000011620316760030342 5ustar twernertwerner././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/repeatableterms/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/repeatableterms0000755000175000017500000000000011620316760033442 5ustar twernertwerner././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/repeatableterms/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/repeatableterms0000755000175000017500000000000011620316760033442 5ustar twernertwerner././@LongLink0000000000000000000000000000022000000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/repeatableterms/test/RepeatableTerms_testUnmarshalling.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/repeatableterms0000644000175000017500000000130711303061254033436 0ustar twernertwerner item1 item2 item3 sequenceChoice1_1 sequenceChoice2_1 sequenceChoice1_2 sequenceChoice1_3 sequenceChoice2_2 choiceChoice1_1 choiceChoice1_2 choiceChoice2_1 choiceChoice2_2 choiceChoice1_3 choiceChoice1_4 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/0000755000175000017500000000000011620316762031612 5ustar twernertwerner././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/propertyrefs/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/property0000755000175000017500000000000011620316761033416 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/propertyrefs/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/property0000755000175000017500000000000011620316761033416 5ustar twernertwerner././@LongLink0000000000000000000000000000023600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/propertyrefs/test/PropertyReplacement_testPropertyReplacement.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/property0000644000175000017500000000057611134135334033423 0ustar twernertwerner ${org.jboss.test.xb.builder.object.propertyrefs.test.PropertyReplacementUnitTestCase_testPropertyReplacement.max} ${org.jboss.test.xb.builder.object.propertyrefs.test.PropertyReplacementUnitTestCase_testPropertyReplacement.val} ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/xmlschema/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/xmlschem0000755000175000017500000000000011620316761033352 5ustar twernertwerner././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/xmlschema/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/xmlschem0000755000175000017500000000000011620316761033352 5ustar twernertwerner././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/xmlschema/test/NonDefaults.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/xmlschem0000644000175000017500000000010510562616254033354 0ustar twernertwerner ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/xmlschema/test/NoPkg.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/xmlschem0000644000175000017500000000005710562616254033362 0ustar twernertwerner ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/xmlschema/test/None.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/xmlschem0000644000175000017500000000005710562616254033362 0ustar twernertwerner ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/xmlschema/test/Defaults.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/xmlschem0000644000175000017500000000005710562616254033362 0ustar twernertwerner ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanaccessmode/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanacce0000755000175000017500000000000011620316762033254 5ustar twernertwerner././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanaccessmode/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanacce0000755000175000017500000000000011620316762033254 5ustar twernertwerner././@LongLink0000000000000000000000000000022600000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanaccessmode/test/SchemaLevelPublicMemberAccessMode.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanacce0000644000175000017500000000006111345730356033256 0ustar twernertwerner././@LongLink0000000000000000000000000000022200000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanaccessmode/test/SchemaLevelPropertyAccessMode.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanacce0000644000175000017500000000003311345730356033255 0ustar twernertwerner././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanaccessmode/test/PublicMemberAccessModeTypeOverride.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanacce0000644000175000017500000000020011345730356033251 0ustar twernertwerner ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanaccessmode/test/AllAccessModeGroupOverride.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanacce0000644000175000017500000000025211345730356033260 0ustar twernertwerner property fields all ././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanaccessmode/test/PropertyAccessModeGroupOverride.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanacce0000644000175000017500000000015711345730356033264 0ustar twernertwerner property ././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanaccessmode/test/PropertyAccessModeTypeOverride.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanacce0000644000175000017500000000015211345730356033257 0ustar twernertwerner ././@LongLink0000000000000000000000000000023000000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanaccessmode/test/PublicMemberAccessModeGroupOverride.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanacce0000644000175000017500000000022711345730356033262 0ustar twernertwerner property fields ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanaccessmode/test/SchemaLevelAllAccessMode.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanacce0000644000175000017500000000010511345730356033255 0ustar twernertwerner././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanaccessmode/test/AllAccessModeTypeOverride.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/beanacce0000644000175000017500000000020011345730356033251 0ustar twernertwerner ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlpreservewhitespace/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000755000175000017500000000000011620316761033373 5ustar twernertwerner././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlpreservewhitespace/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000755000175000017500000000000011620316762033374 5ustar twernertwerner././@LongLink0000000000000000000000000000023300000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlpreservewhitespace/test/JBossXmlPreserveWhitespace.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000042711042106731033370 0ustar twernertwerner value value value ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean0000755000175000017500000000000011620316761033301 5ustar twernertwerner././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean0000755000175000017500000000000011620316761033301 5ustar twernertwerner././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean/test/StaticClassMethodInstantiate.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean0000644000175000017500000000034510625561630033306 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean/test/SimpleInstantiate.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean0000644000175000017500000000025610625561630033307 0ustar twernertwerner ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean/test/PropertyWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean0000644000175000017500000000045710625561630033312 0ustar twernertwerner ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean/test/ParameterInstantiate.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean0000644000175000017500000000042610625561630033306 0ustar twernertwerner Hello 5 ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean/test/StaticMethodInstantiate.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean0000644000175000017500000000034210625561630033303 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean/test/Property.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/javabean0000644000175000017500000000225110625561630033304 0ustar twernertwerner StringValue 12 true 123 1234 12345 3.14 3.14e12 12e4 123456 12 true 123 1234 12345 3.14 3.14e12 12345 StringValue XYZ abc ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlschema/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000755000175000017500000000000011620316761033373 5ustar twernertwerner././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlschema/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000755000175000017500000000000011620316761033373 5ustar twernertwerner././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlschema/test/NonDefaults.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000011510562616254033376 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlschema/test/None.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000005710562616254033403 0ustar twernertwerner ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlschema/test/Defaults.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000006310562616254033400 0ustar twernertwerner ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlvalue/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000755000175000017500000000000011620316762033374 5ustar twernertwerner././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlvalue/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000755000175000017500000000000011620316762033374 5ustar twernertwerner././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlvalue/test/MixedTypeIgnoreEmptyString.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000014311061213247033365 0ustar twernertwerner empty string test txt libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/0000755000175000017500000000000011620316760032207 5ustar twernertwerner././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000755000175000017500000000000011620316761033167 5ustar twernertwerner././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000046310625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithName.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016610625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithSet.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026010625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ClassLoaderBadNoValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000017110625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithNull.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032210625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ListWithList.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030610625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/LifecycleWithParameters.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000036410625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/DeploymentWithMultipleBeans.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000042210625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ListWithMap.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030510625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PolicyWithBindings.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000017410625561630033174 0ustar twernertwerner binddnib ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/InstallWithAnnotations.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000063310625561630033174 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 @org.jboss.test.xb.builder.object.mc.support.Annotation2 @org.jboss.test.xb.builder.object.mc.support.Annotation3 ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithUninstallCallbacks.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000035510625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/SetWithWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000044510625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/InjectionWithProperty.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030510625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithAnnotation.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000034410625561630033173 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithKeyClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026010625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/DependencyBadNoValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016710625561630033176 0ustar twernertwerner ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithUninstalls.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000034310625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithFactory.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026210625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithSupply.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022310625561630033167 0ustar twernertwerner Supply1 ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackUninstallWithState.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024110625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/FactoryWithProperty.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030710625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryBadNoClassOrFactoryMethod.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022010625561630033164 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ArrayWithArray.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000031110625561630033165 0ustar twernertwerner ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/LifecycleWithParameter.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000025010625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/AliasWithReplace.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024410625561630033172 0ustar twernertwerner X${alias.test.name}X ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Constructor.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000017310625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Alias.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000021410625561630033167 0ustar twernertwerner SimpleAlias ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackUninstallWithMethod.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022310625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithFactoryMethod.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024010625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithClassLoader.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023510625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/InstallBadNoMethod.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016710625561630033176 0ustar twernertwerner ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackInstallBadMethodProperty.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024010625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithSupplies.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027510625561630033176 0ustar twernertwerner Supply1 Supply2 Supply3 ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithInstallCallbacks.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000034710625561630033176 0ustar twernertwerner ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackInstallWithState.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024110625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/AnnotationSimple.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000034410625561630033173 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/InjectionWithBean.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026010625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanBadNoClassOrFactoryMethod.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020210625561630033164 0ustar twernertwerner ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithArray.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032310625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ArrayWithList.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000031010625561630033164 0ustar twernertwerner ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Parameter.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023710625561630033174 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithInjection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000034010625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithThis.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032210625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/SetWithThis.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030410625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithList.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023510625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorBadFactoryNoFactoryMethod.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000025110625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithSet.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032110625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithParameters.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000037610625561630033200 0ustar twernertwerner ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithSet.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023410625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ListWithWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000044710625561630033177 0ustar twernertwerner ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithAnnotations.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000070210625561630033171 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 @org.jboss.test.xb.builder.object.mc.support.Annotation2 @org.jboss.test.xb.builder.object.mc.support.Annotation3 ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanBadNoClassOrFactory.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020310625561630033165 0ustar twernertwerner ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BindingWithNoName.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000017210625561630033172 0ustar twernertwerner binddinb ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PolicyWithExtends.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000015510625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/SetWithValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032110625561630033166 0ustar twernertwerner Value ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/List.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023510625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithArray.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000036610625561630033177 0ustar twernertwerner ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ArrayWithMap.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030710625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ArrayWithElementClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027210625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ValueWithClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027410625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/SetWithClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026410625561630033174 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/SupplyBadNoValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016610625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000044310625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackUninstallWithSignature.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000025010625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithList.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020110625561630033163 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ArrayWithInjection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032610625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithDemand.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022310625561630033167 0ustar twernertwerner Demand1 ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackUninstallBadMethodProperty.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024010625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithMode.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016010625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/DeploymentWithMixed.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000106410625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithUninstallCallbacks.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000033710625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023110625561630033166 0ustar twernertwerner Value ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Array.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023610625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Demand.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020410625561630033166 0ustar twernertwerner Demand ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithArray.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026210625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithConstructor.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000017310625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/SetWithNull.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030410625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithStop.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016410625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithInstall.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000021110625561630033164 0ustar twernertwerner ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ListWithValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032310625561630033170 0ustar twernertwerner Value ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Collection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024310625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ClassLoaderWithWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000037110625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/FactoryBadNoBeanOrWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024510625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/DeploymentWithMultipleBeanMetaDataFactorys.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000072410625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithAnnotation.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027610625561630033177 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithAnnotation.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000041410625561630033171 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithCollection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020710625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PolicyWithAnnotations.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027310625561630033174 0ustar twernertwerner @org.jboss.test.Someannotaion ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/SetWithArray.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030510625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Value.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000025110625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithDemands.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000031310625561630033167 0ustar twernertwerner Demand1 Demand2 Demand3 ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/InjectionWithState.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030310625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithThis.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000036410625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithDemand.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020510625561630033167 0ustar twernertwerner Demand1 ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Set.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023410625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000022200000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorBadFactoryClassNoFactoryMethod.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022710625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackUninstallWithAnnotation.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000037010625561630033172 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ScopeWithQualifier.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024210625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000015510625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/InstallWithParameters.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000040510625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ClassLoaderWithBean.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027110625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanBadNoClassOrConstructor.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000012410625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PolicyWithName.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000014510625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithConstructor.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000021110625561630033164 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithInjection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000042010625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000041110625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000025510625561630033174 0ustar twernertwerner ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/LifecycleWithIgnored.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000021210625561630033165 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithDependency.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000021010625561630033163 0ustar twernertwerner Depends1 ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithCreate.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020410625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/FactoryWithWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000044710625561630033177 0ustar twernertwerner ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016410625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyBadNoName.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000017010625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithAnnotations.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000064210625561630033174 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 @org.jboss.test.xb.builder.object.mc.support.Annotation2 @org.jboss.test.xb.builder.object.mc.support.Annotation3 ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027310625561630033174 0ustar twernertwerner ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithInstallCallbacks.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000033110625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/InstallWithParameter.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027110625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/DeploymentWithBeanFactory.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026710625561630033177 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/DeploymentWithBean.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026010625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithArray.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020210625561630033164 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithPlainValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026410625561630033174 0ustar twernertwerner PlainValue ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/LifecycleWithMethod.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020610625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithAnnotations.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000055010625561630033172 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 @org.jboss.test.xb.builder.object.mc.support.Annotation2 @org.jboss.test.xb.builder.object.mc.support.Annotation3 ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/SetWithCollection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000031210625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithProperties.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032710625561630033174 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/InjectionBadNoBean.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024310625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024210625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithList.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000036410625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PolicyWithScope.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000017710625561630033177 0ustar twernertwerner ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackInstallWithAnnotations.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000065210625561630033175 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 @org.jboss.test.xb.builder.object.mc.support.Annotation2 @org.jboss.test.xb.builder.object.mc.support.Annotation3 ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithProperty.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022710625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/AnnotationWithAttribute.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000042010625561630033166 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.AnnotationWithAttribute(attribute=java.lang.Long.class) ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithInstall.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022710625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithList.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032210625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithMap.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000036210625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackInstallWithSignature.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000025010625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/DeploymentWithArrayOfJavaBeans.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000206311310425750033165 0ustar twernertwerner object1 object2 object2 object1 ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithClassLoader.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000021710625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Supply.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020410625561630033166 0ustar twernertwerner Supply ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithValues.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000043610763551276033205 0ustar twernertwerner Value1 Value2 Value3 ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithKeyValueOverrides.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000043710763570143033200 0ustar twernertwerner 4true ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ValueWithValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026510625561630033175 0ustar twernertwerner Value ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithNull.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000036410625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/DemandBadNoValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016610625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ClassLoaderWithInject.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024210625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithArray.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023610625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackInstallWithAnnotation.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000037010625561630033172 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithProperties.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000031110625561630033165 0ustar twernertwerner ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackUninstallWithAnnotations.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000065210625561630033175 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 @org.jboss.test.xb.builder.object.mc.support.Annotation2 @org.jboss.test.xb.builder.object.mc.support.Annotation3 ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithMode.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016710625561630033176 0ustar twernertwerner ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Scope.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020610625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithInstallCallback.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023710625561630033174 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/SetWithInjection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032210625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithThis.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023510625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithAnnotation.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000036210625561630033173 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackInstallWithProperty.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022710625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithStart.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016510625561630033174 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithCreate.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016610625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackUninstallWithCardinality.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024210625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/SetWithList.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030410625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithFactoryClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023710625561630033174 0ustar twernertwerner ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Deployment.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000013210625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithValueClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026410625561630033174 0ustar twernertwerner ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryBadNoClassOrConstructor.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000013310625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ListWithNull.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030610625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/DemandWithWhenRequired.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022710625561630033173 0ustar twernertwerner Demand ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ArrayWithSet.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030710625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithDemands.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027510625561630033176 0ustar twernertwerner Demand1 Demand2 Demand3 ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ListWithInjection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032410625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithMap.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032110625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithBean.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000033210625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithInstallCallback.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022110625561630033165 0ustar twernertwerner ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/InstallWithAnnotation.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000035310625561630033173 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithCollection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000040010625561630033164 0ustar twernertwerner ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithMap.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023410625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithNull.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023510625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithInstalls.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032710625561630033174 0ustar twernertwerner ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Policy.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000012210625561630033165 0ustar twernertwerner ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithThis.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026110625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ArrayWithNull.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000031010625561630033164 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ArrayWithClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026610625561630033176 0ustar twernertwerner ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithBean.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000034310625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000033710625561630033175 0ustar twernertwerner Value ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/AnnotationBadNoContent.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024010625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000035610625561630033176 0ustar twernertwerner KeyValue ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Map.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023410625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithUninstallCallback.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024110625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/DeploymentWithClassLoader.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024510625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/DeploymentWithName.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016210625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackUninstallWithProperty.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022710625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithList.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026110625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithBean.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027510625561630033176 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/AnnotationBadNoContent2.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027210625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ScopeWithLevel.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023310625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ListWithSet.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030510625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ArrayWithValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032510625561630033172 0ustar twernertwerner Value ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000102410625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithCollection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024310625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithParameter.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026210625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BindingWithPlainValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000021410625561630033167 0ustar twernertwerner binddinb ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryBadNoClassOrFactory.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022110625561630033165 0ustar twernertwerner ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithInjection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027710625561630033200 0ustar twernertwerner ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/SetWithMap.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030310625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/AliasWithNoReplace.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024510625561630033173 0ustar twernertwerner X${alias.test.name}X ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000035510625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithAnnotations.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000062410625561630033174 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 @org.jboss.test.xb.builder.object.mc.support.Annotation2 @org.jboss.test.xb.builder.object.mc.support.Annotation3 ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ArrayWithCollection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000031610625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithInjection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000025310625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ArrayWithWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000045110625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BindingWithComplexValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000034010625561630033167 0ustar twernertwerner 42 ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithDestroy.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016710625561630033176 0ustar twernertwerner ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/SetWithElementClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027010625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/InstallWithBean.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022210625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/AliasWithClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024010625561630033166 0ustar twernertwerner 12345 ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/FactoryWithState.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030510625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithCollection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000033010625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/LifecycleWithAnnotations.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000061210625561630033171 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 @org.jboss.test.xb.builder.object.mc.support.Annotation2 @org.jboss.test.xb.builder.object.mc.support.Annotation3 ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithStart.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020310625561630033165 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/LifecycleWithAnnotation.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000033210625561630033170 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.Annotation1 ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ListWithThis.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030610625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackInstallWithCardinality.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024110625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithDependency.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022610625561630033172 0ustar twernertwerner Depends1 ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithSet.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020010625561630033162 0ustar twernertwerner ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithDependencies.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032410625561630033171 0ustar twernertwerner Depends1 Depends2 Depends3 ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithDependencies.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030610625561630033171 0ustar twernertwerner Depends1 Depends2 Depends3 ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Dependency.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000021210625561630033165 0ustar twernertwerner Dependency ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MultipleAlias.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027310625561630033174 0ustar twernertwerner alias1 alias2 alias3 ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ArrayWithThis.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000031010625561630033164 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027610625561630033177 0ustar twernertwerner Value ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/InstallWithState.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023110625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CollectionWithElementClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027710625561630033200 0ustar twernertwerner ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithUninstall.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000021510625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/MapWithSet.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000036210625561630033173 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithSupply.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020510625561630033167 0ustar twernertwerner Supply1 ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Lifecycle.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000016610625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ListWithCollection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000031410625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithProperty.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000021110625561630033164 0ustar twernertwerner ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ListWithElementClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000027110625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/Property.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000021410625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/FactoryWithBean.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026210625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/DeploymentWithBeanMetaDataFactory.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000036010625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/CallbackInstallWithMethod.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022310625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithPlainValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024010625561630033166 0ustar twernertwerner PlainValue ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/InstallWithMethod.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020710625561630033171 0ustar twernertwerner ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/SetWithSet.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030310625561630033166 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026610625561630033176 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithCollection.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026710625561630033177 0ustar twernertwerner ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithUninstall.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000023310625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithUninstalls.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000032510625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithInstalls.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000031110625561630033165 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ConstructorWithMap.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000020010625561630033162 0ustar twernertwerner ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ListWithClass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026510625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ParameterWithMap.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000026010625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/PropertyWithValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000025210625561630033171 0ustar twernertwerner Value ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/DeploymentWithMultipleBeanFactorys.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000044710625561630033177 0ustar twernertwerner ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/AnnotationWithAttributes.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000047110625561630033174 0ustar twernertwerner @org.jboss.test.xb.builder.object.mc.support.AnnotationWithAttributes(clazz=java.lang.Integer.class, integer=100, str="Annotations are nice") ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithUninstallCallback.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000022310625561630033167 0ustar twernertwerner ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/AnnotationBadNoLeadingAt.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000034410625561630033173 0ustar twernertwerner org.jboss.test.kernel.deployment.xml.support.Annotation1 ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanWithName.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000015710625561630033175 0ustar twernertwerner ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ListWithArray.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000030710625561630033172 0ustar twernertwerner ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/ClassLoaderWithNull.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000021510625561630033170 0ustar twernertwerner ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/AliasWithBeanFactory.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000024010625561630033166 0ustar twernertwerner SimpleAliasWithBF ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/BeanFactoryWithSupplies.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/mc/test/0000644000175000017500000000031310625561630033167 0ustar twernertwerner Supply1 Supply2 Supply3 ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000755000175000017500000000000011620316761033373 5ustar twernertwerner././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000755000175000017500000000000011620316761033373 5ustar twernertwerner././@LongLink0000000000000000000000000000025300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntry_testEntryTypeKeyAttributeValueEntry.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000066711002065013033367 0ustar twernertwerner 1 22 333 ././@LongLink0000000000000000000000000000024000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntry_testXmlElementWrapperMap.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000030211002065013033351 0ustar twernertwerner 1 22 333 ././@LongLink0000000000000000000000000000024300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntry_testWrappedKeyValueSequence.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000050511002065013033356 0ustar twernertwerner key11 key222 key3333 ././@LongLink0000000000000000000000000000026500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntry_testAnnotatedMapKeyAttributeValueEntryContent.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000060411002065013033356 0ustar twernertwerner 1 22 333 ././@LongLink0000000000000000000000000000026200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntry_testEntryTypeKeyAttributeValueEntryContent.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000056211002065013033361 0ustar twernertwerner 1 22 333 ././@LongLink0000000000000000000000000000023400000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntry_testKeyValueSequence.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000026211002065013033356 0ustar twernertwerner key11 key222 key3333 ././@LongLink0000000000000000000000000000030200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntry_testAnnotatedMapWithEntryTypeKeyAttributeValueEntryContent.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000074411002065013033363 0ustar twernertwerner 1 22 333 ././@LongLink0000000000000000000000000000025700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntry_testAnnotatedMapWrappedKeyValueSequence.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000063111002065013033356 0ustar twernertwerner key11 key222 key3333 ././@LongLink0000000000000000000000000000027300000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntry_testAnnotatedMapWithEntryTypeKeyAttributeValueEntry.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000101311002065013033351 0ustar twernertwerner 1 22 333 ././@LongLink0000000000000000000000000000023600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntry_testKeyValueAttributes.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000030711002065013033356 0ustar twernertwerner ././@LongLink0000000000000000000000000000025200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntry_testAnnotatedMapKeyValueAttributes.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000036111002065013033356 0ustar twernertwerner ././@LongLink0000000000000000000000000000025100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntry_testKeyAttributeValueEntryContent.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000046011002065013033356 0ustar twernertwerner 1 22 333 ././@LongLink0000000000000000000000000000025000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntry_testAnnotatedMapKeyValueSequence.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000034211002065013033355 0ustar twernertwerner key11 key222 key3333 ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/anyattribute/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/anyattri0000755000175000017500000000000011620316762033366 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/anyattribute/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/anyattri0000755000175000017500000000000011620316762033366 5ustar twernertwerner././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/anyattribute/test/AnyAttribute.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/anyattri0000755000175000017500000000020311075435045033366 0ustar twernertwerner ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000755000175000017500000000000011620316761033242 5ustar twernertwerner././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/javatypeadapter/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000755000175000017500000000000011620316761033242 5ustar twernertwerner././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/javatypeadapter/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000755000175000017500000000000011620316761033242 5ustar twernertwerner././@LongLink0000000000000000000000000000023700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/javatypeadapter/test/JavaTypeAdapter_testMyHashMapType.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000027511273541450033247 0ustar twernertwerner value1 value22 value333 ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/javatypeadapter/test/JavaTypeAdapter_testMap.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000023010703170676033243 0ustar twernertwerner value1 value22 value333 ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/wrapper/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000755000175000017500000000000011620316761033242 5ustar twernertwerner././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/wrapper/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000755000175000017500000000000011620316761033242 5ustar twernertwerner././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/wrapper/test/Wrapper_testFooWrapper.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000033410702666235033250 0ustar twernertwerner 1 2 1.1 123456789 ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/wrapper/test/Wrapper_testFoo2Wrapper.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000034110702666514033246 0ustar twernertwerner 1 2 1.1 123456789 ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/wrapper/test/Wrapper_testFoo5Wrapper.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000025011276564547033257 0ustar twernertwerner 1 2 1.1 123456789 ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/wrapper/test/Wrapper_testFoo4Wrapper.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000034110763542743033252 0ustar twernertwerner 1 2 1.1 123456789 ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/wrapper/test/Wrapper_testFoo3Wrapper.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000033110702647556033252 0ustar twernertwerner 1 2 1.1 123456789 ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlrootelement/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000755000175000017500000000000011620316761033242 5ustar twernertwerner././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000755000175000017500000000000011620316761033242 5ustar twernertwerner././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000755000175000017500000000000011620316761033242 5ustar twernertwerner././@LongLink0000000000000000000000000000022200000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/test/NonDefaults.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000011410562616254033244 0ustar twernertwerner ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/test/None.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000005710562616254033252 0ustar twernertwerner ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/test/Defaults.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000005710562616254033252 0ustar twernertwerner ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlelements/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000755000175000017500000000000011620316761033242 5ustar twernertwerner././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlelements/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000755000175000017500000000000011620316761033242 5ustar twernertwerner././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlelements/test/XmlElements_testArray.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000022511276564547033261 0ustar twernertwerner 1 2 1.1 3 ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlelement/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000755000175000017500000000000011620316761033242 5ustar twernertwerner././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlelement/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000755000175000017500000000000011620316761033242 5ustar twernertwerner././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlelement/test/NonDefaults.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000014010562616254033243 0ustar twernertwerner Hello ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlelement/test/None.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000011510562616254033245 0ustar twernertwerner Hello././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/xmlelement/test/Defaults.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/element/0000644000175000017500000000011510562616254033245 0ustar twernertwerner Hellolibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/0000755000175000017500000000000011620316761032572 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmltransient/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000755000175000017500000000000011620316761033313 5ustar twernertwerner././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmltransient/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000755000175000017500000000000011620316761033313 5ustar twernertwerner././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmltransient/test/XmlTransientInheritance.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000011710562616254033320 0ustar twernertwerner ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/accessor/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/acc0000755000175000017500000000000011620316761033241 5ustar twernertwerner././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/accessor/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/acc0000755000175000017500000000000011620316761033241 5ustar twernertwerner././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/accessor/test/All.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/acc0000644000175000017500000000015510562616254033250 0ustar twernertwerner three one two ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/accessor/test/Alpha.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/acc0000644000175000017500000000016110562616254033245 0ustar twernertwerner one three two ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/accessor/test/Sequence.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/acc0000644000175000017500000000016710562616254033253 0ustar twernertwerner three two one ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/value/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/val0000755000175000017500000000000011620316761033275 5ustar twernertwerner././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/value/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/val0000755000175000017500000000000011620316761033275 5ustar twernertwerner././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/value/test/SpecifiedValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/val0000644000175000017500000000012010562616254033274 0ustar twernertwerner Hello././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/value/test/NotSpecifiedValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/val0000644000175000017500000000011210562616254033275 0ustar twernertwerner Hello././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/value/test/String.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/val0000644000175000017500000000011210562616254033275 0ustar twernertwerner Hello././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/value/test/Integer.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/val0000644000175000017500000000011010562616254033273 0ustar twernertwerner 4././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000755000175000017500000000000011620316761033313 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000755000175000017500000000000011620316761033313 5ustar twernertwerner././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/EnumConstantUnconvertable.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000014610562616254033322 0ustar twernertwerner ONE././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/NonDefaults.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000006610562616254033323 0ustar twernertwerner 1././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/CollectionOfEnum.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000033410713160561033312 0ustar twernertwerner ONE TWO TWO THREE THREE THREE ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/MatchCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000007410770206227033316 0ustar twernertwerner ONE ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/EnumNotSimple.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000011610562616254033317 0ustar twernertwerner ONE././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/EnumGlobalType.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000012010562616254033312 0ustar twernertwerner ONE././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/None.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000007010562616254033316 0ustar twernertwerner ONE././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/Defaults.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000007010562616254033316 0ustar twernertwerner ONE././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlenum/test/IgnoreCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000007410770206227033316 0ustar twernertwerner One ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbo0000755000175000017500000000000011620316761033265 5ustar twernertwerner././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbo0000755000175000017500000000000011620316761033265 5ustar twernertwerner././@LongLink0000000000000000000000000000025400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RootWithTwoPropertyGroupsUnmarshallingTestCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbo0000644000175000017500000000031411156144134033262 0ustar twernertwerner c b a c b a ././@LongLink0000000000000000000000000000025300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatableParticleChoiceUnmarshallingTestCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbo0000644000175000017500000000011711156144134033263 0ustar twernertwerner a b ././@LongLink0000000000000000000000000000024300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/PropertySequenceUnmarshallingTestCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbo0000644000175000017500000000013311156144134033261 0ustar twernertwerner c b a ././@LongLink0000000000000000000000000000025200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/XmlTypeChoiceCollectionUnmarshallingTestCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbo0000644000175000017500000000022111156144134033257 0ustar twernertwerner value e a b ././@LongLink0000000000000000000000000000025400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RootWithTwoParticleGroupsUnmarshallingTestCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbo0000644000175000017500000000022111156144134033257 0ustar twernertwerner b a ././@LongLink0000000000000000000000000000025500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatablePropertySequenceUnmarshallingTestCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbo0000644000175000017500000000020511156144134033261 0ustar twernertwerner c1 b1 a1 c2 b2 a2 ././@LongLink0000000000000000000000000000024100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/ParticleChoiceUnmarshallingTestCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbo0000644000175000017500000000010311156144134033256 0ustar twernertwerner b ././@LongLink0000000000000000000000000000023600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/PropertyAllUnmarshallingTestCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbo0000644000175000017500000000015511156144134033265 0ustar twernertwerner a c b p ././@LongLink0000000000000000000000000000024100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/PropertyChoiceUnmarshallingTestCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbo0000644000175000017500000000010311156144134033256 0ustar twernertwerner c ././@LongLink0000000000000000000000000000025000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatablePropertyAllUnmarshallingTestCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbo0000644000175000017500000000015111156144134033261 0ustar twernertwerner b c bb aa ././@LongLink0000000000000000000000000000025300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatablePropertyChoiceUnmarshallingTestCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/jbo0000644000175000017500000000013311156144134033261 0ustar twernertwerner c b a ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/collection/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/col0000755000175000017500000000000011620316761033270 5ustar twernertwerner././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/collection/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/col0000755000175000017500000000000011620316761033270 5ustar twernertwerner././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/collection/test/Array.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/col0000644000175000017500000000020710562616254033275 0ustar twernertwerner ONE TWO THREE ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/collection/test/HashSet.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/col0000644000175000017500000000025310562616254033276 0ustar twernertwerner ONE TWO THREE ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/collection/test/ComponentType_testPass.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/col0000644000175000017500000000023111135125034033256 0ustar twernertwerner ONE TWO THREE ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/collection/test/ArrayList.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/col0000644000175000017500000000025710562616254033302 0ustar twernertwerner ONE TWO THREE ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/collection/test/ComponentType.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/col0000644000175000017500000000022711113542347033271 0ustar twernertwerner ONE TWO THREE ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000755000175000017500000000000011620316761033313 5ustar twernertwerner././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000755000175000017500000000000011620316761033313 5ustar twernertwerner././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/NotAnnotatedElementWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000024210676471510033317 0ustar twernertwerner ././@LongLink0000000000000000000000000000023600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementWildcardWithCollectionProperty.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000036510675766376033345 0ustar twernertwerner 1 2 ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/SimpleObjectWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000021410562616254033316 0ustar twernertwerner ././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/XmlElementsAndXmlAnyElement.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000025710754275541033330 0ustar twernertwerner 11 22 ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ArrayObjectWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000027610562616254033326 0ustar twernertwerner ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementBeforePrimitive.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000025611144772643033326 0ustar twernertwerner frustration is not professional ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000014110562616254033315 0ustar twernertwerner ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ArrayElementWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000020410562616254033315 0ustar twernertwerner ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ListElementWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000020210562616254033313 0ustar twernertwerner ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ListObjectWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000027410562616254033324 0ustar twernertwerner ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementPropertiesAndWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000026510676471510033324 0ustar twernertwerner ././@LongLink0000000000000000000000000000027400000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementWildcardWithCollectionProperty_testUnmarshalResolvedWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000035510676445111033322 0ustar twernertwerner 1 2 ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/simple/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/sim0000755000175000017500000000000011620316761033303 5ustar twernertwerner././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/simple/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/sim0000755000175000017500000000000011620316761033303 5ustar twernertwerner././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/simple/test/String.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/sim0000644000175000017500000000007710562616254033315 0ustar twernertwerner hello ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/simple/test/Integer.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/sim0000644000175000017500000000007510562616254033313 0ustar twernertwerner 4 ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmltype/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000755000175000017500000000000011620316761033313 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmltype/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000755000175000017500000000000011620316761033313 5ustar twernertwerner././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmltype/test/NonDefaults.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000005710562616254033323 0ustar twernertwerner ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmltype/test/BeanAdapter.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000020410625561630033312 0ustar twernertwerner property1 property2 ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmltype/test/None.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000005710562616254033323 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xmltype/test/Defaults.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/type/xml0000644000175000017500000000005710562616254033323 0ustar twernertwerner ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlcollection/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000755000175000017500000000000011620316762033374 5ustar twernertwerner././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlcollection/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000755000175000017500000000000011620316762033374 5ustar twernertwerner././@LongLink0000000000000000000000000000025300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlcollection/test/JBossXmlCollection_testUnparameterizedJbossXmlList.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000042010707702043033366 0ustar twernertwerner 11 22 33 ././@LongLink0000000000000000000000000000023700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlcollection/test/JBossXmlCollection_testUnparameterized.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000032410707702043033371 0ustar twernertwerner 1 22 333 ././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlcollection/test/JBossXmlCollection_testDefault.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000027110707702043033372 0ustar twernertwerner default1 default22 default333 ././@LongLink0000000000000000000000000000023400000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxmlcollection/test/JBossXmlCollection_testJbossXmlList.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/jbossxml0000644000175000017500000000032410707702043033371 0ustar twernertwerner jbossxmllist1 jbossxmllist22 jbossxmllist333 ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribute/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribut0000755000175000017500000000000011620316761033370 5ustar twernertwerner././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribute/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribut0000755000175000017500000000000011620316761033370 5ustar twernertwerner././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribute/test/SchemaDefaultAttributeValue.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribut0000644000175000017500000000066311223226345033374 0ustar twernertwerner ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribute/test/IntegerList.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribut0000644000175000017500000000012411305204145033357 0ustar twernertwerner ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribute/test/String.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribut0000644000175000017500000000011610562616254033374 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribute/test/Integer.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribut0000644000175000017500000000011310562616254033371 0ustar twernertwerner ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribute/test/SchemaDefaultAttributeValue.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribut0000644000175000017500000000040211223226345033363 0ustar twernertwerner ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribute/test/QualifierPointList.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribut0000644000175000017500000000016211305204145033361 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribute/javatypeadapter/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribut0000755000175000017500000000000011620316761033370 5ustar twernertwerner././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribute/javatypeadapter/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribut0000755000175000017500000000000011620316761033370 5ustar twernertwerner././@LongLink0000000000000000000000000000024400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribute/javatypeadapter/test/JavaTypeAdapter_testAdaptedAttribute.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/builder/object/attribut0000644000175000017500000000007611343672270033377 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/0000755000175000017500000000000011620316760030701 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/0000755000175000017500000000000011620316760031660 5ustar twernertwerner././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/ImportedSchemaUnitTestCase.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/Imported0000644000175000017500000000107411237042710033363 0ustar twernertwerner ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/ImportedSchema.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/Imported0000644000175000017500000000073411237042710033365 0ustar twernertwerner ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/BasicBindingValidatorUnitTestCase.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/BasicBin0000644000175000017500000000216311207772035033261 0ustar twernertwerner ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/UnboundedChoiceAsUnorderedSequenceUnitTestCase.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/Unbounde0000644000175000017500000000107311236262462033365 0ustar twernertwerner ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/ValidatingResolverUnitTestCase.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/Validati0000644000175000017500000000011111211711053033317 0ustar twernertwerner 1 2 ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/ValidatingResolverUnitTestCase.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/Validati0000644000175000017500000000100311211711053033320 0ustar twernertwerner ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/ComplexTypeEquivalentToSimpleUnitTestCase.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xb/validator/test/ComplexT0000644000175000017500000000157711260156052033344 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/0000755000175000017500000000000011620316760027103 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XOPUnitTestCase.xml0000644000175000017500000000034410504511200032552 0ustar twernertwerner aW1hZ2U= c2ln ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/JbxbSchemaBindingAttribute_testTop.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/JbxbSchemaBindingAttri0000644000175000017500000000025511044055770033336 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializerUnitTestCaseContainer.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializ0000644000175000017500000000015210513427451033374 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/NestedWildcard.xsd0000644000175000017500000000172610533036112032515 0ustar twernertwerner ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray2.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTes0000644000175000017500000000060411062060756033422 0ustar twernertwerner product1 product2 2 product3 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/AnyComplexType.xsd0000644000175000017500000000157310526644661032562 0ustar twernertwerner ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/TopLevelValueAdapter.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/TopLevelValueAdapter.x0000644000175000017500000000017010562131326033317 0ustar twernertwerner string libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/GlobalGroup.xml0000644000175000017500000000024510512170005032030 0ustar twernertwerner Hello Goodbye ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/TopLevelValueAdapter.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/TopLevelValueAdapter.x0000644000175000017500000000113410562131364033322 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/0000755000175000017500000000000011620316757031576 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/test/0000755000175000017500000000000011620316757032555 5ustar twernertwerner././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/test/ElementOrder_testValidABSequence.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/test/Elem0000644000175000017500000000005311143235515033350 0ustar twernertwerner a b ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/test/ElementOrder_testWrongOneTwoOrder.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/test/Elem0000644000175000017500000000010111143235515033342 0ustar twernertwerner two one ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/test/ElementOrder_testValidOneTwoOrder.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/test/Elem0000644000175000017500000000010111143235515033342 0ustar twernertwerner one two ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/test/ElementOrder_testValidRepeatedCD.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/test/Elem0000644000175000017500000000011111143235515033343 0ustar twernertwerner c1 d1 c2 d2 ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/test/ElementOrder_testWrongRepeatedCD.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/test/Elem0000644000175000017500000000005511143235515033352 0ustar twernertwerner d1 c1 ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/test/ElementOrder_testWrongABSequence.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/elementorder/test/Elem0000644000175000017500000000005311143235515033350 0ustar twernertwerner b a ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializerUnitTestCaseContainerSkipNotSimple.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializ0000644000175000017500000000034410513427451033377 0ustar twernertwerner Should ignore this libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XOPUnitTestCase.xsd0000644000175000017500000000421310517663120032564 0ustar twernertwerner ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testUnmarshal1.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTes0000644000175000017500000000357610504436373033437 0ustar twernertwerner ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase_complexContent.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitT0000644000175000017500000000014510605210763033334 0ustar twernertwerner test libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SimpleContent.xml0000644000175000017500000000021010526644661032412 0ustar twernertwerner Hello libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SimpleContent.xsd0000644000175000017500000000154510526644661032424 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/GlobalGroup.xsd0000644000175000017500000000223010512170005032022 0ustar twernertwerner ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/resolverwithqnamemapping/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/resolverwithqnamemappi0000755000175000017500000000000011620316757033640 5ustar twernertwerner././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/resolverwithqnamemapping/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/resolverwithqnamemappi0000755000175000017500000000000011620316757033640 5ustar twernertwerner././@LongLink0000000000000000000000000000022600000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/resolverwithqnamemapping/test/ResolverWithQNameMapping_testNoNsRoot.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/resolverwithqnamemappi0000644000175000017500000000005211453330564033633 0ustar twernertwerner nons:root ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/resolverwithqnamemapping/test/ResolverWithQNameMapping_testNs1Root.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/resolverwithqnamemappi0000644000175000017500000000006511453330564033637 0ustar twernertwerner ns1:root ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XOPUnitTestCaseOptimized.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XOPUnitTestCaseOptimiz0000644000175000017500000000066110504511200033331 0ustar twernertwerner ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitT0000644000175000017500000000105610605210763033336 0ustar twernertwerner ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/ListValueUnitTestCase_testCtor.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/ListValueUnitTestCase_0000644000175000017500000000237211051247711033372 0ustar twernertwerner ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/ListValueUnitTestCase_testCtor.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/ListValueUnitTestCase_0000644000175000017500000000014711051247711033370 0ustar twernertwerner item1 item2 1 2 ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/IgnorableWhitespaceContent.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/IgnorableWhitespaceCon0000644000175000017500000000031310634251310033373 0ustar twernertwerner newline, 6 spaces, newline, 3 spaces ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializerUnitTestCaseContainerSkipSimple.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializ0000644000175000017500000000033510513427451033377 0ustar twernertwerner ContainerSkip ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XOPUnitTestCaseJpeg.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XOPUnitTestCaseJpeg.xm0000644000175000017500000000030110504513640033207 0ustar twernertwerner ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/JbxbSchemaBindingAttribute_testNested.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/JbxbSchemaBindingAttri0000644000175000017500000000032211044055770033331 0ustar twernertwerner ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatedElementsUnitTestCase_testRepeatedElements.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatedElementsUnitTe0000644000175000017500000000160010513703171033376 0ustar twernertwerner ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray2.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTes0000644000175000017500000000311411062060756033421 0ustar twernertwerner ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatedElementsUnitTestCase_testRepeatedElements.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatedElementsUnitTe0000644000175000017500000000023610513703171033402 0ustar twernertwerner one two ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializerUnitTestCaseContainerStrictNotSimple.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializ0000644000175000017500000000036010513427451033375 0ustar twernertwerner This should cause an error ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializerUnitTestCaseContainerStrictSimple.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializ0000644000175000017500000000034310513427451033376 0ustar twernertwerner ContainerStrict ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testUnmarshal2.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTes0000644000175000017500000000023710504436373033426 0ustar twernertwerner item1 item2 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/0000755000175000017500000000000011620316757032467 5ustar twernertwerner././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/0000755000175000017500000000000011620316757033446 5ustar twernertwerner././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/0000644000175000017500000000114611310425750033440 0ustar twernertwerner ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFoo2Bar.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/0000644000175000017500000000030711152730607033442 0ustar twernertwerner foo bar1 bar2 ././@LongLink0000000000000000000000000000022000000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase_testBar.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/0000644000175000017500000000030411152730607033437 0ustar twernertwerner HelloWorld ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFoo3Bar.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/0000644000175000017500000000033211152730607033440 0ustar twernertwerner foo bar1 bar2 bar3 ././@LongLink0000000000000000000000000000022100000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testBar.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/0000644000175000017500000000024111152730607033437 0ustar twernertwerner bar ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/0000644000175000017500000000103211152730607033436 0ustar twernertwerner ././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase_testFooBar.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/0000644000175000017500000000026311152730607033443 0ustar twernertwerner foo bar ././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase_testFooBar.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/choiceresolution/test/0000644000175000017500000000027611152730607033447 0ustar twernertwerner goodbye HelloWorld ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/CollectionOverrideProperty.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/CollectionOverrideProp0000644000175000017500000000025610526644661033475 0ustar twernertwerner one two ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializerUnitTestCaseSimple.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializ0000644000175000017500000000054010513427451033375 0ustar twernertwerner ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializerUnitTestCaseContainer.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializ0000644000175000017500000000166210513427451033403 0ustar twernertwerner ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XIncludeUnitTestCase_testXInclude.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XIncludeUnitTestCase_t0000644000175000017500000000121410510220037033342 0ustar twernertwerner ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/DuplicateInterceptor.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/DuplicateInterceptor.x0000644000175000017500000000177110527102732033430 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/0000755000175000017500000000000011620316757032631 5ustar twernertwerner././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test0000755000175000017500000000000011620316757033531 5ustar twernertwerner././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test/BasicUnorderedSequence_incorrectAB.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test0000644000175000017500000000005111151050602033506 0ustar twernertwerner b a ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test/BasicUnorderedSequence_correctAB.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test0000644000175000017500000000005111151050602033506 0ustar twernertwerner a b ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test/MiscGroups_correct.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test0000644000175000017500000000013511151050602033511 0ustar twernertwerner a b d e f g ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test/NestedSequence_correct.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test0000644000175000017500000000013011151050602033504 0ustar twernertwerner a 1 2 b c ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test/NestedSequence_incorrect.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test0000644000175000017500000000013011151050602033504 0ustar twernertwerner b 2 c 1 a ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test/UnorderedOrderedMix.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test0000644000175000017500000000052711350256505033531 0ustar twernertwerner string1 string1 choice11 a1 choice21 b1 a2 b2 c1 c2 string2 string1 string2 ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test/UnorderedSequenceWithCollections.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test0000644000175000017500000000027711477210544033536 0ustar twernertwerner 1 2 1 2 3 4 3 4 ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test/MiscGroups_incorrect.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/unorderedsequence/test0000644000175000017500000000013511151050602033511 0ustar twernertwerner g e b f a d ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/DuplicateInterceptor.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/DuplicateInterceptor.x0000644000175000017500000000024610527102732033424 0ustar twernertwerner Hello ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testUnmarshal1.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTes0000644000175000017500000000137510504436373033432 0ustar twernertwerner item1 item2 item3 sequenceChoice1_1 sequenceChoice2_1 sequenceChoice1_2 sequenceChoice1_3 sequenceChoice2_2 choiceChoice1_1 choiceChoice1_2 choiceChoice2_1 choiceChoice2_2 choiceChoice1_3 choiceChoice1_4 ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase_simpleContent.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/AnyTypeDomBindingUnitT0000644000175000017500000000013210605210763033330 0ustar twernertwerner test libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SharedElement.xsd0000644000175000017500000000163410512170005032334 0ustar twernertwerner ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTes0000644000175000017500000000072611051025777033431 0ustar twernertwerner product1 1 product2 2 product3 3 ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/AnyComplexTypeFromWildCard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/AnyComplexTypeFromWild0000644000175000017500000000101410526644661033417 0ustar twernertwerner e1c1 e1s1c1 e1s1s1c1 e1s1s2c1 e1s2c1 ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializerUnitTestCaseSimple.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializ0000644000175000017500000000015410513427451033376 0ustar twernertwerner SimpleTest ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/AnyComplexTypeFromMultipleWildCardAndElement.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/AnyComplexTypeFromMult0000644000175000017500000000115510526644661033447 0ustar twernertwerner e1c1 e1s1c1 e1s1s1c1 e1s1s2c1 e1s2c1 e2c1 ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testPolymorphicArray.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTes0000644000175000017500000000311411051025777033423 0ustar twernertwerner ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XIncludeUnitTestCase_testXInclude_Included.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XIncludeUnitTestCase_t0000644000175000017500000000014110510220037033340 0ustar twernertwerner ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializerUnitTestCaseContainerLaxNotSimple.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializ0000644000175000017500000000034310513427451033376 0ustar twernertwerner Should ignore this ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTestCase_testUnmarshal2.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/RepeatableTermsUnitTes0000644000175000017500000000244710504436373033433 0ustar twernertwerner ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializerUnitTestCaseContainerLaxSimple.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/SchemaBindingInitializ0000644000175000017500000000033210513427451033374 0ustar twernertwerner ContainerLax ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XOPUnitTestCaseImageWithContentType.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XOPUnitTestCaseImageWi0000644000175000017500000000043010504513640033224 0ustar twernertwerner ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/CollectionOverrideProperty.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/CollectionOverrideProp0000644000175000017500000000153510526644661033476 0ustar twernertwerner ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/AnyComplexTypeFromWildCardAndElement.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/AnyComplexTypeFromWild0000644000175000017500000000107010526644661033421 0ustar twernertwerner e1c1 e1s1c1 e1s1s1c1 e1s1s2c1 e1s2c1 ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/WildcardWrapperUnitTestCase.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/WildcardWrapperUnitTes0000644000175000017500000000147210513427451033440 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/xmlmime.xsd0000644000175000017500000000306410504511200031260 0ustar twernertwerner ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/WildcardWrapperUnitTestCaseSimple.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/WildcardWrapperUnitTes0000644000175000017500000000021010513427451033425 0ustar twernertwerner testSimple ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XIncludeUnitTestCase_testXInclude.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/XIncludeUnitTestCase_t0000644000175000017500000000025110510220037033342 0ustar twernertwerner ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/WildcardWrapperUnitTestCaseWildcard.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/org/jboss/test/xml/WildcardWrapperUnitTes0000644000175000017500000000030210513427451033427 0ustar twernertwerner testWildcard ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/DefaultSchemaResolverUnitTestCase_testRedefine_redefined.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/DefaultSchemaResolverUnitTestCase_testRed0000644000175000017500000000130110766470761033564 0ustar twernertwerner The elements that use this type designate the name of a Java class or interface. The name is in the form of a "binary name", as defined in the JLS and as used in Class.forName(). libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/0000755000175000017500000000000011620316757024223 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/0000755000175000017500000000000011620316757026421 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/ejb-config_1_0.xsd0000644000175000017500000000621410513427451031600 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testAnnotations.xml0000644000175000017500000000206310513427451032333 0ustar twernertwerner Bean2 ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testGenericBeanFactory.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testGenericBeanFactory.xml0000644000175000017500000000136310513427451033532 0ustar twernertwerner Bean1 Bean2 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testConfigureNested.xml0000644000175000017500000000456210513427451033130 0ustar twernertwerner StringValue 12 true 123 1234 12345 3.14 3.14e12 12/12/12 12e4 123456 12 true 123 1234 12345 3.14 3.14e12 ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testDemandSupplyWhenRequired.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testDemandSupplyWhenRequir0000644000175000017500000000114010513427451033651 0ustar twernertwerner SimpleBean2 whenRequired libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testFactoryDependency.xml0000644000175000017500000000144310513427451033445 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/ejb-cache_1_0.xsd0000644000175000017500000000311010513427451031366 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testSimpleCollection.xml0000644000175000017500000000273410513427451033310 0ustar twernertwerner value0 value1 value0 value1 other nullKey prop0 value0 prop1 value1 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testConfigure.xml0000644000175000017500000000226310513427451031761 0ustar twernertwerner StringValue 12 true 123 1234 12345 3.14 3.14e12 12/12/12 12e4 123456 12 true 123 1234 12345 3.14 3.14e12 ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testAttributeDependencyDependentState.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testAttributeDependencyDep0000644000175000017500000000117210513427451033632 0ustar twernertwerner Bean2 ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testConstructorDependency.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testConstructorDependency.0000644000175000017500000000115510513427451033642 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testDemandSupply.xml0000644000175000017500000000115510513427451032444 0ustar twernertwerner SimpleBean2 XYZZY XYZZY ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testAttributeDependency.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testAttributeDependency.xm0000644000175000017500000000117610513427451033630 0ustar twernertwerner Bean2 ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testStaticFactoryDependency.xmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/testStaticFactoryDependenc0000644000175000017500000000134110513427451033622 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/pojoserver/test1-ejb-deployment.xml0000644000175000017500000000702010513427451033110 0ustar twernertwerner jboss:service=invoker,type=jrmp org.jboss.proxy.ejb.ProxyFactory org.jboss.proxy.ejb.HomeInterceptor org.jboss.proxy.SecurityInterceptor org.jboss.proxy.TransactionInterceptor org.jboss.invocation.InvokerInterceptor org.jboss.invocation.MarshallingInvokerInterceptor org.jboss.proxy.ejb.StatelessSessionInterceptor org.jboss.proxy.SecurityInterceptor org.jboss.proxy.TransactionInterceptor org.jboss.invocation.InvokerInterceptor org.jboss.invocation.MarshallingInvokerInterceptor org.jboss.ejb.plugins.LRUStatefulContextCachePolicy 50 1000000 1800 1800 300 600 400 60 1 0.75 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb-bean-deployer_1_0.xsd0000644000175000017500000010466010513427451031054 0ustar twernertwerner ... ]]> false ]]> ]]> package com.acme.User; public class User { // factory has been configured at this point public void setFactory(GenericBeanFactory factory) { SomeBean bean1 = factory.createBean(); System.out.println(bean1.getSomeProperty()); // "SomeOtherBean" SomeBean bean2 = factory.createBean(); System.out.println(bean2.getSomeProperty()); // "SomeOtherBean" } } ]]> String value e.g. static factory - com.acme.Factory.newInstance(new String("String value")); String value e.g. instance factory - "SomeOtherBean".newInstance(new String("String value")); String value ]]> String value ]]> e.g. Bean property - "InjectedIntoMe".setSomeProperty("BeanInjected".getOtherProperty()); ]]> The elements that use this type designate the name of a Java class or interface. The name is in the form of a "binary name", as defined in the JLS and as used in Class.forName(). , or collection components e.g. Hello e.g. This also defines the null value as opposed to the empty string or the string "null" null TODO: "any" is currently unimplemented. ]]> An extension value xxx ]]> xxx ]]> 1st Parameter 2nd Parameter e.g. Explicitly stating the parameter type to resolve overloading 1st Parameter 2nd Parameter e.g. To override the injected type use 1st Parameter 2nd Parameter ]]> Some value e.g. Overridding the injected type Some value ]]> http://localhost http://localhost ]]> libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/annotated-bean-deployer_1_0.xsd0000644000175000017500000010165210513427451032102 0ustar twernertwerner ... ]]> ]]> ]]> package com.acme.User; public class User { // factory has been configured at this point public void setFactory(GenericBeanFactory factory) { SomeBean bean1 = factory.createBean(); System.out.println(bean1.getSomeProperty()); // "SomeOtherBean" SomeBean bean2 = factory.createBean(); System.out.println(bean2.getSomeProperty()); // "SomeOtherBean" } } ]]> String value e.g. static factory - com.acme.Factory.newInstance(new String("String value")); String value e.g. instance factory - "SomeOtherBean".newInstance(new String("String value")); String value ]]> String value ]]> e.g. Bean property - "InjectedIntoMe".setSomeProperty("BeanInjected".getOtherProperty()); ]]> 1st Parameter 2nd Parameter e.g. Explicitly stating the parameter type to resolve overloading 1st Parameter 2nd Parameter e.g. To override the injected type use 1st Parameter 2nd Parameter ]]> Some value e.g. Overridding the injected type Some value ]]> The elements that use this type designate the name of a Java class or interface. The name is in the form of a "binary name", as defined in the JLS and as used in Class.forName(). , or collection components e.g. Hello e.g. This also defines the null value as opposed to the empty string or the string "null" null TODO: "any" is currently unimplemented. ]]> An extension value xxx ]]> xxx ]]> http://localhost http://localhost ]]> libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/loginconfig/0000755000175000017500000000000011620316757026521 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/loginconfig/security-config_5_0.xsd0000644000175000017500000001613110513427451033012 0ustar twernertwerner false libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/loginconfig/security-config_4_1.xsd0000644000175000017500000000662410513427451033020 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/loginconfig/user-roles_1_0.xsd0000644000175000017500000000431611062060756031777 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/loginconfig/user-roles.xml0000644000175000017500000000221211062060756031333 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/loginconfig/config.xml0000644000175000017500000000443410513427451030507 0ustar twernertwerner guest libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/loginconfig/jaspi-config.xml0000644000175000017500000000655410513427451031620 0ustar twernertwerner guest props/jbossws-users.properties props/jbossws-roles.properties anonymous props/jbossws-users.properties props/jbossws-roles.properties anonymous libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/sandbox.xsd0000644000175000017500000000311710513427451026375 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/maps.xml0000644000175000017500000000103410513427451025675 0ustar twernertwerner key1 value1 value2 value4 key_1value_1 key_2value_2 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/collections.xsd0000644000175000017500000000172110513427451027254 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/person.dtd0000644000175000017500000000056510513427451026226 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/choice.xsd0000644000175000017500000000264210513427451026173 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/valuebinding.xml0000644000175000017500000000066710513427451027417 0ustar twernertwerner default value value1 value2 A B foo libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/person.xml0000644000175000017500000000100710513427451026243 0ustar twernertwerner Vasiliy Poupkin 1980-01-01 01 02
prosp. Rad. Ukr. 11A, 70
Sky 7
libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/SchemaIncludeUnitTestCase.xsd0000644000175000017500000000127010513427451031735 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/maps.xsd0000644000175000017500000002231710513427451025702 0ustar twernertwerner key_data value_data ]]> value_data ]]> ]]> value_data ]]> libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/any.xml0000644000175000017500000000217210513427451025530 0ustar twernertwerner any test str1 str2 str3 1 2 3 item1 item2 item3 item4 item5 item6 1 0 -1 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/xerces-bug.xsd0000644000175000017500000000313610513427451027004 0ustar twernertwerner ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/SchemaIncludeUnitTestCaseIncluded.xsdlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/SchemaIncludeUnitTestCaseIncluded.xsd0000644000175000017500000000075210513427451033411 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/book/0000755000175000017500000000000011620316756025154 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/book/books2.dtd0000644000175000017500000000114410605002065027033 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/book/book-xs.xml0000644000175000017500000000133510605034574027257 0ustar twernertwerner Being a Dog Is a Full-Time Job Charles M. Schulz Snoopy Peppermint Patty 1950-10-04 extroverted beagle Peppermint Patty 1966-08-22 bold, brash and tomboyish libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/book/annotated_books.xsd0000644000175000017500000000512310513427451031042 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/book/books2-dtd.xml0000644000175000017500000000112610605034574027643 0ustar twernertwerner Being a Dog Is a Full-Time Job Charles M. Schulz Snoopy Peppermint Patty 1950-10-04 extroverted beagle Peppermint Patty 1966-08-22 bold, brash and tomboyish libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/book/books.xsd0000644000175000017500000000210310513427451027000 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/book/book-dtd.xml0000644000175000017500000000114610605034574027400 0ustar twernertwerner Being a Dog Is a Full-Time Job Charles M. Schulz Snoopy Peppermint Patty 1950-10-04 extroverted beagle Peppermint Patty 1966-08-22 bold, brash and tomboyish libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/book/books.dtd0000644000175000017500000000057210513427451026765 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/sandbox.xml0000644000175000017500000000163710513427451026404 0ustar twernertwerner choice1_a choice1_b choice2_c choice2_d choice2_e choice2_d 1 2 3 1 2 3 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/po.xsd0000644000175000017500000000526010513427451025356 0ustar twernertwerner Purchase order schema for Example.com. Copyright 2000 Example.com. All rights reserved. libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/soapenc/0000755000175000017500000000000011620316756025652 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/soapenc/test.xsd0000644000175000017500000000400010513427451027336 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/soapenc/soapenc.xsd0000644000175000017500000000616210513427451030022 0ustar twernertwerner Attributes common to all elements that function as accessors or represent independent (multi-ref) values. The href attribute is intended to be used in a manner like CONREF. That is, the element content should be empty iff the href attribute appears libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/multispaced/0000755000175000017500000000000011620316757026535 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/multispaced/xmbean-localns.xml0000644000175000017500000000363510513427451032163 0ustar twernertwerner The JBoss XMBean version of the monitor server monitor.MonitorPOJO The no-arg constructor monitor.MonitorPOJO The interval in milliseconds between checks of VM memory and threads Interval int Access the last HistoryLength monitor reports history java.lang.String A notification sent when the monitor interval expires javax.management.Notification monitor.IntervalElapsed java:/DefaultDS xmbeans libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/multispaced/xmbean.xsd0000644000175000017500000000710610513427451030525 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/multispaced/xmbean.xml0000644000175000017500000000360010513427451030522 0ustar twernertwerner The JBoss XMBean version of the monitor server monitor.MonitorPOJO The no-arg constructor monitor.MonitorPOJO The interval in milliseconds between checks of VM memory and threads Interval int Access the last HistoryLength monitor reports history java.lang.String A notification sent when the monitor interval expires javax.management.Notification monitor.IntervalElapsed java:/DefaultDS xmbeans libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/multispaced/jdbcpm.xsd0000644000175000017500000000105210513427451030504 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/naming/0000755000175000017500000000000011620316757025474 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/naming/custom-object-binding.xsd0000644000175000017500000000415110513427451032375 0ustar twernertwerner A custom schema for specifying how a java.util.Properties object is unmarshalled. libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/naming/jndi-binding-service_1_0.xsd0000644000175000017500000000735611357571642032663 0ustar twernertwerner This schema defines the content model for the JNDIBindingService BindingsConfig attribute content. ... ]]> false true An extension point for arbitrary xml value fragments The JNDI name of the binding libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/naming/testBindings.xml0000644000175000017500000000247511357571642030666 0ustar twernertwerner value1 ${user.home} http://www.jboss.org key1 value1 key2 value2 127.0.0.1 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb/0000755000175000017500000000000011620316756025147 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb/defaults/0000755000175000017500000000000011620316756026756 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb/defaults/schema1.xsd0000644000175000017500000000134610513427451031016 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb/defaults/testSchema1.xml0000644000175000017500000000035510513427451031657 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb/defaults/schema2.xsd0000644000175000017500000000157510513427451031023 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb/defaults/testSchema2.xml0000644000175000017500000000035510513427451031660 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb/minOccurs/0000755000175000017500000000000011620316756027111 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb/minOccurs/schema1.xsd0000644000175000017500000000247710513427451031157 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb/minOccurs/testSchema1.xml0000644000175000017500000000020710513427451032006 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb/minOccurs/schema1v2.xsd0000644000175000017500000000307010513427451031415 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb/characters/0000755000175000017500000000000011620316756027266 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb/characters/schema1.xsd0000644000175000017500000000674310513427451031334 0ustar twernertwerner An extension point for arbitrary xml value fragments libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/jbxb/characters/testSchema1.xml0000644000175000017500000000042610513427451032166 0ustar twernertwerner value1 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/person.xsd0000644000175000017500000000260110513427451026242 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/newmetadata.xml0000644000175000017500000000161310513427451027232 0ustar twernertwerner default value value1 value2 A B foo bar key1 value1 value2 value4 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/po.xml0000644000175000017500000000170310513427451025356 0ustar twernertwerner Alice Smith 123 Maple Street Mill Valley CA 90952 Robert Smith 8 Oak Avenue Old Town PA 95819 Hurry, my lawn is going wild! Lawnmower 1 148.95 Confirm this is electric Baby Monitor 1 39.98 1999-05-21 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/aop/0000755000175000017500000000000011620316756025001 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/aop/test-aop.xml0000644000175000017500000000114210513427451027250 0ustar twernertwerner Hello World libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/aop/bean.xml0000644000175000017500000000025710513427451026427 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/any.xsd0000644000175000017500000000112010513427451025516 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/immutable.xsd0000644000175000017500000000422410513427451026716 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/bean-deployer_1_0.xsd0000644000175000017500000006312510513427451030131 0ustar twernertwerner ... ]]> ]]> ]]> package com.acme.User; public class User { // factory has been configured at this point public void setFactory(GenericBeanFactory factory) { SomeBean bean1 = factory.createBean(); System.out.println(bean1.getSomeProperty()); // "SomeOtherBean" SomeBean bean2 = factory.createBean(); System.out.println(bean2.getSomeProperty()); // "SomeOtherBean" } } ]]> String value e.g. static factory - com.acme.Factory.newInstance(new String("String value")); String value e.g. instance factory - "SomeOtherBean".newInstance(new String("String value")); String value ]]> String value ]]> e.g. Bean property - "InjectedIntoMe".setSomeProperty("BeanInjected".getOtherProperty()); ]]> 1st Parameter 2nd Parameter e.g. Explicitly stating the parameter type to resolve overloading 1st Parameter 2nd Parameter e.g. To override the injected type use 1st Parameter 2nd Parameter ]]> Some value e.g. Overridding the injected type Some value ]]> The elements that use this type designate the name of a Java class or interface. The name is in the form of a "binary name", as defined in the JLS and as used in Class.forName(). , or collection components e.g. Hello e.g. This also defines the null value as opposed to the empty string or the string "null" null TODO: "any" is currently unimplemented. ]]> An extension value xxx ]]> xxx ]]> http://localhost http://localhost ]]> libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml/collections.xml0000644000175000017500000000135710513427451027263 0ustar twernertwerner str1 str2 str3 1 2 3 item1 item2 item3 item4 item5 item6 1 0 -1 libjboss-xml-binding-java-2.0.3.GA.orig/src/test/resources/xml.xsd0000755000175000017500000001261710674477215024762 0ustar twernertwerner See http://www.w3.org/XML/1998/namespace.html and http://www.w3.org/TR/REC-xml for information about this namespace. This schema document describes the XML namespace, in a form suitable for import by other schema documents. Note that local names in this namespace are intended to be defined only by the World Wide Web Consortium or its subgroups. The following names are currently defined in this namespace and should not be used with conflicting semantics by any Working Group, specification, or document instance: base (as an attribute name): denotes an attribute whose value provides a URI to be used as the base for interpreting any relative URIs in the scope of the element on which it appears; its value is inherited. This name is reserved by virtue of its definition in the XML Base specification. id (as an attribute name): denotes an attribute whose value should be interpreted as if declared to be of type ID. The xml:id specification is not yet a W3C Recommendation, but this attribute is included here to facilitate experimentation with the mechanisms it proposes. Note that it is _not_ included in the specialAttrs attribute group. lang (as an attribute name): denotes an attribute whose value is a language code for the natural language of the content of any element; its value is inherited. This name is reserved by virtue of its definition in the XML specification. space (as an attribute name): denotes an attribute whose value is a keyword indicating what whitespace processing discipline is intended for the content of the element; its value is inherited. This name is reserved by virtue of its definition in the XML specification. Father (in any context at all): denotes Jon Bosak, the chair of the original XML Working Group. This name is reserved by the following decision of the W3C XML Plenary and XML Coordination groups: In appreciation for his vision, leadership and dedication the W3C XML Plenary on this 10th day of February, 2000 reserves for Jon Bosak in perpetuity the XML name xml:Father This schema defines attributes and an attribute group suitable for use by schemas wishing to allow xml:base, xml:lang, xml:space or xml:id attributes on elements they define. To enable this, such a schema must import this schema for the XML namespace, e.g. as follows: <schema . . .> . . . <import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/> Subsequently, qualified reference to any of the attributes or the group defined below will have the desired effect, e.g. <type . . .> . . . <attributeGroup ref="xml:specialAttrs"/> will define a type which will schema-validate an instance element with any of those attributes In keeping with the XML Schema WG's standard versioning policy, this schema document will persist at http://www.w3.org/2005/08/xml.xsd. At the date of issue it can also be found at http://www.w3.org/2001/xml.xsd. The schema document at that URI may however change in the future, in order to remain compatible with the latest version of XML Schema itself, or with the XML namespace itself. In other words, if the XML Schema or XML namespaces change, the version of this document at http://www.w3.org/2001/xml.xsd will change accordingly; the version at http://www.w3.org/2005/08/xml.xsd will not change. Attempting to install the relevant ISO 2- and 3-letter codes as the enumerated possible values is probably never going to be a realistic possibility. See RFC 3066 at http://www.ietf.org/rfc/rfc3066.txt and the IANA registry at http://www.iana.org/assignments/lang-tag-apps.htm for further information. The union allows for the 'un-declaration' of xml:lang with the empty string. See http://www.w3.org/TR/xmlbase/ for information about this attribute. See http://www.w3.org/TR/xml-id/ for information about this attribute. libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/0000755000175000017500000000000011620316735022326 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/0000755000175000017500000000000011620316735023115 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/0000755000175000017500000000000011620316735024235 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/0000755000175000017500000000000011620316744025214 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/0000755000175000017500000000000011620316743026762 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/0000755000175000017500000000000011620316743027741 5ustar twernertwerner././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/StaticClassMethodInstantiateUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/StaticClassMethod0000644000175000017500000000326310763015442033245 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.test; import junit.framework.Test; import org.jboss.test.javabean.support.TestStaticClassMethodInstantiate; /** * StaticClassMethodInstantiateUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class StaticClassMethodInstantiateUnitTestCase extends AbstractJavaBeanTest { public static Test suite() { return suite(StaticClassMethodInstantiateUnitTestCase.class); } public StaticClassMethodInstantiateUnitTestCase(String name) { super(name); } public void testStaticClassMethodInstantiate() throws Exception { unmarshalJavaBean20(TestStaticClassMethodInstantiate.class); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/StaticMethodInstantiateUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/StaticMethodInsta0000644000175000017500000000322010763015442033247 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.test; import junit.framework.Test; import org.jboss.test.javabean.support.TestStaticMethodInstantiate; /** * StaticMethodInstantiateUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class StaticMethodInstantiateUnitTestCase extends AbstractJavaBeanTest { public static Test suite() { return suite(StaticMethodInstantiateUnitTestCase.class); } public StaticMethodInstantiateUnitTestCase(String name) { super(name); } public void testStaticMethodInstantiate() throws Exception { unmarshalJavaBean20(TestStaticMethodInstantiate.class); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/JavaBeanTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/JavaBeanTestSuite0000644000175000017500000000406510763015442033211 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.test; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * JavaBean Test Suite. * * @author Ales Justin * @author Adrian Brock * @version $Revision: 68544 $ */ public class JavaBeanTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("JavaBean Tests"); suite.addTest(InstantiateTestCase.suite()); suite.addTest(PropertyTestCase.suite()); suite.addTest(AmbiguityTestCase.suite()); // jaxb tests suite.addTest(SimpleInstantiateUnitTestCase.suite()); suite.addTest(StaticMethodInstantiateUnitTestCase.suite()); suite.addTest(StaticClassMethodInstantiateUnitTestCase.suite()); suite.addTest(ParameterInstantiateUnitTestCase.suite()); suite.addTest(PropertyUnitTestCase.suite()); suite.addTest(PropertyWildcardUnitTestCase.suite()); return suite; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/PropertyWildcardUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/PropertyWildcardU0000644000175000017500000000336310763015442033313 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.test; import junit.framework.Test; import org.jboss.test.javabean.support.TestPropertyWildcard; import org.jboss.test.javabean.support.TestWildcard; /** * PropertyWildcardUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class PropertyWildcardUnitTestCase extends AbstractJavaBeanTest { public static Test suite() { return suite(PropertyWildcardUnitTestCase.class); } public PropertyWildcardUnitTestCase(String name) { super(name); } public void testProperty() throws Exception { TestPropertyWildcard bean = unmarshalJavaBean(TestPropertyWildcard.class); TestWildcard wildcard = bean.getBean(); assertNotNull(wildcard); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/PropertyTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/PropertyTestCase.0000644000175000017500000001743010763033236033227 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.test; import java.beans.BeanInfo; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.math.BigDecimal; import java.math.BigInteger; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import junit.framework.Test; import org.jboss.test.javabean.support.SimpleBean; import org.jboss.util.NestedRuntimeException; /** * PropertyTestCase. * * @author Adrian Brock * @version $Revision: 68544 $ */ public class PropertyTestCase extends AbstractJavaBeanTest { // private static DateFormat dateFormat = new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy"); // EEE names - Locale configured private static DateFormat dateFormat = new SimpleDateFormat("MMM d HH:mm:ss z yyyy"); String stringValue = "StringValue"; Byte byteValue = new Byte("12"); Boolean booleanValue = Boolean.TRUE; // TODO character // Character characterValue = new Character('a'); Short shortValue = new Short("123"); Integer integerValue = new Integer("1234"); Long longValue = new Long("12345"); Float floatValue = new Float("3.14"); Double doubleValue = new Double("3.14e12"); // Date dateValue = createDate("Mon Jan 01 00:00:00 CET 2001"); Date dateValue = createDate("Jan 01 00:00:00 CET 2001"); BigDecimal bigDecimalValue = new BigDecimal("12e4"); BigInteger bigIntegerValue = new BigInteger("123456"); public void testConfigure() throws Exception { // check bean SimpleBean bean = unmarshal("TestConfigure.xml", SimpleBean.class); validateFields("()", null, bean); } public void testConfigure20() throws Exception { // check bean SimpleBean bean = unmarshal("TestConfigure20.xml", SimpleBean.class); validateFields("()", null, bean); } public void testConfigure20WithCtor() throws Exception { // check bean SimpleBean bean = unmarshal("TestConfigure20WithCtor.xml", SimpleBean.class); validateFields("()", null, bean); } public void testConfigure20WithCtorFactory() throws Exception { // check bean SimpleBean bean = unmarshal("TestConfigure20WithCtorFactory.xml", SimpleBean.class); validateFields("()", "getInstance()", bean); } public void testConfigure20WithCtorExplicitFactoryClass() throws Exception { // check bean SimpleBean bean = unmarshal("TestConfigure20WithCtorExplicitFactoryClass.xml", SimpleBean.class); validateFields("()", "SimpleBeanFactory.newInstance()", bean); } public void testConfigure20WithCtorExplicitFactoryClassAndParams() throws Exception { // check bean SimpleBean bean = unmarshal("TestConfigure20WithCtorExplicitFactoryClassAndParams.xml", SimpleBean.class); validateFields("()", "SimpleBeanFactory.newInstance()", bean); } public void testConstructor() throws Exception { // check bean SimpleBean bean = unmarshal("TestConstructor.xml", SimpleBean.class); validateFields("()", null, bean); } public void testConstructorFactory() throws Exception { // check bean SimpleBean bean = unmarshal("TestConstructorFactory.xml", SimpleBean.class); validateFields("()", "getInstance()", bean); } public void testConstructorExplicitFactoryClassAndParams() throws Exception { // check bean SimpleBean bean = unmarshal("TestConstructorExplicitFactoryClassAndParams.xml", SimpleBean.class); validateFields("()", "SimpleBeanFactory.newInstance()", bean); } /** * Validate the JavaBean property name introspection * @throws Exception */ public void testJavaBeanMatching() throws Exception { BeanInfo info = Introspector.getBeanInfo(SimpleBean.class); PropertyDescriptor[] props = info.getPropertyDescriptors(); HashMap propMap = new HashMap(); for(PropertyDescriptor pd : props) { propMap.put(pd.getName(), pd); } assertNotNull("Has XYZ", propMap.get("XYZ")); assertNull("Does not have xYZ", propMap.get("xYZ")); } @Override protected Object unmarshal(String name) throws Exception { // tmp format System.setProperty("org.jboss.util.propertyeditor.DateEditor.format", "MMM d HH:mm:ss z yyyy"); // TODO Auto-generated method stub return super.unmarshal(name); } protected void validateFields(String ctor, String factory, SimpleBean bean) { // check bean assertEquals(ctor, bean.getConstructorUsed()); if( factory == null ) assertTrue("factory == null", bean.getFactoryUsed() == null); else assertEquals(factory, bean.getFactoryUsed()); assertEquals(stringValue, bean.getAString()); assertEquals(byteValue, bean.getAByte()); assertEquals(booleanValue, bean.getABoolean()); // TODO character // assertEquals(characterValue, bean.getACharacter()); assertEquals(shortValue, bean.getAShort()); assertEquals(integerValue, bean.getAnInt()); assertEquals(longValue, bean.getALong()); assertEquals(floatValue, bean.getAFloat()); assertEquals(doubleValue, bean.getADouble()); assertEquals(dateValue, bean.getADate()); assertEquals(bigDecimalValue, bean.getABigDecimal()); assertEquals(bigIntegerValue, bean.getABigInteger()); assertEquals(byteValue.byteValue(), bean.getAbyte()); assertEquals(booleanValue.booleanValue(), bean.isAboolean()); // TODO character // assertEquals(characterValue.charValue(), bean.getAchar()); assertEquals(shortValue.shortValue(), bean.getAshort()); assertEquals(integerValue.intValue(), bean.getAnint()); assertEquals(longValue.longValue(), bean.getAlong()); assertEquals(floatValue.floatValue(), bean.getAfloat()); assertEquals(doubleValue.doubleValue(), bean.getAdouble()); Number number = bean.getANumber(); assertEquals(Long.class, number.getClass()); assertEquals(longValue, number); assertEquals(stringValue, bean.getOverloadedProperty()); // An all uppercase property assertEquals("XYZ", bean.getXYZ()); assertEquals("abc", bean.getAbc()); } protected Date createDate(String date) { try { return dateFormat.parse(date); } catch (Exception e) { throw new NestedRuntimeException(e); } } /** * Setup the test * * @return the test */ public static Test suite() { return suite(PropertyTestCase.class); } /** * Create a new InstantiateTestCase. * * @param name the test name */ public PropertyTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/SimpleInstantiateUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/SimpleInstantiate0000644000175000017500000000314610763015442033324 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.test; import junit.framework.Test; import org.jboss.test.javabean.support.TestSimpleInstantiate; /** * SimpleInstantiateUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class SimpleInstantiateUnitTestCase extends AbstractJavaBeanTest { public static Test suite() { return suite(SimpleInstantiateUnitTestCase.class); } public SimpleInstantiateUnitTestCase(String name) { super(name); } public void testSimpleInstantiate() throws Exception { unmarshalJavaBean20(TestSimpleInstantiate.class); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/InstantiateTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/InstantiateTestCa0000644000175000017500000000342610763015442033257 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.test; import junit.framework.Test; import org.jboss.test.javabean.support.SimpleBean; /** * InstantiateTestCase. * * @author Adrian Brock * @version $Revision: 68544 $ */ public class InstantiateTestCase extends AbstractJavaBeanTest { public void testInstantiate() throws Exception { SimpleBean bean = unmarshal("TestInstantiate.xml", SimpleBean.class); assertEquals("()", bean.getConstructorUsed()); } /** * Setup the test * * @return the test */ public static Test suite() { return suite(InstantiateTestCase.class); } /** * Create a new InstantiateTestCase. * * @param name the test name */ public InstantiateTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/ParameterInstantiateUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/ParameterInstanti0000644000175000017500000000332310763015442033316 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.test; import junit.framework.Test; import org.jboss.test.javabean.support.TestParameterInstantiate; /** * ParameterInstantiateUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ParameterInstantiateUnitTestCase extends AbstractJavaBeanTest { public static Test suite() { return suite(ParameterInstantiateUnitTestCase.class); } public ParameterInstantiateUnitTestCase(String name) { super(name); } public void testParameterInstantiate() throws Exception { TestParameterInstantiate result = unmarshalJavaBean20(TestParameterInstantiate.class); assertEquals("Hello5", result.constructorUsed); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/PropertyUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/PropertyUnitTestC0000644000175000017500000001016010763015442033310 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.test; import java.math.BigDecimal; import java.math.BigInteger; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import junit.framework.Test; import org.jboss.test.javabean.support.TestProperty; /** * PropertyInstantiateUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class PropertyUnitTestCase extends AbstractJavaBeanTest { private static DateFormat dateFormat = new SimpleDateFormat("MMM d HH:mm:ss z yyyy"); String stringValue = "StringValue"; Byte byteValue = new Byte("12"); Boolean booleanValue = Boolean.TRUE; // TODO character // Character characterValue = new Character('a'); Short shortValue = new Short("123"); Integer integerValue = new Integer("1234"); Long longValue = new Long("12345"); Float floatValue = new Float("3.14"); Double doubleValue = new Double("3.14e12"); // Date dateValue = createDate("Mon Jan 01 00:00:00 CET 2001"); // Date dateValue = createDate("Jan 01 00:00:00 CET 2001"); BigDecimal bigDecimalValue = new BigDecimal("12e4"); BigInteger bigIntegerValue = new BigInteger("123456"); public static Test suite() { return suite(PropertyUnitTestCase.class); } public PropertyUnitTestCase(String name) { super(name); } public void testProperty() throws Exception { TestProperty bean = unmarshalJavaBean(TestProperty.class); assertEquals(stringValue, bean.getAString()); assertEquals(byteValue, bean.getAByte()); assertEquals(booleanValue, bean.getABoolean()); // TODO character // assertEquals(characterValue, bean.getACharacter()); assertEquals(shortValue, bean.getAShort()); assertEquals(integerValue, bean.getAnInt()); assertEquals(longValue, bean.getALong()); assertEquals(floatValue, bean.getAFloat()); assertEquals(doubleValue, bean.getADouble()); // TODO assertEquals(dateValue, bean.getADate()); assertEquals(bigDecimalValue, bean.getABigDecimal()); assertEquals(bigIntegerValue, bean.getABigInteger()); assertEquals(byteValue.byteValue(), bean.getAbyte()); assertEquals(booleanValue.booleanValue(), bean.isAboolean()); // TODO character // assertEquals(characterValue.charValue(), bean.getAchar()); assertEquals(shortValue.shortValue(), bean.getAshort()); assertEquals(integerValue.intValue(), bean.getAnint()); assertEquals(longValue.longValue(), bean.getAlong()); assertEquals(floatValue.floatValue(), bean.getAfloat()); assertEquals(doubleValue.doubleValue(), bean.getAdouble()); Number number = bean.getANumber(); assertEquals(Long.class, number.getClass()); assertEquals(longValue, number); assertEquals(stringValue, bean.getOverloadedProperty()); // An all uppercase property assertEquals("XYZ", bean.getXYZ()); assertEquals("abc", bean.getAbc()); } protected Date createDate(String date) { try { return dateFormat.parse(date); } catch (Exception e) { throw new RuntimeException(e); } } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/AbstractJavaBeanTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/AbstractJavaBeanT0000644000175000017500000000372210763015442033146 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.test; import org.jboss.javabean.plugins.jaxb.JavaBean10; import org.jboss.javabean.plugins.jaxb.JavaBean20; import org.jboss.test.xb.builder.AbstractBuilderTest; /** * AbstractJavaBeanTest. * * @author Ales Justin * @author Adrian Brock * @version $Revision$ */ public class AbstractJavaBeanTest extends AbstractBuilderTest { public AbstractJavaBeanTest(String name) { super(name); } protected T unmarshalJavaBean(Class expected, Class... others) throws Exception { return unmarshalJavaBean10(expected, others); } protected T unmarshalJavaBean10(Class expected, Class... others) throws Exception { return unmarshalObject(expected, JavaBean10.class, others); } protected T unmarshalJavaBean20(Class expected, Class... others) throws Exception { return unmarshalObject(expected, JavaBean20.class, others); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/AmbiguityTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/test/AmbiguityTestCase0000644000175000017500000000520410763033236033253 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.test; import junit.framework.Test; import org.jboss.test.javabean.support.AmbiguityBean; /** * PropertyTestCase. * * @author Adrian Brock * @version $Revision: 58996 $ */ public class AmbiguityTestCase extends AbstractJavaBeanTest { /** * Create a new AmbiguityTestCase. * * @param name the test name */ public AmbiguityTestCase(String name) { super(name); } /** * Setup the test * * @return the test */ public static Test suite() { return suite(AmbiguityTestCase.class); } public void testConfigureInt() throws Exception { AmbiguityBean ab = unmarshal("TestAmbiguityInt.xml", AmbiguityBean.class); Object something = ab.something(); assertEquals(something.getClass(), Integer.class); } public void testConfigureString() throws Exception { AmbiguityBean ab = unmarshal("TestAmbiguityString.xml", AmbiguityBean.class); Object something = ab.something(); assertEquals(something.getClass(), String.class); } public void testConstructorInt() throws Exception { AmbiguityBean ab = unmarshal("TestConstructorAmbiguityInt.xml", AmbiguityBean.class); Object something = ab.something(); assertEquals(something.getClass(), Integer.class); } public void testConstrutorString() throws Exception { AmbiguityBean ab = unmarshal("TestConstructorAmbiguityString.xml", AmbiguityBean.class); Object something = ab.something(); assertEquals(something.getClass(), String.class); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/0000755000175000017500000000000011620316743030476 5ustar twernertwerner././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestProperty.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestProperty.j0000644000175000017500000001402710763015442033340 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.support; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Date; /** * TestStaticMethodInstantiate. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestProperty { /** Object */ private Object anObject; /** A string */ private String aString; /** Byte */ private Byte aByte; /** Boolean */ private Boolean aBoolean; /** Character */ private Character aCharacter; /** Short */ private Short aShort; /** Int */ private Integer anInt; /** Long */ private Long aLong; /** Float */ private Float aFloat; /** Double */ private Double aDouble; /** Date */ private Date aDate; /** BigDecimal */ private BigDecimal aBigDecimal; /** BigDecimal */ private BigInteger aBigInteger; /** byte */ private byte abyte; /** boolean */ private boolean aboolean; /** char */ private char achar; /** short */ private short ashort; /** int */ private int anint; /** long */ private long along; /** float */ private float afloat; /** double */ private double adouble; /** number */ private Number aNumber; /** Overloaded property */ private String overloadedProperty; private String xyz; private String abc; public Object getAnObject() { return anObject; } public void setAnObject(Object object) { anObject = object; } public BigDecimal getABigDecimal() { return aBigDecimal; } public void setABigDecimal(BigDecimal bigDecimal) { aBigDecimal = bigDecimal; } public BigInteger getABigInteger() { return aBigInteger; } public void setABigInteger(BigInteger bigInteger) { aBigInteger = bigInteger; } public boolean isAboolean() { return aboolean; } public void setAboolean(boolean aboolean) { this.aboolean = aboolean; } public Boolean getABoolean() { return aBoolean; } public void setABoolean(Boolean boolean1) { aBoolean = boolean1; } public Number getANumber() { return aNumber; } public void setANumber(Number number) { aNumber = number; } public byte getAbyte() { return abyte; } public void setAbyte(byte abyte) { this.abyte = abyte; } public Byte getAByte() { return aByte; } public void setAByte(Byte byte1) { aByte = byte1; } public char getAchar() { return achar; } public void setAchar(char achar) { this.achar = achar; } public Character getACharacter() { return aCharacter; } public void setACharacter(Character character) { aCharacter = character; } public Date getADate() { return aDate; } public void setADate(Date date) { aDate = date; } public double getAdouble() { return adouble; } public void setAdouble(double adouble) { this.adouble = adouble; } public Double getADouble() { return aDouble; } public void setADouble(Double double1) { aDouble = double1; } public float getAfloat() { return afloat; } public void setAfloat(float afloat) { this.afloat = afloat; } public Float getAFloat() { return aFloat; } public void setAFloat(Float float1) { aFloat = float1; } public long getAlong() { return along; } public void setAlong(long along) { this.along = along; } public Long getALong() { return aLong; } public void setALong(Long long1) { aLong = long1; } public int getAnint() { return anint; } public void setAnint(int anint) { this.anint = anint; } public Integer getAnInt() { return anInt; } public void setAnInt(Integer anInt) { this.anInt = anInt; } public short getAshort() { return ashort; } public void setAshort(short ashort) { this.ashort = ashort; } public Short getAShort() { return aShort; } public void setAShort(Short short1) { aShort = short1; } public String getAString() { return aString; } public void setAString(String string) { aString = string; } public String getOverloadedProperty() { return overloadedProperty; } public void setOverloadedProperty(Long broken) { throw new RuntimeException("Invoked the wrong setter"); } public void setOverloadedProperty(String overloadedProperty) { this.overloadedProperty = overloadedProperty; } public void setOverloadedProperty(Integer broken) { throw new RuntimeException("Invoked the wrong setter"); } public String getXYZ() { return xyz; } public void setXYZ(String xyz) { this.xyz = xyz; } public String getAbc() { return abc; } public void setAbc(String abc) { this.abc = abc; } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestStaticClassMethodInstantiator.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestStaticClas0000644000175000017500000000250410763015442033313 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.support; /** * TestStaticClassMethodInstantiator. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestStaticClassMethodInstantiator { public static TestStaticClassMethodInstantiate instantiate() { return new TestStaticClassMethodInstantiate(); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestWildcard.j0000644000175000017500000000225010763015442033240 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.support; /** * * TestPropertyWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestWildcard { } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestParameterInstantiate.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestParameterI0000644000175000017500000000251110763015442033310 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.support; /** * TestSimpleInstantiate. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestParameterInstantiate { public String constructorUsed; public TestParameterInstantiate(String string, int integer) { constructorUsed = string + integer; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestSimpleInstantiate.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestSimpleInst0000644000175000017500000000225610763015442033354 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.support; /** * TestSimpleInstantiate. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestSimpleInstantiate { } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestStaticClassMethodInstantiate.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestStaticClas0000644000175000017500000000236310763015442033316 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.support; /** * TestStaticClassMethodInstantiate. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestStaticClassMethodInstantiate { TestStaticClassMethodInstantiate() { } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/AmbiguityBean.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/AmbiguityBean.0000644000175000017500000000404510763033236033222 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.support; /** * SimpleBean. * * @author Ales Justin */ public class AmbiguityBean { private Integer someint; private String somestring; public AmbiguityBean() { } public AmbiguityBean(String someString) { this.somestring = someString; } public AmbiguityBean(int someint) { this.someint = someint; } public void setSomething(Integer integer) { someint = integer; } public void setSomething(String string) { somestring = string; } public Object something() { if (someint != null && somestring != null) throw new IllegalArgumentException("Only one 'something' can be set!"); if (someint != null) return someint; if (somestring != null) return somestring; throw new IllegalArgumentException("Must set 'something'!"); } public String toString() { return someint + "," + somestring; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/SimpleBean.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/SimpleBean.jav0000644000175000017500000002106010763015442033215 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.support; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Date; /** * SimpleBean. * * @author Adrian Brock * @version $Revision: 60371 $ */ public class SimpleBean { /** Constructor used */ private String constructorUsed; private String factoryUsed; /** Object */ private Object anObject; /** A string */ private String aString; /** Byte */ private Byte aByte; /** Boolean */ private Boolean aBoolean; /** Character */ private Character aCharacter; /** Short */ private Short aShort; /** Int */ private Integer anInt; /** Long */ private Long aLong; /** Float */ private Float aFloat; /** Double */ private Double aDouble; /** Date */ private Date aDate; /** BigDecimal */ private BigDecimal aBigDecimal; /** BigDecimal */ private BigInteger aBigInteger; /** byte */ private byte abyte; /** boolean */ private boolean aboolean; /** char */ private char achar; /** short */ private short ashort; /** int */ private int anint; /** long */ private long along; /** float */ private float afloat; /** double */ private double adouble; /** number */ private Number aNumber; /** Overloaded property */ private String overloadedProperty; private String xyz; private String abc; public SimpleBean() { constructorUsed = "()"; } public SimpleBean(String aString) { constructorUsed = "(String)"; this.aString = aString; } public static SimpleBean getInstance(Object anObject, String string, Byte byte1, Boolean boolean1, Character character, Short short1, Integer anInt, Long long1, Float float1, Double double1, Date date, BigDecimal bigDecimal, BigInteger bigInteger, byte abyte, boolean aboolean, char achar, short ashort, int anint2, long along, float afloat, double adouble, Number number, String overloadedProperty, String xyz, String abc) { SimpleBean bean = new SimpleBean(anObject, string, byte1, boolean1, character, short1, anInt, long1, float1, double1, date, bigDecimal, bigInteger, abyte, aboolean, achar, ashort, anint2, along, afloat, adouble, number, overloadedProperty, xyz, abc); bean.factoryUsed = "getInstance()"; return bean; } public SimpleBean(Object anObject, String string, Byte byte1, Boolean boolean1, Character character, Short short1, Integer anInt, Long long1, Float float1, Double double1, Date date, BigDecimal bigDecimal, BigInteger bigInteger, byte abyte, boolean aboolean, char achar, short ashort, int anint2, long along, float afloat, double adouble, Number number, String overloadedProperty, String xyz, String abc) { constructorUsed = "()"; this.anObject = anObject; aString = string; aByte = byte1; aBoolean = boolean1; aCharacter = character; aShort = short1; this.anInt = anInt; aLong = long1; aFloat = float1; aDouble = double1; aDate = date; aBigDecimal = bigDecimal; aBigInteger = bigInteger; this.abyte = abyte; this.aboolean = aboolean; this.achar = achar; this.ashort = ashort; anint = anint2; this.along = along; this.afloat = afloat; this.adouble = adouble; aNumber = number; this.overloadedProperty = overloadedProperty; this.xyz = xyz; this.abc = abc; } public String getConstructorUsed() { return constructorUsed; } public String getFactoryUsed() { return factoryUsed; } public void setFactoryUsed(String factoryUsed) { this.factoryUsed = factoryUsed; } public Object getAnObject() { return anObject; } public void setAnObject(Object object) { anObject = object; } public BigDecimal getABigDecimal() { return aBigDecimal; } public void setABigDecimal(BigDecimal bigDecimal) { aBigDecimal = bigDecimal; } public BigInteger getABigInteger() { return aBigInteger; } public void setABigInteger(BigInteger bigInteger) { aBigInteger = bigInteger; } public boolean isAboolean() { return aboolean; } public void setAboolean(boolean aboolean) { this.aboolean = aboolean; } public Boolean getABoolean() { return aBoolean; } public void setABoolean(Boolean boolean1) { aBoolean = boolean1; } public Number getANumber() { return aNumber; } public void setANumber(Number number) { aNumber = number; } public byte getAbyte() { return abyte; } public void setAbyte(byte abyte) { this.abyte = abyte; } public Byte getAByte() { return aByte; } public void setAByte(Byte byte1) { aByte = byte1; } public char getAchar() { return achar; } public void setAchar(char achar) { this.achar = achar; } public Character getACharacter() { return aCharacter; } public void setACharacter(Character character) { aCharacter = character; } public Date getADate() { return aDate; } public void setADate(Date date) { aDate = date; } public double getAdouble() { return adouble; } public void setAdouble(double adouble) { this.adouble = adouble; } public Double getADouble() { return aDouble; } public void setADouble(Double double1) { aDouble = double1; } public float getAfloat() { return afloat; } public void setAfloat(float afloat) { this.afloat = afloat; } public Float getAFloat() { return aFloat; } public void setAFloat(Float float1) { aFloat = float1; } public long getAlong() { return along; } public void setAlong(long along) { this.along = along; } public Long getALong() { return aLong; } public void setALong(Long long1) { aLong = long1; } public int getAnint() { return anint; } public void setAnint(int anint) { this.anint = anint; } public Integer getAnInt() { return anInt; } public void setAnInt(Integer anInt) { this.anInt = anInt; } public short getAshort() { return ashort; } public void setAshort(short ashort) { this.ashort = ashort; } public Short getAShort() { return aShort; } public void setAShort(Short short1) { aShort = short1; } public String getAString() { return aString; } public void setAString(String string) { aString = string; } public String getOverloadedProperty() { return overloadedProperty; } public void setOverloadedProperty(Long broken) { throw new RuntimeException("Invoked the wrong setter"); } public void setOverloadedProperty(String overloadedProperty) { this.overloadedProperty = overloadedProperty; } public void setOverloadedProperty(Integer broken) { throw new RuntimeException("Invoked the wrong setter"); } public String getXYZ() { return xyz; } public void setXYZ(String xyz) { this.xyz = xyz; } public String getAbc() { return abc; } public void setAbc(String abc) { this.abc = abc; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/SimpleBeanFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/SimpleBeanFact0000644000175000017500000000447610763015442033250 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, Red Hat Middleware LLC, and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.support; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Date; /** * Factory for javabean tests. * * @author Scott.Stark@jboss.org * @version $Revision:$ */ public class SimpleBeanFactory { public static SimpleBean newInstance() { SimpleBean bean = new SimpleBean(); bean.setFactoryUsed("SimpleBeanFactory.newInstance()"); return bean; } public static SimpleBean newInstance(Object anObject, String string, Byte byte1, Boolean boolean1, Character character, Short short1, Integer anInt, Long long1, Float float1, Double double1, Date date, BigDecimal bigDecimal, BigInteger bigInteger, byte abyte, boolean aboolean, char achar, short ashort, int anint2, long along, float afloat, double adouble, Number number, String overloadedProperty, String xyz, String abc) { SimpleBean bean = new SimpleBean(anObject, string, byte1, boolean1, character, short1, anInt, long1, float1, double1, date, bigDecimal, bigInteger, abyte, aboolean, achar, ashort, anint2, along, afloat, adouble, number, overloadedProperty, xyz, abc); bean.setFactoryUsed("SimpleBeanFactory.newInstance()"); return bean; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestPropertyWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestPropertyWi0000644000175000017500000000253110763015442033405 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.support; /** * * TestPropertyWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestPropertyWildcard { private TestWildcard bean; public TestWildcard getBean() { return bean; } public void setBean(TestWildcard bean) { this.bean = bean; } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestStaticMethodInstantiate.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/javabean/support/TestStaticMeth0000644000175000017500000000254510763015442033333 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.javabean.support; /** * TestStaticMethodInstantiate. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestStaticMethodInstantiate { public static TestStaticMethodInstantiate instantiate() { return new TestStaticMethodInstantiate(); } private TestStaticMethodInstantiate() { } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/0000755000175000017500000000000011620316744025625 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/0000755000175000017500000000000011620316756027256 5ustar twernertwerner././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/AbstractSystemPropertyInitializationTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/AbstractSystemProper0000644000175000017500000000536511171577572033360 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder; import java.lang.reflect.Method; import java.net.URLClassLoader; import org.jboss.xb.builder.JBossXBBuilder; import junit.framework.TestCase; public abstract class AbstractSystemPropertyInitializationTest extends TestCase { private String defaultSystemValue; private ClassLoader cl; public AbstractSystemPropertyInitializationTest() { super(); } public AbstractSystemPropertyInitializationTest(String name) { super(name); } protected abstract String getPropertyName(); protected abstract String getPropertyGetter(); protected void setUp() throws Exception { super.setUp(); defaultSystemValue = System.getProperty(getPropertyName()); ClassLoader builderCl = JBossXBBuilder.class.getClassLoader(); if(builderCl == null) builderCl = ClassLoader.getSystemClassLoader(); assertTrue(builderCl instanceof URLClassLoader); cl = new URLClassLoader(((URLClassLoader)builderCl).getURLs(), null); } protected void tearDown() throws Exception { super.tearDown(); if(defaultSystemValue != null) System.setProperty(getPropertyName(), defaultSystemValue); } public void testFalse() throws Exception { initAndAssert(false); } public void testTrue() throws Exception { initAndAssert(true); } private void initAndAssert(Boolean value) throws Exception { System.setProperty(getPropertyName(), Boolean.toString(value)); Class clazz = cl.loadClass(JBossXBBuilder.class.getName()); Method m = clazz.getMethod(getPropertyGetter()); assertEquals(value, m.invoke(null)); } }././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/TestSchemaResolver.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/TestSchemaResolver.j0000644000175000017500000000515010625561630033211 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder; import java.util.HashMap; import org.jboss.logging.Logger; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.w3c.dom.ls.LSInput; /** * TestSchemaResolver. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestSchemaResolver implements SchemaBindingResolver { private static final Logger log = Logger.getLogger(TestSchemaResolver.class); private HashMap bindings = new HashMap(); public String getBaseURI() { return null; } public void addSchemaBinding(SchemaBinding schemaBinding) { schemaBinding.setSchemaResolver(this); String nsURI = (String) schemaBinding.getNamespaces().iterator().next(); bindings.put(nsURI, schemaBinding); if (log.isTraceEnabled()) { String schema = SchemaPrinter.printSchema(schemaBinding); log.trace("Bound: " + nsURI + "\n" + schema); } } public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation) { SchemaBinding result = bindings.get(nsUri); if (result == null) throw new RuntimeException("Schema not bound: " + nsUri + " available: " + bindings.keySet()); return result; } public LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation) { throw new UnsupportedOperationException(); } public void setBaseURI(String baseURI) { throw new org.jboss.util.NotImplementedException("setBaseURI"); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/AbstractBuilderTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/AbstractBuilderTest.0000755000175000017500000002436511350171524033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder; import java.net.URL; import java.util.Collection; import org.jboss.test.AbstractTestCaseWithSetup; import org.jboss.test.AbstractTestDelegate; import org.jboss.util.UnreachableStatementException; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.DefaultHandlers; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.BuilderParticleHandler; import org.jboss.test.xml.JBossXBTestDelegate; /** * AbstractBuilderTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class AbstractBuilderTest extends AbstractTestCaseWithSetup { private static final ParticleHandler XB_DEFAULT_ELEMENT_HANDLER = DefaultHandlers.ELEMENT_HANDLER; private static final ParticleHandler XB_DEFAULT_MODELGROUP_HANDLER = DefaultHandlers.MODEL_GROUP_HANDLER; protected String rootName = getRootName(); public AbstractBuilderTest(String name) { super(name); } /** * Setup the test delegate * * @param clazz the class * @return the delegate * @throws Exception for any error */ public static AbstractTestDelegate getDelegate(Class clazz) throws Exception { return new JBossXBTestDelegate(clazz); } protected JBossXBTestDelegate getJBossXBDelegate() { return (JBossXBTestDelegate) getDelegate(); } @Override protected void setUp() throws Exception { super.setUp(); configureLogging(); DefaultHandlers.ELEMENT_HANDLER = new DebugElementHandler(); DefaultHandlers.SIMPLE_HANDLER = DefaultHandlers.ELEMENT_HANDLER; DefaultHandlers.MODEL_GROUP_HANDLER = BuilderParticleHandler.INSTANCE; } @Override protected void tearDown() throws Exception { super.tearDown(); DefaultHandlers.ELEMENT_HANDLER = XB_DEFAULT_ELEMENT_HANDLER; DefaultHandlers.SIMPLE_HANDLER = DefaultHandlers.ELEMENT_HANDLER; DefaultHandlers.MODEL_GROUP_HANDLER = XB_DEFAULT_MODELGROUP_HANDLER; } protected T unmarshalObjectFromSchema(Class expected) throws Exception { MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); // TODO this is a mess String nsURI = "http://www.jboss.org/test/xml/" + rootName; String packageName = getClass().getPackage().getName(); packageName = packageName.replace(".", "/"); String name = getClass().getName(); int dot = name.lastIndexOf('.'); if (dot != -1) name = name.substring(dot + 1); dot = name.lastIndexOf("UnitTestCase"); if (dot != -1) name = name.substring(0, dot); String testXsd = packageName + '/' + name + ".xsd"; resolver.mapSchemaLocation(nsURI, testXsd); resolver.mapSchemaInitializer(nsURI, JBossXBBuilder.newInitializer(expected)); String testXml = findTestXml(); Object o = unmarshal(testXml, expected, resolver); assertNotNull(o); getLog().debug("Unmarshalled " + o + " of type " + o.getClass().getName()); return expected.cast(o); } protected T unmarshalObject(Class expected, Class reference, Class... others) throws Exception { TestSchemaResolver resolver = new TestSchemaResolver(); SchemaBinding schemaBinding = JBossXBBuilder.build(reference, true); resolver.addSchemaBinding(schemaBinding); if (others != null) { for (Class other : others) { SchemaBinding otherBinding = JBossXBBuilder.build(other, true); resolver.addSchemaBinding(otherBinding); } } String testXml = findTestXml(); Object o = unmarshal(testXml, schemaBinding); assertNotNull(o); getLog().debug("Unmarshalled " + o + " of type " + o.getClass().getName()); try { return expected.cast(o); } catch (ClassCastException e) { fail("Expected " + expected.getName() + " got " + o.getClass().getName()); throw new UnreachableStatementException(); } } /** * Unmarshal some xml * * @param name the name * @param schema the schema * @return the unmarshalled object * @throws Exception for any error */ protected Object unmarshal(String name, SchemaBinding schema) throws Exception { String url = findXML(name); return getJBossXBDelegate().unmarshal(url, schema); } protected T unmarshalObject(Class expected, Class reference) throws Exception { return unmarshalObject(expected, reference, null); } protected T unmarshalObject(Class expected) throws Exception { return unmarshalObject(expected, expected, null); } /** * Unmarshal some xml * * @param name the name * @param expected the expected type * @param resolver the resolver * @return the unmarshalled object * @throws Exception for any error */ protected Object unmarshal(String name, Class expected, SchemaBindingResolver resolver) throws Exception { Object object = unmarshal(name, resolver); if (object == null) fail("No object from " + name); assertTrue("Object '" + object + "' cannot be assigned to " + expected.getName(), expected.isAssignableFrom(object.getClass())); return object; } /** * Unmarshal some xml * * @param name the name * @param resolver the resolver * @return the unmarshalled object * @throws Exception for any error */ protected Object unmarshal(String name, SchemaBindingResolver resolver) throws Exception { String url = findXML(name); return getJBossXBDelegate().unmarshal(url, resolver); } protected String findTestXml() { String result = rootName + "_" + getName() + ".xml"; if (getResource(result) == null) result = rootName + ".xml"; return result; } /** * Unmarshal some xml * * @param the expected type * @param name the name * @param expected the expected type * @return the unmarshalled object * @throws Exception for any error */ protected T unmarshal(String name, Class expected) throws Exception { Object object = unmarshal(name); if (object == null) fail("No object from " + name); assertTrue("Object '" + object + "' cannot be assigned to " + expected.getName(), expected.isAssignableFrom(object.getClass())); return expected.cast(object); } /** * Unmarshal some xml * * @param name the name * @return the unmarshalled object * @throws Exception for any error */ protected Object unmarshal(String name) throws Exception { String url = findXML(name); return getJBossXBDelegate().unmarshal(url); } /** * Get the package root name * * @return the root name */ protected String getRootName() { String longName = getClass().getName(); int dot = longName.lastIndexOf('.'); if (dot != -1) longName = longName.substring(dot + 1); dot = longName.lastIndexOf("UnitTestCase"); if (dot != -1) longName = longName.substring(0, dot); return longName; } @SuppressWarnings("unchecked") protected TermBinding assertSingleSequence(TermBinding term) { assertNotNull(term); assertTrue(term instanceof SequenceBinding || term instanceof UnorderedSequenceBinding); ModelGroupBinding sequence = (ModelGroupBinding) term; Collection particles = sequence.getParticles(); assertTrue(particles.size() == 1); ParticleBinding particle = particles.iterator().next(); assertFalse(particle.getMaxOccursUnbounded()); term = particle.getTerm(); assertNotNull(term); return term; } protected TermBinding assertSingleRepeatableSequence(TermBinding term) { assertNotNull(term); assertTrue(term instanceof SequenceBinding || term instanceof UnorderedSequenceBinding); ModelGroupBinding sequence = (ModelGroupBinding) term; Collection particles = sequence.getParticles(); assertTrue(particles.size() == 1); ParticleBinding particle = particles.iterator().next(); assertTrue(particle.getMaxOccursUnbounded()); term = particle.getTerm(); assertNotNull(term); return term; } /** * Find the xml * * @param name the name * @return the url of the xml */ protected String findXML(String name) { URL url = getResource(name); if (url == null) fail(name + " not found"); return url.toString(); } @Override public void configureLogging() { //enableTrace("org.jboss.xb"); //enableTrace("org.jboss.test.xb"); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/schemarebuild/0000755000175000017500000000000011620316756032065 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/schemarebuild/test/0000755000175000017500000000000011620316756033044 5ustar twernertwerner././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/schemarebuild/test/SchemaRebuildUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/schemarebuild/test/S0000644000175000017500000000545611133073746033201 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.schemarebuild.test; import java.util.Set; import javax.xml.bind.annotation.XmlNs; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.xb.annotations.JBossXmlSchema; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A SchemaRebuildUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class SchemaRebuildUnitTestCase extends AbstractBuilderTest { public SchemaRebuildUnitTestCase(String name) { super(name); } public void testCache() throws Exception { SchemaBinding schema = JBossXBBuilder.build(MyClass.class, true); assertEquals("ns1", schema.getNamespace("p1")); assertEquals("ns2", schema.getNamespace("p2")); schema.addPrefixMapping("p2", "ns22"); schema = JBossXBBuilder.build(MyClass.class); assertEquals("ns1", schema.getNamespace("p1")); assertEquals("ns22", schema.getNamespace("p2")); } public void testRebuild() throws Exception { SchemaBinding schema = JBossXBBuilder.build(MyClass.class, true); assertEquals("ns1", schema.getNamespace("p1")); assertEquals("ns2", schema.getNamespace("p2")); schema.addPrefixMapping("p2", "ns22"); schema = JBossXBBuilder.build(MyClass.class, true); assertEquals("ns1", schema.getNamespace("p1")); assertEquals("ns2", schema.getNamespace("p2")); } @XmlRootElement() @JBossXmlSchema(xmlns={@XmlNs(namespaceURI = "ns1", prefix = "p1"), @XmlNs(namespaceURI = "ns2", prefix = "p2")}) public static final class MyClass { } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/repeatableterms/0000755000175000017500000000000011620316744032432 5ustar twernertwerner././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/repeatableterms/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/repeatableterms/test0000755000175000017500000000000011620316744033332 5ustar twernertwerner././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/repeatableterms/test/RepeatableTermsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/repeatableterms/test0000644000175000017500000001517111310425750033333 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.repeatableterms.test; import java.util.Collection; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.repeatableterms.support.Choice; import org.jboss.test.xb.builder.repeatableterms.support.Sequence; import org.jboss.test.xb.builder.repeatableterms.support.Top; import org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A RepeatableTermsUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RepeatableTermsUnitTestCase extends AbstractBuilderTest { public RepeatableTermsUnitTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { Top top = unmarshalObject(Top.class); String[] items = top.getItems(); assertNotNull(items); assertEquals(3, items.length); for(int i = 0; i < items.length; ++i) assertEquals("item" + (i + 1), items[i]); Sequence[] sequences = top.getSequences(); assertNotNull(sequences); String[] expected = new String[]{ "sequenceChoice1_1", "sequenceChoice2_1", "sequenceChoice1_2", "sequenceChoice1_3", "sequenceChoice2_2"}; assertEquals(expected.length, sequences.length); for(int i = 0; i < sequences.length; ++i) assertEquals(expected[i], sequences[i].getChoice()); Choice[] choices = top.getChoices(); assertNotNull(choices); assertEquals(3, choices.length); Choice choice = choices[0]; assertNotNull(choice); assertNull(choice.getChoiceChoice2()); String[] strings = choice.getChoiceChoice1(); assertNotNull(strings); assertEquals(2, strings.length); assertEquals("choiceChoice1_1", strings[0]); assertEquals("choiceChoice1_2", strings[1]); choice = choices[1]; assertNotNull(choice); assertNull(choice.getChoiceChoice1()); strings = choice.getChoiceChoice2(); assertNotNull(strings); assertEquals(2, strings.length); assertEquals("choiceChoice2_1", strings[0]); assertEquals("choiceChoice2_2", strings[1]); choice = choices[2]; assertNotNull(choice); assertNull(choice.getChoiceChoice2()); strings = choice.getChoiceChoice1(); assertNotNull(strings); assertEquals(2, strings.length); assertEquals("choiceChoice1_3", strings[0]); assertEquals("choiceChoice1_4", strings[1]); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(Top.class, true); ElementBinding top = schema.getElement(new QName("top")); assertNotNull(top); ModelGroupBinding topSequence = (ModelGroupBinding) top.getType().getParticle().getTerm(); Collection particles = topSequence.getParticles(); assertEquals(3, particles.size()); Iterator i = particles.iterator(); while(i.hasNext()) { ParticleBinding particle = i.next(); assertTrue(particle.getMaxOccursUnbounded()); TermBinding term = particle.getTerm(); if(term.isElement()) { assertEquals(new QName("item"), ((ElementBinding)term).getQName()); } else if(term instanceof ChoiceBinding) { ChoiceBinding choice = (ChoiceBinding) term; Collection choices = choice.getParticles(); assertEquals(2, choices.size()); Iterator ci = choices.iterator(); while(ci.hasNext()) { ParticleBinding cp = ci.next(); assertTrue(cp.getMaxOccursUnbounded()); TermBinding ct = cp.getTerm(); assertTrue(ct.isElement()); QName name = ((ElementBinding)ct).getQName(); assertTrue(name.equals(new QName("choiceChoice1")) || name.equals(new QName("choiceChoice2"))); } } else // sequence or unordered sequence { ModelGroupBinding seq = (ModelGroupBinding)term; Collection seqParticles = seq.getParticles(); assertEquals(1, seqParticles.size()); ParticleBinding choiceP = seqParticles.iterator().next(); assertFalse(choiceP.getMaxOccursUnbounded()); TermBinding choice = choiceP.getTerm(); assertTrue(choice instanceof ChoiceBinding); Collection choices = ((ChoiceBinding)choice).getParticles(); assertEquals(2, choices.size()); Iterator ci = choices.iterator(); while(ci.hasNext()) { ParticleBinding cp = ci.next(); assertFalse(cp.getMaxOccursUnbounded()); TermBinding ct = cp.getTerm(); assertTrue(ct.isElement()); QName name = ((ElementBinding)ct).getQName(); assertTrue(name.equals(new QName("sequenceChoice1")) || name.equals(new QName("sequenceChoice2"))); } } } } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/repeatableterms/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/repeatableterms/supp0000755000175000017500000000000011620316744033342 5ustar twernertwerner././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/repeatableterms/support/Choice.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/repeatableterms/supp0000644000175000017500000000373311303061254033341 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.repeatableterms.support; import javax.xml.bind.annotation.XmlElement; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; /** * A Choice. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlModelGroup(name="choiceChoice", kind=JBossXmlConstants.MODEL_GROUP_CHOICE) public class Choice { private String[] choiceChoice1; private String[] choiceChoice2; @XmlElement(name="choiceChoice1") public String[] getChoiceChoice1() { return choiceChoice1; } public void setChoiceChoice1(String[] choiceChoice1) { this.choiceChoice1 = choiceChoice1; } @XmlElement(name="choiceChoice2") public String[] getChoiceChoice2() { return choiceChoice2; } public void setChoiceChoice2(String[] choiceChoice2) { this.choiceChoice2 = choiceChoice2; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/repeatableterms/support/Top.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/repeatableterms/supp0000644000175000017500000000377511303061254033347 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.repeatableterms.support; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A Top. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement @XmlType(propOrder={"items", "sequences", "choices"}) public class Top { public String[] items; public Sequence[] sequences; public Choice[] choices; @XmlElement(name="item") public String[] getItems() { return items; } public void setItems(String[] items) { this.items = items; } public Sequence[] getSequences() { return sequences; } public void setSequences(Sequence[] sequences) { this.sequences = sequences; } public Choice[] getChoices() { return choices; } public void setChoices(Choice[] choices) { this.choices = choices; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/repeatableterms/support/Sequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/repeatableterms/supp0000644000175000017500000000342511303061254033337 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.repeatableterms.support; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; /** * A Sequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlModelGroup(name="sequenceChoice", kind=JBossXmlConstants.MODEL_GROUP_SEQUENCE) public class Sequence { private String choice; @XmlElements({ @XmlElement(name="sequenceChoice1"), @XmlElement(name="sequenceChoice2") }) public String getChoice() { return choice; } public void setChoice(String choice) { this.choice = choice; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/BuilderTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/BuilderTestSuite.jav0000755000175000017500000000310110562616254033216 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.ObjectTestSuite; /** * BuilderTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BuilderTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Builder Tests"); suite.addTest(ObjectTestSuite.suite()); return suite; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/0000755000175000017500000000000011620316756030524 5ustar twernertwerner././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/propertyrefs/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/propertyrefs/0000755000175000017500000000000011620316756033270 5ustar twernertwerner././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/propertyrefs/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/propertyrefs/0000755000175000017500000000000011620316756033270 5ustar twernertwerner././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/propertyrefs/test/PropertyReplacementUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/propertyrefs/0000644000175000017500000000411611134135334033263 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.propertyrefs.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.propertyrefs.support.Root; /** * A PropertyReplacementUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class PropertyReplacementUnitTestCase extends AbstractBuilderTest { public PropertyReplacementUnitTestCase(String name) { super(name); } public void testPropertyReplacement() throws Exception { String minName = getClass().getName() + "_" + getName() + ".min"; String maxName = getClass().getName() + "_" + getName() + ".max"; String valName = getClass().getName() + "_" + getName() + ".val"; System.setProperty(minName, "1"); System.setProperty(maxName, "3"); System.setProperty(valName, "2"); Root root = unmarshalObject(Root.class); assertEquals(1, root.getMin()); assertEquals(3, root.getMax()); assertEquals(2, root.getValue()); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/propertyrefs/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/propertyrefs/0000755000175000017500000000000011620316756033270 5ustar twernertwerner././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/propertyrefs/support/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/propertyrefs/0000644000175000017500000000376411134135334033273 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.propertyrefs.support; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlValue; import org.jboss.xb.annotations.JBossXmlSchema; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @JBossXmlSchema(normalizeSpace=true, replacePropertyRefs=true) public class Root { private int min; private int max; private int value; @XmlAttribute public int getMin() { return min; } public void setMin(int min) { this.min = min; } public int getMax() { return max; } public void setMax(int max) { this.max = max; } @XmlValue public int getValue() { return value; } public void setValue(int value) { this.value = value; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/0000755000175000017500000000000011620316744032502 5ustar twernertwerner././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/tes0000755000175000017500000000000011620316744033216 5ustar twernertwerner././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/test/DefaultsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/tes0000644000175000017500000000275510562616254033234 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.xmlschema.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.xmlschema.support.defaults.Root; /** * DefaultsTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class DefaultsUnitTestCase extends AbstractDefaultsTest { public static Test suite() { return suite(DefaultsUnitTestCase.class); } public DefaultsUnitTestCase(String name) { super(name, Root.class); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/test/AbstractDefaultsTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/tes0000644000175000017500000000415610562616254033231 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.xmlschema.test; import java.util.Collections; import javax.xml.XMLConstants; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * AbstractErrorTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractDefaultsTest extends AbstractBuilderTest { /** The root class */ private Class root; public AbstractDefaultsTest(String name, Class root) { super(name); this.root = root; } public void testDefaultsUnmarshal() throws Exception { unmarshalObject(root); } public void testDefaultsSchemaBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(root); testDefaults(schemaBinding); } protected void testDefaults(SchemaBinding schemaBinding) { assertNotNull(schemaBinding); // Check the annotation values assertEquals(Collections.singleton(XMLConstants.NULL_NS_URI), schemaBinding.getNamespaces()); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/test/NoneUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/tes0000644000175000017500000000273510562616254033232 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.xmlschema.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.xmlschema.support.none.Root; /** * NoneUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NoneUnitTestCase extends AbstractDefaultsTest { public static Test suite() { return suite(NoneUnitTestCase.class); } public NoneUnitTestCase(String name) { super(name, Root.class); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/test/NonDefaultsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/tes0000644000175000017500000000413010562616254033221 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.xmlschema.test; import java.util.Collections; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.xmlschema.support.nondefaults.Root; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * NonDefaultsUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NonDefaultsUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(NonDefaultsUnitTestCase.class); } public NonDefaultsUnitTestCase(String name) { super(name); } public void testNonDefaultsUnmarshal() throws Exception { unmarshalObject(Root.class); } public void testNonDefaultsSchemaBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(Root.class); assertNotNull(schemaBinding); // Check the annotation values assertEquals(Collections.singleton("testNamespace"), schemaBinding.getNamespaces()); } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/test/NoPkgUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/tes0000644000175000017500000000274110562616254033227 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.xmlschema.test; import org.jboss.test.xb.builder.object.xmlschema.support.nopkg.Root; import junit.framework.Test; /** * NoneUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NoPkgUnitTestCase extends AbstractDefaultsTest { public static Test suite() { return suite(NoPkgUnitTestCase.class); } public NoPkgUnitTestCase(String name) { super(name, Root.class); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/ObjectXmlSchemaTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/Obj0000644000175000017500000000404510562616254033145 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.xmlschema; import org.jboss.test.xb.builder.object.xmlschema.test.DefaultsUnitTestCase; import org.jboss.test.xb.builder.object.xmlschema.test.NoPkgUnitTestCase; import org.jboss.test.xb.builder.object.xmlschema.test.NonDefaultsUnitTestCase; import org.jboss.test.xb.builder.object.xmlschema.test.NoneUnitTestCase; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * ObjectJBossXMLSchemaTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectXmlSchemaTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object XmlSchema Tests"); suite.addTest(NoPkgUnitTestCase.suite()); suite.addTest(NoneUnitTestCase.suite()); suite.addTest(DefaultsUnitTestCase.suite()); suite.addTest(NonDefaultsUnitTestCase.suite()); // TODO test semantics return suite; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/sup0000755000175000017500000000000011620316744033232 5ustar twernertwerner././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/support/defaults/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/sup0000755000175000017500000000000011620316744033232 5ustar twernertwerner././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/support/defaults/package-info.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/sup0000644000175000017500000000213710562616254033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ @XmlSchema package org.jboss.test.xb.builder.object.xmlschema.support.defaults; import javax.xml.bind.annotation.XmlSchema; ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/support/defaults/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/sup0000644000175000017500000000226010562616254033237 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.xmlschema.support.defaults; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Root { } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/support/none/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/sup0000755000175000017500000000000011620316744033232 5ustar twernertwerner././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/support/none/package-info.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/sup0000644000175000017500000000204310562616254033236 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.xmlschema.support.none; ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/support/none/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/sup0000644000175000017500000000225410562616254033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.xmlschema.support.none; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Root { } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/support/nondefaults/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/sup0000755000175000017500000000000011620316744033232 5ustar twernertwerner././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/support/nondefaults/package-info.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/sup0000644000175000017500000000254410562616254033244 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ @XmlSchema(attributeFormDefault=XmlNsForm.QUALIFIED, elementFormDefault=XmlNsForm.QUALIFIED, namespace="testNamespace", xmlns=@XmlNs(namespaceURI="testNamespace", prefix="testPrefix")) package org.jboss.test.xb.builder.object.xmlschema.support.nondefaults; import javax.xml.bind.annotation.XmlNs; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlSchema; ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/support/nondefaults/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/sup0000644000175000017500000000226310562616254033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.xmlschema.support.nondefaults; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Root { } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/support/nopkg/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/sup0000755000175000017500000000000011620316744033232 5ustar twernertwerner././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/support/nopkg/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/xmlschema/sup0000644000175000017500000000225510562616254033243 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.xmlschema.support.nopkg; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Root { } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000755000175000017500000000000011620316751033227 5ustar twernertwerner././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000755000175000017500000000000011620316751033227 5ustar twernertwerner././@LongLink0000000000000000000000000000023300000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/test/PropertyAccessModeTypeOverrideUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000661211345730356033243 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.test; import java.util.Collection; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.beanaccessmode.support.PropertyAccessModeTypeOverride; import org.jboss.test.xb.builder.object.beanaccessmode.support.PropertyAccessModeTypeOverride.PropertyAccessModeType; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A PropertyAccessModeTypeOverrideUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class PropertyAccessModeTypeOverrideUnitTestCase extends AbstractBuilderTest { public PropertyAccessModeTypeOverrideUnitTestCase(String name) { super(name); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(PropertyAccessModeTypeOverride.class, true); ElementBinding root = schema.getElement(new QName("root")); assertNotNull(root); TypeBinding type = root.getType(); assertEquals(3, type.getAttributes().size()); ModelGroupBinding group = (ModelGroupBinding)type.getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(1, particles.size()); ElementBinding e = (ElementBinding) particles.iterator().next().getTerm(); assertEquals(new QName("e"), e.getQName()); type = e.getType(); assertEquals(1, type.getAttributes().size()); assertNotNull(type.getAttribute(new QName("property"))); } public void testUnmarshalling() throws Exception { PropertyAccessModeTypeOverride root = unmarshalObject(PropertyAccessModeTypeOverride.class); assertEquals("property", root.getProperty()); assertEquals("fields", root.publicField); assertEquals("all", root.privateField()); PropertyAccessModeType e = root.e; assertNotNull(e); assertEquals("property", e.getProperty()); assertNull(e.publicField); assertNull(e.privateField()); } } ././@LongLink0000000000000000000000000000023600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/test/SchemaLevelPublicMemberAccessModeUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000542211345730356033241 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.test; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.beanaccessmode.support.SomeType; import org.jboss.test.xb.builder.object.beanaccessmode.support.SchemaLevelPublicMemberAccessMode; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A GlobalBeanAccessModeUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class SchemaLevelPublicMemberAccessModeUnitTestCase extends AbstractBuilderTest { public SchemaLevelPublicMemberAccessModeUnitTestCase(String name) { super(name); } public void testFieldsBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(SchemaLevelPublicMemberAccessMode.class, true); ElementBinding root = schema.getElement(new QName("root")); assertNotNull(root); TypeBinding type = root.getType(); assertEquals(2, type.getAttributes().size()); AttributeBinding attr = type.getAttribute(new QName("property")); assertNotNull(attr); attr = type.getAttribute(new QName("public-field")); assertNotNull(attr); } public void testUnmarshalling() throws Exception { SomeType root = unmarshalObject(SchemaLevelPublicMemberAccessMode.class); assertEquals("property", root.getProperty()); assertEquals("fields", root.publicField); assertNull(root.privateField()); } } ././@LongLink0000000000000000000000000000023700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/test/PublicMemberAccessModeTypeOverrideUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000676611345730356033255 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.test; import java.util.Collection; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.beanaccessmode.support.PublicMemberAccessModeTypeOverride; import org.jboss.test.xb.builder.object.beanaccessmode.support.PublicMemberAccessModeTypeOverride.PropertyAccessModeType; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A PropertyAccessModeTypeOverrideUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class PublicMemberAccessModeTypeOverrideUnitTestCase extends AbstractBuilderTest { public PublicMemberAccessModeTypeOverrideUnitTestCase(String name) { super(name); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(PublicMemberAccessModeTypeOverride.class, true); ElementBinding root = schema.getElement(new QName("root")); assertNotNull(root); TypeBinding type = root.getType(); assertEquals(3, type.getAttributes().size()); ModelGroupBinding group = (ModelGroupBinding)type.getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(1, particles.size()); ElementBinding e = (ElementBinding) particles.iterator().next().getTerm(); assertEquals(new QName("e"), e.getQName()); type = e.getType(); assertEquals(2, type.getAttributes().size()); assertNotNull(type.getAttribute(new QName("property"))); assertNotNull(type.getAttribute(new QName("public-field"))); } public void testUnmarshalling() throws Exception { PublicMemberAccessModeTypeOverride root = unmarshalObject(PublicMemberAccessModeTypeOverride.class); assertEquals("property", root.getProperty()); assertEquals("fields", root.publicField); assertEquals("all", root.privateField()); PropertyAccessModeType e = root.e; assertNotNull(e); assertEquals("property", e.getProperty()); assertEquals("fields", e.publicField); assertNull(e.privateField()); } } ././@LongLink0000000000000000000000000000024000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/test/PublicMemberAccessModeGroupOverrideUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000751111345730356033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.test; import java.util.Collection; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.beanaccessmode.support.PublicMemberAccessModeGroupOverride; import org.jboss.test.xb.builder.object.beanaccessmode.support.PublicMemberAccessModeGroupOverride.PropertyAccessModeGroup; import org.jboss.xb.binding.sunday.unmarshalling.AllBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A PropertyAccessModeTypeOverrideUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class PublicMemberAccessModeGroupOverrideUnitTestCase extends AbstractBuilderTest { public PublicMemberAccessModeGroupOverrideUnitTestCase(String name) { super(name); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(PublicMemberAccessModeGroupOverride.class, true); ElementBinding root = schema.getElement(new QName("root")); assertNotNull(root); TypeBinding type = root.getType(); assertEquals(3, type.getAttributes().size()); ModelGroupBinding group = (ModelGroupBinding)type.getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(1, particles.size()); AllBinding all = (AllBinding) particles.iterator().next().getTerm(); particles = all.getParticles(); assertEquals(2, particles.size()); Iterator iterator = particles.iterator(); QName propertyName = new QName("property"); QName publicFieldName = new QName("public-field"); while(iterator.hasNext()) { ElementBinding e = (ElementBinding) iterator.next().getTerm(); QName eName = e.getQName(); assertTrue(eName.equals(propertyName) || eName.equals(publicFieldName)); } } public void testUnmarshalling() throws Exception { PublicMemberAccessModeGroupOverride root = unmarshalObject(PublicMemberAccessModeGroupOverride.class); assertEquals("property", root.getProperty()); assertEquals("fields", root.publicField); assertEquals("all", root.privateField()); PropertyAccessModeGroup e = root.e; assertNotNull(e); assertEquals("property", e.getProperty()); assertEquals("fields", e.publicField); assertNull(e.privateField()); } } ././@LongLink0000000000000000000000000000023200000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/test/SchemaLevelPropertyAccessModeUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000523411345730356033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.test; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.beanaccessmode.support.SomeType; import org.jboss.test.xb.builder.object.beanaccessmode.support.SchemaLevelPropertyAccessMode; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A GlobalBeanAccessModeUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class SchemaLevelPropertyAccessModeUnitTestCase extends AbstractBuilderTest { public SchemaLevelPropertyAccessModeUnitTestCase(String name) { super(name); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(SchemaLevelPropertyAccessMode.class, true); ElementBinding root = schema.getElement(new QName("root")); assertNotNull(root); TypeBinding type = root.getType(); assertEquals(1, type.getAttributes().size()); AttributeBinding property = type.getAttribute(new QName("property")); assertNotNull(property); } public void testUnmarshalling() throws Exception { SomeType root = unmarshalObject(SchemaLevelPropertyAccessMode.class); assertEquals("property", root.getProperty()); assertNull(root.publicField); assertNull(root.privateField()); } } ././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/test/AllAccessModeGroupOverrideUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000755011345730356033245 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.test; import java.util.Collection; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.beanaccessmode.support.AllAccessModeGroupOverride; import org.jboss.test.xb.builder.object.beanaccessmode.support.AllAccessModeGroupOverride.PropertyAccessModeGroup; import org.jboss.xb.binding.sunday.unmarshalling.AllBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A PropertyAccessModeTypeOverrideUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class AllAccessModeGroupOverrideUnitTestCase extends AbstractBuilderTest { public AllAccessModeGroupOverrideUnitTestCase(String name) { super(name); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(AllAccessModeGroupOverride.class, true); ElementBinding root = schema.getElement(new QName("root")); assertNotNull(root); TypeBinding type = root.getType(); assertEquals(2, type.getAttributes().size()); ModelGroupBinding group = (ModelGroupBinding)type.getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(1, particles.size()); AllBinding all = (AllBinding) particles.iterator().next().getTerm(); particles = all.getParticles(); assertEquals(3, particles.size()); Iterator iterator = particles.iterator(); QName propertyName = new QName("property"); QName publicFieldName = new QName("public-field"); QName privateFieldName = new QName("private-field"); while(iterator.hasNext()) { ElementBinding e = (ElementBinding) iterator.next().getTerm(); QName eName = e.getQName(); assertTrue(eName.equals(propertyName) || eName.equals(publicFieldName) || eName.equals(privateFieldName)); } } public void testUnmarshalling() throws Exception { AllAccessModeGroupOverride root = unmarshalObject(AllAccessModeGroupOverride.class); assertEquals("property", root.getProperty()); assertEquals("fields", root.publicField); assertNull(root.privateField()); PropertyAccessModeGroup e = root.e; assertNotNull(e); assertEquals("property", e.getProperty()); assertEquals("fields", e.publicField); assertEquals("all", e.privateField()); } } ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/test/SchemaLevelAllAccessModeUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000550411345730356033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.test; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.beanaccessmode.support.SomeType; import org.jboss.test.xb.builder.object.beanaccessmode.support.SchemaLevelAllAccessMode; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A GlobalBeanAccessModeUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class SchemaLevelAllAccessModeUnitTestCase extends AbstractBuilderTest { public SchemaLevelAllAccessModeUnitTestCase(String name) { super(name); } public void testAllBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(SchemaLevelAllAccessMode.class, true); ElementBinding root = schema.getElement(new QName("root")); assertNotNull(root); TypeBinding type = root.getType(); assertEquals(3, type.getAttributes().size()); AttributeBinding attr = type.getAttribute(new QName("property")); assertNotNull(attr); attr = type.getAttribute(new QName("public-field")); assertNotNull(attr); attr = type.getAttribute(new QName("private-field")); assertNotNull(attr); } public void testUnmarshalling() throws Exception { SomeType root = unmarshalObject(SchemaLevelAllAccessMode.class); assertEquals("property", root.getProperty()); assertEquals("fields", root.publicField); assertEquals("all", root.privateField()); } } ././@LongLink0000000000000000000000000000022600000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/test/AllAccessModeTypeOverrideUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000677411345730356033254 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.test; import java.util.Collection; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.beanaccessmode.support.AllAccessModeTypeOverride; import org.jboss.test.xb.builder.object.beanaccessmode.support.AllAccessModeTypeOverride.PropertyAccessModeType; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A PropertyAccessModeTypeOverrideUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class AllAccessModeTypeOverrideUnitTestCase extends AbstractBuilderTest { public AllAccessModeTypeOverrideUnitTestCase(String name) { super(name); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(AllAccessModeTypeOverride.class, true); ElementBinding root = schema.getElement(new QName("root")); assertNotNull(root); TypeBinding type = root.getType(); assertEquals(2, type.getAttributes().size()); ModelGroupBinding group = (ModelGroupBinding)type.getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(1, particles.size()); ElementBinding e = (ElementBinding) particles.iterator().next().getTerm(); assertEquals(new QName("e"), e.getQName()); type = e.getType(); assertEquals(3, type.getAttributes().size()); assertNotNull(type.getAttribute(new QName("property"))); assertNotNull(type.getAttribute(new QName("public-field"))); assertNotNull(type.getAttribute(new QName("private-field"))); } public void testUnmarshalling() throws Exception { AllAccessModeTypeOverride root = unmarshalObject(AllAccessModeTypeOverride.class); assertEquals("property", root.getProperty()); assertEquals("fields", root.publicField); assertNull(root.privateField()); PropertyAccessModeType e = root.e; assertNotNull(e); assertEquals("property", e.getProperty()); assertEquals("fields", e.publicField); assertEquals("all", e.privateField()); } } ././@LongLink0000000000000000000000000000023400000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/test/PropertyAccessModeGroupOverrideUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000674511345730356033252 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.test; import java.util.Collection; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.beanaccessmode.support.PropertyAccessModeGroupOverride; import org.jboss.test.xb.builder.object.beanaccessmode.support.PropertyAccessModeGroupOverride.PropertyAccessModeGroup; import org.jboss.xb.binding.sunday.unmarshalling.AllBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A PropertyAccessModeTypeOverrideUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class PropertyAccessModeGroupOverrideUnitTestCase extends AbstractBuilderTest { public PropertyAccessModeGroupOverrideUnitTestCase(String name) { super(name); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(PropertyAccessModeGroupOverride.class, true); ElementBinding root = schema.getElement(new QName("root")); assertNotNull(root); TypeBinding type = root.getType(); assertEquals(3, type.getAttributes().size()); ModelGroupBinding group = (ModelGroupBinding)type.getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(1, particles.size()); AllBinding all = (AllBinding) particles.iterator().next().getTerm(); particles = all.getParticles(); assertEquals(1, particles.size()); ElementBinding e = (ElementBinding) particles.iterator().next().getTerm(); assertEquals(new QName("property"), e.getQName()); } public void testUnmarshalling() throws Exception { PropertyAccessModeGroupOverride root = unmarshalObject(PropertyAccessModeGroupOverride.class); assertEquals("property", root.getProperty()); assertEquals("fields", root.publicField); assertEquals("all", root.privateField()); PropertyAccessModeGroup e = root.e; assertNotNull(e); assertEquals("property", e.getProperty()); assertNull(e.publicField); assertNull(e.privateField()); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000755000175000017500000000000011620316752033230 5ustar twernertwerner././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/support/SchemaLevelAllAccessMode.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000276611345730356033251 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlAccessMode; import org.jboss.xb.annotations.JBossXmlSchema; /** * A SchemaLevelPropertyBeanAccess. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(accessMode = JBossXmlAccessMode.ALL) @XmlRootElement(name="root") public class SchemaLevelAllAccessMode extends SomeType { } ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/support/SchemaLevelPublicMemberAccessMode.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000301111345730356033231 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlAccessMode; import org.jboss.xb.annotations.JBossXmlSchema; /** * A SchemaLevelPropertyBeanAccess. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(accessMode = JBossXmlAccessMode.PUBLIC_MEMBER) @XmlRootElement(name="root") public class SchemaLevelPublicMemberAccessMode extends SomeType { } ././@LongLink0000000000000000000000000000022200000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/support/PropertyAccessModeTypeOverride.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000343211345730356033240 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.support; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlAccessMode; import org.jboss.xb.annotations.JBossXmlSchema; import org.jboss.xb.annotations.JBossXmlType; /** * A PropertyAccessModeType. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(accessMode = JBossXmlAccessMode.ALL) @XmlRootElement(name="root") public class PropertyAccessModeTypeOverride extends SomeType { @XmlElement public PropertyAccessModeType e; @JBossXmlType(accessMode = JBossXmlAccessMode.PROPERTY) public static class PropertyAccessModeType extends SomeType { } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/support/SomeType.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000321611345730356033240 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2010, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.support; import javax.xml.bind.annotation.XmlAttribute; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class SomeType { @XmlAttribute private String privateField; @XmlAttribute public String publicField; private String property; @XmlAttribute public String getProperty() { return property; } public void setProperty(String property) { this.property = property; } public String privateField() { return privateField; } } ././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/support/PropertyAccessModeGroupOverride.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000430311345730356033236 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlAccessMode; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; import org.jboss.xb.annotations.JBossXmlSchema; /** * A PropertyAccessModeType. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(accessMode = JBossXmlAccessMode.ALL) @XmlRootElement(name="root") public class PropertyAccessModeGroupOverride extends SomeType { public PropertyAccessModeGroup e; @JBossXmlModelGroup(name="all", accessMode=JBossXmlAccessMode.PROPERTY, kind=JBossXmlConstants.MODEL_GROUP_ALL) public static class PropertyAccessModeGroup { private String property; public String publicField; private String privateField; public String getProperty() { return property; } public void setProperty(String property) { this.property = property; } public String privateField() { return privateField; } } } ././@LongLink0000000000000000000000000000022100000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/support/SchemaLevelPropertyAccessMode.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000300011345730356033227 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlAccessMode; import org.jboss.xb.annotations.JBossXmlSchema; /** * A SchemaLevelPropertyBeanAccess. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(accessMode = JBossXmlAccessMode.PROPERTY) @XmlRootElement(name="root") public class SchemaLevelPropertyAccessMode extends SomeType { } ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/support/AllAccessModeGroupOverride.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000430311345730356033236 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlAccessMode; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; import org.jboss.xb.annotations.JBossXmlSchema; /** * A PropertyAccessModeType. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(accessMode = JBossXmlAccessMode.PUBLIC_MEMBER) @XmlRootElement(name="root") public class AllAccessModeGroupOverride extends SomeType { public PropertyAccessModeGroup e; @JBossXmlModelGroup(name="all", accessMode=JBossXmlAccessMode.ALL, kind=JBossXmlConstants.MODEL_GROUP_ALL) public static class PropertyAccessModeGroup { private String property; public String publicField; private String privateField; public String getProperty() { return property; } public void setProperty(String property) { this.property = property; } public String privateField() { return privateField; } } } ././@LongLink0000000000000000000000000000022600000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/support/PublicMemberAccessModeTypeOverride.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000344311345730356033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.support; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlAccessMode; import org.jboss.xb.annotations.JBossXmlSchema; import org.jboss.xb.annotations.JBossXmlType; /** * A PropertyAccessModeType. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(accessMode = JBossXmlAccessMode.ALL) @XmlRootElement(name="root") public class PublicMemberAccessModeTypeOverride extends SomeType { @XmlElement public PropertyAccessModeType e; @JBossXmlType(accessMode = JBossXmlAccessMode.PUBLIC_MEMBER) public static class PropertyAccessModeType extends SomeType { } } ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/support/AllAccessModeTypeOverride.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000343211345730356033240 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.support; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlAccessMode; import org.jboss.xb.annotations.JBossXmlSchema; import org.jboss.xb.annotations.JBossXmlType; /** * A PropertyAccessModeType. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(accessMode = JBossXmlAccessMode.PUBLIC_MEMBER) @XmlRootElement(name="root") public class AllAccessModeTypeOverride extends SomeType { @XmlElement public PropertyAccessModeType e; @JBossXmlType(accessMode = JBossXmlAccessMode.ALL) public static class PropertyAccessModeType extends SomeType { } } ././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmode/support/PublicMemberAccessModeGroupOverride.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/beanaccessmod0000644000175000017500000000431411345730356033240 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.beanaccessmode.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlAccessMode; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; import org.jboss.xb.annotations.JBossXmlSchema; /** * A PropertyAccessModeType. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(accessMode = JBossXmlAccessMode.ALL) @XmlRootElement(name="root") public class PublicMemberAccessModeGroupOverride extends SomeType { public PropertyAccessModeGroup e; @JBossXmlModelGroup(name="all", accessMode=JBossXmlAccessMode.PUBLIC_MEMBER, kind=JBossXmlConstants.MODEL_GROUP_ALL) public static class PropertyAccessModeGroup { private String property; public String publicField; private String privateField; public String getProperty() { return property; } public void setProperty(String property) { this.property = property; } public String privateField() { return privateField; } } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlpreservewhitespace/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlprese0000755000175000017500000000000011620316751033340 5ustar twernertwerner././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlpreservewhitespace/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlprese0000755000175000017500000000000011620316751033340 5ustar twernertwerner././@LongLink0000000000000000000000000000024300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlpreservewhitespace/test/JBossXmlPreserveWhitespaceUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlprese0000644000175000017500000000524011042106731033334 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlpreservewhitespace.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.jbossxmlpreservewhitespace.support.CustomizedSchemaRoot; import org.jboss.test.xb.builder.object.jbossxmlpreservewhitespace.support.DefaultsRoot; /** * A JBossXmlPreserveWhitespaceUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class JBossXmlPreserveWhitespaceUnitTestCase extends AbstractBuilderTest { public JBossXmlPreserveWhitespaceUnitTestCase(String name) { super(name); } public void testDefaults() throws Exception { DefaultsRoot root = unmarshalObject(DefaultsRoot.class); assertEquals(" value ", root.getSchemaDefaults()); assertEquals(" value ", root.getPreserveTrue()); assertEquals("value", root.getPreserveFalse()); assertEquals(" value ", root.getSchemaDefaultsAttribute()); assertEquals(" value ", root.getPreserveTrueAttribute()); assertEquals("value", root.getPreserveFalseAttribute()); } public void testCustomizedSchema() throws Exception { CustomizedSchemaRoot root = unmarshalObject(CustomizedSchemaRoot.class); assertEquals("value", root.getSchemaDefaults()); assertEquals(" value ", root.getPreserveTrue()); assertEquals("value", root.getPreserveFalse()); assertEquals("value", root.getSchemaDefaultsAttribute()); assertEquals(" value ", root.getPreserveTrueAttribute()); assertEquals("value", root.getPreserveFalseAttribute()); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlpreservewhitespace/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlprese0000755000175000017500000000000011620316751033340 5ustar twernertwerner././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlpreservewhitespace/support/CustomizedSchemaRoot.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlprese0000644000175000017500000000635011143235515033344 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlpreservewhitespace.support; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlPreserveWhitespace; import org.jboss.xb.annotations.JBossXmlSchema; /** * A CustomizedSchemaRoot. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @JBossXmlSchema(normalizeSpace=true) @XmlType(propOrder={"schemaDefaults", "preserveTrue", "preserveFalse"}) public class CustomizedSchemaRoot { private String schemaDefaults; private String preserveTrue; private String preserveFalse; private String schemaDefaultsAttribute; private String preserveTrueAttribute; private String preserveFalseAttribute; public String getSchemaDefaults() { return schemaDefaults; } public void setSchemaDefaults(String str) { this.schemaDefaults = str; } @JBossXmlPreserveWhitespace public String getPreserveTrue() { return preserveTrue; } public void setPreserveTrue(String str) { this.preserveTrue = str; } @JBossXmlPreserveWhitespace(preserve=false) public String getPreserveFalse() { return preserveFalse; } public void setPreserveFalse(String str) { this.preserveFalse = str; } @XmlAttribute() public String getSchemaDefaultsAttribute() { return schemaDefaultsAttribute; } public void setSchemaDefaultsAttribute(String str) { this.schemaDefaultsAttribute = str; } @XmlAttribute() @JBossXmlPreserveWhitespace public String getPreserveTrueAttribute() { return preserveTrueAttribute; } public void setPreserveTrueAttribute(String str) { this.preserveTrueAttribute = str; } @XmlAttribute() @JBossXmlPreserveWhitespace(preserve=false) public String getPreserveFalseAttribute() { return preserveFalseAttribute; } public void setPreserveFalseAttribute(String str) { this.preserveFalseAttribute = str; } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlpreservewhitespace/support/DefaultsRoot.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlprese0000644000175000017500000000616611143235515033351 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlpreservewhitespace.support; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlPreserveWhitespace; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"schemaDefaults", "preserveTrue", "preserveFalse"}) public class DefaultsRoot { private String schemaDefaults; private String preserveTrue; private String preserveFalse; private String schemaDefaultsAttribute; private String preserveTrueAttribute; private String preserveFalseAttribute; public String getSchemaDefaults() { return schemaDefaults; } public void setSchemaDefaults(String str) { this.schemaDefaults = str; } @JBossXmlPreserveWhitespace public String getPreserveTrue() { return preserveTrue; } public void setPreserveTrue(String str) { this.preserveTrue = str; } @JBossXmlPreserveWhitespace(preserve=false) public String getPreserveFalse() { return preserveFalse; } public void setPreserveFalse(String str) { this.preserveFalse = str; } @XmlAttribute() public String getSchemaDefaultsAttribute() { return schemaDefaultsAttribute; } public void setSchemaDefaultsAttribute(String str) { this.schemaDefaultsAttribute = str; } @XmlAttribute() @JBossXmlPreserveWhitespace public String getPreserveTrueAttribute() { return preserveTrueAttribute; } public void setPreserveTrueAttribute(String str) { this.preserveTrueAttribute = str; } @XmlAttribute() @JBossXmlPreserveWhitespace(preserve=false) public String getPreserveFalseAttribute() { return preserveFalseAttribute; } public void setPreserveFalseAttribute(String str) { this.preserveFalseAttribute = str; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/0000755000175000017500000000000011620316756032273 5ustar twernertwerner././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test0000755000175000017500000000000011620316756033173 5ustar twernertwerner././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test/StaticClassMethodInstantiateUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test0000644000175000017500000000332510625561630033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.javabean.support.TestStaticClassMethodInstantiate; /** * StaticClassMethodInstantiateUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class StaticClassMethodInstantiateUnitTestCase extends AbstractJavaBeanTest { public static Test suite() { return suite(StaticClassMethodInstantiateUnitTestCase.class); } public StaticClassMethodInstantiateUnitTestCase(String name) { super(name); } public void testStaticClassMethodInstantiate() throws Exception { unmarshalJavaBean(TestStaticClassMethodInstantiate.class); } } ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test/StaticMethodInstantiateUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test0000644000175000017500000000326210625561630033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.javabean.support.TestStaticMethodInstantiate; /** * StaticMethodInstantiateUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class StaticMethodInstantiateUnitTestCase extends AbstractJavaBeanTest { public static Test suite() { return suite(StaticMethodInstantiateUnitTestCase.class); } public StaticMethodInstantiateUnitTestCase(String name) { super(name); } public void testStaticMethodInstantiate() throws Exception { unmarshalJavaBean(TestStaticMethodInstantiate.class); } } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test/PropertyWildcardUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test0000644000175000017500000000345110625561630033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.javabean.support.TestPropertyWildcard; import org.jboss.test.xb.builder.object.javabean.support.TestWildcard; /** * PropertyWildcardUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class PropertyWildcardUnitTestCase extends AbstractJavaBeanTest { public static Test suite() { return suite(PropertyWildcardUnitTestCase.class); } public PropertyWildcardUnitTestCase(String name) { super(name); } public void testProperty() throws Exception { TestPropertyWildcard bean = unmarshalJavaBean(TestPropertyWildcard.class); TestWildcard wildcard = bean.getBean(); assertNotNull(wildcard); } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test/SimpleInstantiateUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test0000644000175000017500000000321010625561630033166 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.javabean.support.TestSimpleInstantiate; /** * SimpleInstantiateUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class SimpleInstantiateUnitTestCase extends AbstractJavaBeanTest { public static Test suite() { return suite(SimpleInstantiateUnitTestCase.class); } public SimpleInstantiateUnitTestCase(String name) { super(name); } public void testSimpleInstantiate() throws Exception { unmarshalJavaBean(TestSimpleInstantiate.class); } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test/ParameterInstantiateUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test0000644000175000017500000000336510625561630033201 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.javabean.support.TestParameterInstantiate; /** * ParameterInstantiateUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ParameterInstantiateUnitTestCase extends AbstractJavaBeanTest { public static Test suite() { return suite(ParameterInstantiateUnitTestCase.class); } public ParameterInstantiateUnitTestCase(String name) { super(name); } public void testParameterInstantiate() throws Exception { TestParameterInstantiate result = unmarshalJavaBean(TestParameterInstantiate.class); assertEquals("Hello5", result.constructorUsed); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test/PropertyUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test0000644000175000017500000001022410625561630033171 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.test; import java.math.BigDecimal; import java.math.BigInteger; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import junit.framework.Test; import org.jboss.test.xb.builder.object.javabean.support.TestProperty; /** * PropertyInstantiateUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class PropertyUnitTestCase extends AbstractJavaBeanTest { private static DateFormat dateFormat = new SimpleDateFormat("MMM d HH:mm:ss z yyyy"); String stringValue = "StringValue"; Byte byteValue = new Byte("12"); Boolean booleanValue = Boolean.TRUE; // TODO character // Character characterValue = new Character('a'); Short shortValue = new Short("123"); Integer integerValue = new Integer("1234"); Long longValue = new Long("12345"); Float floatValue = new Float("3.14"); Double doubleValue = new Double("3.14e12"); // Date dateValue = createDate("Mon Jan 01 00:00:00 CET 2001"); // Date dateValue = createDate("Jan 01 00:00:00 CET 2001"); BigDecimal bigDecimalValue = new BigDecimal("12e4"); BigInteger bigIntegerValue = new BigInteger("123456"); public static Test suite() { return suite(PropertyUnitTestCase.class); } public PropertyUnitTestCase(String name) { super(name); } public void testProperty() throws Exception { TestProperty bean = unmarshalJavaBean(TestProperty.class); assertEquals(stringValue, bean.getAString()); assertEquals(byteValue, bean.getAByte()); assertEquals(booleanValue, bean.getABoolean()); // TODO character // assertEquals(characterValue, bean.getACharacter()); assertEquals(shortValue, bean.getAShort()); assertEquals(integerValue, bean.getAnInt()); assertEquals(longValue, bean.getALong()); assertEquals(floatValue, bean.getAFloat()); assertEquals(doubleValue, bean.getADouble()); // TODO assertEquals(dateValue, bean.getADate()); assertEquals(bigDecimalValue, bean.getABigDecimal()); assertEquals(bigIntegerValue, bean.getABigInteger()); assertEquals(byteValue.byteValue(), bean.getAbyte()); assertEquals(booleanValue.booleanValue(), bean.isAboolean()); // TODO character // assertEquals(characterValue.charValue(), bean.getAchar()); assertEquals(shortValue.shortValue(), bean.getAshort()); assertEquals(integerValue.intValue(), bean.getAnint()); assertEquals(longValue.longValue(), bean.getAlong()); assertEquals(floatValue.floatValue(), bean.getAfloat()); assertEquals(doubleValue.doubleValue(), bean.getAdouble()); Number number = bean.getANumber(); assertEquals(Long.class, number.getClass()); assertEquals(longValue, number); assertEquals(stringValue, bean.getOverloadedProperty()); // An all uppercase property assertEquals("XYZ", bean.getXYZ()); assertEquals("abc", bean.getAbc()); } protected Date createDate(String date) { try { return dateFormat.parse(date); } catch (Exception e) { throw new RuntimeException(e); } } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test/AbstractJavaBeanTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/test0000644000175000017500000000307610625561630033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.javabean.support.model.JavaBean; /** * AbstractMCTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class AbstractJavaBeanTest extends AbstractBuilderTest { public AbstractJavaBeanTest(String name) { super(name); } protected T unmarshalJavaBean(Class expected, Class... others) throws Exception { return unmarshalObject(expected, JavaBean.class, others); } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/ObjectJavaBeanTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/Obje0000644000175000017500000000460010625561630033072 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.javabean.test.ParameterInstantiateUnitTestCase; import org.jboss.test.xb.builder.object.javabean.test.PropertyUnitTestCase; import org.jboss.test.xb.builder.object.javabean.test.PropertyWildcardUnitTestCase; import org.jboss.test.xb.builder.object.javabean.test.SimpleInstantiateUnitTestCase; import org.jboss.test.xb.builder.object.javabean.test.StaticClassMethodInstantiateUnitTestCase; import org.jboss.test.xb.builder.object.javabean.test.StaticMethodInstantiateUnitTestCase; /** * ObjectJavaBeanTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectJavaBeanTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object JavaBean Tests"); suite.addTest(SimpleInstantiateUnitTestCase.suite()); suite.addTest(StaticMethodInstantiateUnitTestCase.suite()); suite.addTest(StaticClassMethodInstantiateUnitTestCase.suite()); suite.addTest(ParameterInstantiateUnitTestCase.suite()); suite.addTest(PropertyUnitTestCase.suite()); suite.addTest(PropertyWildcardUnitTestCase.suite()); return suite; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000755000175000017500000000000011620316756033203 5ustar twernertwerner././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/TestProperty.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000001405110625561630033203 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Date; /** * TestStaticMethodInstantiate. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestProperty { /** Object */ private Object anObject; /** A string */ private String aString; /** Byte */ private Byte aByte; /** Boolean */ private Boolean aBoolean; /** Character */ private Character aCharacter; /** Short */ private Short aShort; /** Int */ private Integer anInt; /** Long */ private Long aLong; /** Float */ private Float aFloat; /** Double */ private Double aDouble; /** Date */ private Date aDate; /** BigDecimal */ private BigDecimal aBigDecimal; /** BigDecimal */ private BigInteger aBigInteger; /** byte */ private byte abyte; /** boolean */ private boolean aboolean; /** char */ private char achar; /** short */ private short ashort; /** int */ private int anint; /** long */ private long along; /** float */ private float afloat; /** double */ private double adouble; /** number */ private Number aNumber; /** Overloaded property */ private String overloadedProperty; private String xyz; private String abc; public Object getAnObject() { return anObject; } public void setAnObject(Object object) { anObject = object; } public BigDecimal getABigDecimal() { return aBigDecimal; } public void setABigDecimal(BigDecimal bigDecimal) { aBigDecimal = bigDecimal; } public BigInteger getABigInteger() { return aBigInteger; } public void setABigInteger(BigInteger bigInteger) { aBigInteger = bigInteger; } public boolean isAboolean() { return aboolean; } public void setAboolean(boolean aboolean) { this.aboolean = aboolean; } public Boolean getABoolean() { return aBoolean; } public void setABoolean(Boolean boolean1) { aBoolean = boolean1; } public Number getANumber() { return aNumber; } public void setANumber(Number number) { aNumber = number; } public byte getAbyte() { return abyte; } public void setAbyte(byte abyte) { this.abyte = abyte; } public Byte getAByte() { return aByte; } public void setAByte(Byte byte1) { aByte = byte1; } public char getAchar() { return achar; } public void setAchar(char achar) { this.achar = achar; } public Character getACharacter() { return aCharacter; } public void setACharacter(Character character) { aCharacter = character; } public Date getADate() { return aDate; } public void setADate(Date date) { aDate = date; } public double getAdouble() { return adouble; } public void setAdouble(double adouble) { this.adouble = adouble; } public Double getADouble() { return aDouble; } public void setADouble(Double double1) { aDouble = double1; } public float getAfloat() { return afloat; } public void setAfloat(float afloat) { this.afloat = afloat; } public Float getAFloat() { return aFloat; } public void setAFloat(Float float1) { aFloat = float1; } public long getAlong() { return along; } public void setAlong(long along) { this.along = along; } public Long getALong() { return aLong; } public void setALong(Long long1) { aLong = long1; } public int getAnint() { return anint; } public void setAnint(int anint) { this.anint = anint; } public Integer getAnInt() { return anInt; } public void setAnInt(Integer anInt) { this.anInt = anInt; } public short getAshort() { return ashort; } public void setAshort(short ashort) { this.ashort = ashort; } public Short getAShort() { return aShort; } public void setAShort(Short short1) { aShort = short1; } public String getAString() { return aString; } public void setAString(String string) { aString = string; } public String getOverloadedProperty() { return overloadedProperty; } public void setOverloadedProperty(Long broken) { throw new RuntimeException("Invoked the wrong setter"); } public void setOverloadedProperty(String overloadedProperty) { this.overloadedProperty = overloadedProperty; } public void setOverloadedProperty(Integer broken) { throw new RuntimeException("Invoked the wrong setter"); } public String getXYZ() { return xyz; } public void setXYZ(String xyz) { this.xyz = xyz; } public String getAbc() { return abc; } public void setAbc(String abc) { this.abc = abc; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/model/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000755000175000017500000000000011620316756033203 5ustar twernertwerner././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/model/Parameter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000000326110625561630033204 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support.model; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlValue; /** * Parameter. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Parameter { private String type; private Object value; public String getType() { return type; } @XmlAttribute(name="class") public void setType(String type) { this.type = type; } public Object getValue() { return value; } @XmlValue @XmlAnyElement public void setValue(Object value) { this.value = value; } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/model/JavaBeanFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000000256510625561630033212 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support.model; import org.jboss.xb.spi.BeanAdapter; import org.jboss.xb.spi.BeanAdapterFactory; /** * JavaBeanBuilder. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JavaBeanFactory extends BeanAdapterFactory { public BeanAdapter newInstance() { return new JavaBean(this); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/model/Property.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000000262610625561630033210 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support.model; import javax.xml.bind.annotation.XmlAttribute; /** * Property. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Property extends Parameter { private String name; public String getName() { return name; } @XmlAttribute public void setName(String name) { this.name = name; } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/model/JavaBean.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000001530511171577572033217 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support.model; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.config.plugins.property.PropertyConfiguration; import org.jboss.config.spi.Configuration; import org.jboss.joinpoint.plugins.Config; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.annotations.JBossXmlSchema; import org.jboss.xb.annotations.JBossXmlType; import org.jboss.xb.spi.BeanAdapter; import org.jboss.xb.spi.BeanAdapterFactory; /** * JavaBean. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @JBossXmlSchema(namespace="test:javabean", elementFormDefault=XmlNsForm.QUALIFIED) @XmlRootElement(name="javabean") @XmlType(name="javabean", propOrder={"constructor", "properties"}) @JBossXmlType(beanAdapterBuilder=JavaBeanBuilder.class) public class JavaBean extends BeanAdapter { static Configuration configuration = new PropertyConfiguration(); private String className; private Constructor constructor; private Property[] properties; public JavaBean(BeanAdapterFactory beanAdapterFactory) { super(beanAdapterFactory); } public String getClassName() { return className; } @XmlAttribute(name="class") public void setClassName(String className) { this.className = className; } public Constructor getConstructor() { return constructor; } public void setConstructor(Constructor constructor) { this.constructor = constructor; } public Property[] getProperties() { return properties; } @XmlElement(name="property") public void setProperties(Property[] properties) { this.properties = properties; } @XmlTransient public Object getValue() { ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { Object result = null; BeanInfo beanInfo = null; if (className != null) beanInfo = configuration.getBeanInfo(className, cl); if (constructor != null) { String factoryMethod = constructor.getFactoryMethod(); if (factoryMethod != null) { String factoryClass = constructor.getFactoryClass(); BeanInfo factoryBeanInfo = beanInfo; if (factoryClass != null) factoryBeanInfo = configuration.getBeanInfo(factoryClass, cl); String[] signature = getSignature(constructor.getParameters()); MethodInfo factory = Config.findMethodInfo(factoryBeanInfo.getClassInfo(), factoryMethod, signature, true, true); Object[] params = getParams(constructor.getParameters(), factory.getParameterTypes()); result = factory.invoke(null, params); } else { String[] signature = getSignature(constructor.getParameters()); ConstructorInfo constructorInfo = Config.findConstructorInfo(beanInfo.getClassInfo(), signature); Object[] params = getParams(constructor.getParameters(), constructorInfo.getParameterTypes()); result = constructorInfo.newInstance(params); } } else { result = beanInfo.newInstance(); } if (beanInfo == null) beanInfo = configuration.getBeanInfo(result.getClass()); if (properties != null) { for (Property property : properties) { Object value = property.getValue(); if (value != null) { PropertyInfo propertyInfo = beanInfo.getProperty(property.getName()); TypeInfo typeInfo = propertyInfo.getType(); String type = property.getType(); if (type != null) typeInfo = typeInfo.getTypeInfoFactory().getTypeInfo(type, cl); value = typeInfo.convertValue(value, false); propertyInfo.set(result, value); } } } return result; } catch (Throwable t) { throw new RuntimeException("Error constructing javabean", t); } } public Object get(PropertyInfo propertyInfo) throws Throwable { return propertyInfo.get(this); } public void set(PropertyInfo propertyInfo, Object child) throws Throwable { propertyInfo.set(this, child); } private String[] getSignature(Parameter[] parameters) { if (parameters == null) return new String[0]; String[] signature = new String[parameters.length]; for (int i = 0; i < signature.length; ++i) signature[i] = parameters[i].getType(); return signature; } private Object[] getParams(Parameter[] parameters, TypeInfo[] paramTypes) { if (parameters == null) return new String[0]; Object[] params = new Object[parameters.length]; for (int i = 0; i < params.length; ++i) { Object value = parameters[i].getValue(); try { params[i] = paramTypes[i].convertValue(value, false); } catch (Throwable t) { throw new RuntimeException("Error converting parameter #" + i + " value=" + value + " to type " + paramTypes[i]); } } return params; } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/model/Constructor.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000000412110625561630033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support.model; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** * Constructor. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlRootElement(name="constructor") public class Constructor { private String factoryClass; private String factoryMethod; private Parameter[] parameters; public String getFactoryClass() { return factoryClass; } @XmlAttribute(name="factoryClass") public void setFactoryClass(String factoryClass) { this.factoryClass = factoryClass; } public String getFactoryMethod() { return factoryMethod; } @XmlAttribute(name="factoryMethod") public void setFactoryMethod(String factoryMethod) { this.factoryMethod = factoryMethod; } public Parameter[] getParameters() { return parameters; } @XmlElement(name="parameter") public void setParameters(Parameter[] parameters) { this.parameters = parameters; } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/model/JavaBeanBuilder.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000000300010625561630033173 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support.model; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.xb.spi.BeanAdapterBuilder; import org.jboss.xb.spi.BeanAdapterFactory; /** * JavaBeanBuilder. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JavaBeanBuilder implements BeanAdapterBuilder { public BeanAdapterFactory newFactory(BeanInfo beanInfo, MethodInfo factory) { return new JavaBeanFactory(); } } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/TestStaticClassMethodInstantiator.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000000252610625561630033207 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support; /** * TestStaticClassMethodInstantiator. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestStaticClassMethodInstantiator { public static TestStaticClassMethodInstantiate instantiate() { return new TestStaticClassMethodInstantiate(); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/TestWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000000227210625561630033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support; /** * * TestPropertyWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestWildcard { } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/TestParameterInstantiate.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000000253310625561630033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support; /** * TestSimpleInstantiate. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestParameterInstantiate { public String constructorUsed; public TestParameterInstantiate(String string, int integer) { constructorUsed = string + integer; } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/TestSimpleInstantiate.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000000230010625561630033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support; /** * TestSimpleInstantiate. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestSimpleInstantiate { } ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/TestStaticClassMethodInstantiate.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000000240510625561630033203 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support; /** * TestStaticClassMethodInstantiate. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestStaticClassMethodInstantiate { TestStaticClassMethodInstantiate() { } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/TestPropertyWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000000255310625561630033207 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support; /** * * TestPropertyWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestPropertyWildcard { private TestWildcard bean; public TestWildcard getBean() { return bean; } public void setBean(TestWildcard bean) { this.bean = bean; } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/support/TestStaticMethodInstantiate.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/javabean/supp0000644000175000017500000000256710625561630033214 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.javabean.support; /** * TestStaticMethodInstantiate. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestStaticMethodInstantiate { public static TestStaticMethodInstantiate instantiate() { return new TestStaticMethodInstantiate(); } private TestStaticMethodInstantiate() { } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschema/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschem0000755000175000017500000000000011620316750033320 5ustar twernertwerner././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschema/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschem0000755000175000017500000000000011620316750033320 5ustar twernertwerner././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschema/test/DefaultsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschem0000644000175000017500000000276610562616254033343 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlschema.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.jbossxmlschema.support.Defaults; /** * DefaultsTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class DefaultsUnitTestCase extends AbstractDefaultsTest { public static Test suite() { return suite(DefaultsUnitTestCase.class); } public DefaultsUnitTestCase(String name) { super(name, Defaults.class); } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschema/test/AbstractDefaultsTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschem0000644000175000017500000000466511042106731033327 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlschema.test; import java.util.Collections; import javax.xml.XMLConstants; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * AbstractErrorTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractDefaultsTest extends AbstractBuilderTest { /** The root class */ private Class root; public AbstractDefaultsTest(String name, Class root) { super(name); this.root = root; } public void testDefaultsUnmarshal() throws Exception { unmarshalObject(root); } public void testDefaultsSchemaBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(root); testDefaults(schemaBinding); } protected void testDefaults(SchemaBinding schemaBinding) { assertNotNull(schemaBinding); // Check the annotation values assertEquals(Collections.singleton(XMLConstants.NULL_NS_URI), schemaBinding.getNamespaces()); assertTrue(schemaBinding.isIgnoreUnresolvedFieldOrClass()); assertTrue(schemaBinding.isIgnoreLowLine()); assertTrue(schemaBinding.isReplacePropertyRefs()); assertEquals(root.getPackage().getName(), schemaBinding.getPackageMetaData().getName()); assertFalse(schemaBinding.isNormalizeSpace()); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschema/test/NoneUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschem0000644000175000017500000000274210562616254033335 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlschema.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.jbossxmlschema.support.None; /** * NoneUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NoneUnitTestCase extends AbstractDefaultsTest { public static Test suite() { return suite(NoneUnitTestCase.class); } public NoneUnitTestCase(String name) { super(name, None.class); } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschema/test/NonDefaultsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschem0000644000175000017500000000464111042106731033321 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlschema.test; import java.util.Collections; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.jbossxmlschema.support.NonDefaults; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * NonDefaultsUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NonDefaultsUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(NonDefaultsUnitTestCase.class); } public NonDefaultsUnitTestCase(String name) { super(name); } public void testNonDefaultsUnmarshal() throws Exception { unmarshalObject(NonDefaults.class); } public void testNonDefaultsSchemaBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(NonDefaults.class); assertNotNull(schemaBinding); // Check the annotation values assertEquals(Collections.singleton("testNamespace"), schemaBinding.getNamespaces()); assertFalse(schemaBinding.isIgnoreUnresolvedFieldOrClass()); assertFalse(schemaBinding.isIgnoreLowLine()); assertFalse(schemaBinding.isReplacePropertyRefs()); assertEquals("testPackage", schemaBinding.getPackageMetaData().getName()); assertTrue(schemaBinding.isNormalizeSpace()); } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschema/ObjectJBossXmlSchemaTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschem0000644000175000017500000000365310562616254033337 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlschema; import org.jboss.test.xb.builder.object.jbossxmlschema.test.DefaultsUnitTestCase; import org.jboss.test.xb.builder.object.jbossxmlschema.test.NoneUnitTestCase; import org.jboss.test.xb.builder.object.jbossxmlschema.test.NonDefaultsUnitTestCase; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * ObjectJBossXMLSchemaTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectJBossXmlSchemaTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object JBossXmlSchema Tests"); suite.addTest(NoneUnitTestCase.suite()); suite.addTest(DefaultsUnitTestCase.suite()); suite.addTest(NonDefaultsUnitTestCase.suite()); return suite; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschema/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschem0000755000175000017500000000000011620316750033320 5ustar twernertwerner././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschema/support/Defaults.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschem0000644000175000017500000000235310562616254033333 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlschema.support; import org.jboss.xb.annotations.JBossXmlSchema; /** * Defaults * * @author Adrian Brock * @version $Revision: 1.1 $ */ @JBossXmlSchema public class Defaults { } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschema/support/None.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschem0000644000175000017500000000224210562616254033330 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlschema.support; /** * None * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class None { } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschema/support/NonDefaults.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlschem0000644000175000017500000000262211042106731033316 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlschema.support; import org.jboss.xb.annotations.JBossXmlSchema; /** * NonDefaults * * @author Adrian Brock * @version $Revision: 1.1 $ */ @JBossXmlSchema(namespace = "testNamespace", ignoreLowLine=false, ignoreUnresolvedFieldOrClass=false, packageName="testPackage", replacePropertyRefs=false, normalizeSpace=true) public class NonDefaults { } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue0000755000175000017500000000000011620316752033337 5ustar twernertwerner././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue0000755000175000017500000000000011620316752033337 5ustar twernertwerner././@LongLink0000000000000000000000000000022600000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue/test/MixedTypeIgnoreEmptyStringUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue0000644000175000017500000000565511061213247033346 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlvalue.test; import java.util.List; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.jbossxmlvalue.support.MixedType; import org.jboss.test.xb.builder.object.jbossxmlvalue.support.MixedTypeIgnoreEmptyStringFalse; import org.jboss.test.xb.builder.object.jbossxmlvalue.support.MixedTypeIgnoreEmptyStringTrue; /** * A MixedTypeIgnoreEmptyStringUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class MixedTypeIgnoreEmptyStringUnitTestCase extends AbstractBuilderTest { public MixedTypeIgnoreEmptyStringUnitTestCase(String name) { super(name); } public void testIgnoreEmptyStringTrue() throws Exception { MixedTypeIgnoreEmptyStringTrue o = unmarshalObject(MixedTypeIgnoreEmptyStringTrue.class); assertEquals("empty string test", o.getChild()); assertNull(o.getValue()); List children = o.getChildren(); assertNotNull(children); assertEquals(2, children.size()); MixedType c = children.get(0); assertNotNull(c); assertNull(c.getValue()); c = children.get(1); assertNotNull(c); assertEquals("txt", c.getValue()); } public void testIgnoreEmptyStringFalse() throws Exception { MixedTypeIgnoreEmptyStringFalse o = unmarshalObject(MixedTypeIgnoreEmptyStringFalse.class); assertEquals("empty string test", o.getChild()); assertEquals("", o.getValue()); List children = o.getChildren(); assertNotNull(children); assertEquals(2, children.size()); MixedType c = children.get(0); assertNotNull(c); assertEquals("", c.getValue()); c = children.get(1); assertNotNull(c); assertEquals("txt", c.getValue()); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue0000755000175000017500000000000011620316752033337 5ustar twernertwerner././@LongLink0000000000000000000000000000022100000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue/support/MixedTypeIgnoreEmptyStringTrue.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue0000644000175000017500000000353011171577572033354 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlvalue.support; import java.util.List; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlValue; /** * A MixedTypeIgnoreEmptyStringTrue. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @JBossXmlValue(ignoreEmptyString=true) @XmlType(propOrder={"child", "children"}) public class MixedTypeIgnoreEmptyStringTrue extends MixedType { private List children; public List getChildren() { return children; } public void setChildren(List children) { this.children = children; } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue/support/MixedType.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue0000644000175000017500000000321011061213247033327 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlvalue.support; import javax.xml.bind.annotation.XmlValue; /** * A MixedType. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class MixedType { private String child; private String value; public String getChild() { return child; } public void setChild(String child) { this.child = child; } @XmlValue public String getValue() { return value; } public void setValue(String value) { this.value = value; } } ././@LongLink0000000000000000000000000000022200000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue/support/MixedTypeIgnoreEmptyStringFalse.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlvalue0000644000175000017500000000353411171577572033360 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlvalue.support; import java.util.List; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlValue; /** * A MixedTypeIgnoreEmptyStringFalse. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @JBossXmlValue(ignoreEmptyString=false) @XmlType(propOrder={"child", "children"}) public class MixedTypeIgnoreEmptyStringFalse extends MixedType { private List children; public List getChildren() { return children; } public void setChildren(List children) { this.children = children; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/0000755000175000017500000000000011620316754031121 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/0000755000175000017500000000000011620316753032077 5ustar twernertwerner././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/DemandTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Deman0000644000175000017500000000542211061473704033050 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractDemandMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ControllerState; /** * Demand TestCase. * * @author Adrian Brock * @version $Revision: 40800 $ */ public class DemandTestCase extends AbstractMCTest { protected AbstractDemandMetaData getDemand() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); Set demands = bean.getDemands(); assertNotNull(demands); assertEquals(1, demands.size()); AbstractDemandMetaData demand = (AbstractDemandMetaData) demands.iterator().next(); assertNotNull(demand); return demand; } public void testDemand() throws Exception { AbstractDemandMetaData demand = getDemand(); assertEquals("Demand", demand.getDemand()); assertEquals(ControllerState.DESCRIBED, demand.getWhenRequired()); } public void testDemandWithWhenRequired() throws Exception { AbstractDemandMetaData demand = getDemand(); assertEquals("Demand", demand.getDemand()); assertEquals(ControllerState.CONFIGURED, demand.getWhenRequired()); } /* TODO public void testDemandBadNoValue() throws Exception { try { unmarshalBean("DemandBadNoValue.xml"); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ public static Test suite() { return suite(DemandTestCase.class); } public DemandTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/ValueTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Value0000644000175000017500000000545611061473704033107 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.PropertyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.StringValueMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ValueMetaData; /** * ValueTestCase. * * @author Adrian Brock * @version $Revision: 40781 $ */ public class ValueTestCase extends AbstractMCTest { protected StringValueMetaData getValue() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); Set properties = bean.getProperties(); assertNotNull(properties); assertEquals(1, properties.size()); PropertyMetaData property = (PropertyMetaData) properties.iterator().next(); assertNotNull(property); ValueMetaData value = property.getValue(); assertNotNull(property); assertTrue(value instanceof StringValueMetaData); return (StringValueMetaData) value; } public void testValue() throws Exception { StringValueMetaData value = getValue(); assertNull(value.getType()); assertNull(value.getUnderlyingValue()); } public void testValueWithClass() throws Exception { StringValueMetaData value = getValue(); assertEquals("ValueClass", value.getType()); assertNull(value.getUnderlyingValue()); } public void testValueWithValue() throws Exception { StringValueMetaData value = getValue(); assertNull(value.getType()); assertEquals("Value", value.getUnderlyingValue()); } public static Test suite() { return suite(ValueTestCase.class); } public ValueTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/ConstructorTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Const0000644000175000017500000002400510763275165033121 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.ArrayList; import java.util.HashSet; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.Annotation1; import org.jboss.test.xb.builder.object.mc.support.Annotation2; import org.jboss.test.xb.builder.object.mc.support.Annotation3; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ConstructorMetaData; /** * ConstructorTestCase. * * @author Adrian Brock * @version $Revision: 56471 $ */ public class ConstructorTestCase extends AbstractMCTest { protected ConstructorMetaData getConstructor() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); ConstructorMetaData constructor = bean.getConstructor(); assertNotNull(constructor); return constructor; } public void testConstructor() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertNull(constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertNull(constructor.getValue()); } public void testConstructorWithBean() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertNull(constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertNotNull(constructor.getValue()); assertTrue(constructor.getValue() instanceof BeanMetaData); } public void testConstructorWithFactoryClass() throws Exception { ConstructorMetaData constructor = getConstructor(); assertEquals("FactoryClass", constructor.getFactoryClass()); assertEquals("Dummy", constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertNull(constructor.getValue()); } public void testConstructorWithFactoryMethod() throws Exception { ConstructorMetaData constructor = getConstructor(); assertEquals("Dummy", constructor.getFactoryClass()); assertEquals("FactoryMethod", constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertNull(constructor.getValue()); } public void testConstructorWithAnnotation() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertNull(constructor.getFactoryMethod()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); assertAnnotations(expected, constructor.getAnnotations()); assertNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertNull(constructor.getValue()); } public void testConstructorWithAnnotations() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertNull(constructor.getFactoryMethod()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); expected.add("@" + Annotation2.class.getName()); expected.add("@" + Annotation3.class.getName()); assertAnnotations(expected, constructor.getAnnotations()); assertNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertNull(constructor.getValue()); } public void testConstructorWithFactory() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertEquals("Dummy", constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNotNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertNull(constructor.getValue()); } public void testConstructorWithParameter() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertNull(constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNull(constructor.getFactory()); ArrayList expected = new ArrayList(); expected.add("Parameter1"); assertParameters(expected, constructor.getParameters()); assertNull(constructor.getValue()); } public void testConstructorWithParameters() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertNull(constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNull(constructor.getFactory()); ArrayList expected = new ArrayList(); expected.add("Parameter1"); expected.add("Parameter2"); expected.add("Parameter3"); assertParameters(expected, constructor.getParameters()); assertNull(constructor.getValue()); } public void testConstructorWithValue() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertNull(constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertValue("Value", constructor.getValue()); } public void testConstructorWithCollection() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertNull(constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertCollection(constructor.getValue()); } public void testConstructorWithList() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertNull(constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertList(constructor.getValue()); } public void testConstructorWithSet() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertNull(constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertSet(constructor.getValue()); } public void testConstructorWithArray() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertNull(constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertArray(constructor.getValue()); } public void testConstructorWithMap() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertNull(constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertMap(constructor.getValue()); } public void testConstructorWithWildcard() throws Exception { ConstructorMetaData constructor = getConstructor(); assertNull(constructor.getFactoryClass()); assertNull(constructor.getFactoryMethod()); assertNull(constructor.getAnnotations()); assertNull(constructor.getFactory()); assertNull(constructor.getParameters()); assertWildcard(constructor.getValue()); } /* TODO public void testConstructorBadFactoryClassNoFactoryMethod() throws Exception { try { unmarshalBean("ConstructorBadFactoryClassNoFactoryMethod.xml"); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ /* TODO public void testConstructorBadFactoryNoFactoryMethod() throws Exception { try { unmarshalBean("ConstructorBadFactoryNoFactoryMethod.xml"); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ public static Test suite() { return suite(ConstructorTestCase.class); } public ConstructorTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/AbstractMCTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Abstr0000644000175000017500000002530511061473704033101 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.net.URL; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.javabean.support.model.JavaBean; import org.jboss.test.xb.builder.object.mc.support.model.AbstractArrayMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractCollectionMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractDependencyValueMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractKernelDeployment; import org.jboss.test.xb.builder.object.mc.support.model.AbstractListMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractMapMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractSetMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractValueMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AnnotationMetaData; import org.jboss.test.xb.builder.object.mc.support.model.CallbackMetaData; import org.jboss.test.xb.builder.object.mc.support.model.DemandMetaData; import org.jboss.test.xb.builder.object.mc.support.model.DependencyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.InstallMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ParameterMetaData; import org.jboss.test.xb.builder.object.mc.support.model.PropertyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.StringValueMetaData; import org.jboss.test.xb.builder.object.mc.support.model.SupplyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ThisValueMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ValueMetaData; import org.jboss.test.xb.builder.object.mc.support.model.factory.GenericBeanFactoryMetaData; import org.jboss.xb.binding.JBossXBException; /** * AbstractMCTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class AbstractMCTest extends AbstractBuilderTest { public AbstractMCTest(String name) { super(name); } protected AbstractKernelDeployment unmarshalDeployment() throws Exception { return unmarshalObject(AbstractKernelDeployment.class, AbstractKernelDeployment.class, JavaBean.class); } protected AbstractBeanMetaData unmarshalBean() throws Exception { return unmarshalObject(AbstractBeanMetaData.class, AbstractKernelDeployment.class, JavaBean.class); } protected GenericBeanFactoryMetaData unmarshalBeanFactory() throws Exception { return unmarshalObject(GenericBeanFactoryMetaData.class, AbstractKernelDeployment.class, JavaBean.class); } protected void assertAnnotations(Set expected, Set annotations) { assertNotNull(annotations); assertEquals(expected.size(), annotations.size()); HashSet clonedExpected = new HashSet(expected); for (Iterator i = annotations.iterator(); i.hasNext();) { AnnotationMetaData annotation = i.next(); if (clonedExpected.remove(annotation.getAnnotation()) == false) fail("Did not expect " + annotation + " expected " + expected); } if (clonedExpected.size() != 0) fail("Expected " + expected + " got " + annotations); } protected void assertProperties(Set expected, Set properties) { assertNotNull(properties); assertEquals(expected.size(), properties.size()); HashSet clonedExpected = new HashSet(expected); for (Iterator i = properties.iterator(); i.hasNext();) { PropertyMetaData property = (PropertyMetaData) i.next(); if (clonedExpected.remove(property.getName()) == false) fail("Did not expect " + property + " expected " + expected); } if (clonedExpected.size() != 0) fail("Expected " + expected + " got " + properties); } protected void assertDepends(Set expected, Set depends) { assertNotNull(depends); assertEquals(expected.size(), depends.size()); HashSet clonedExpected = new HashSet(expected); for (DependencyMetaData depend : depends) { if (clonedExpected.remove(depend.getDependency()) == false) fail("Did not expect " + depend + " expected " + expected); } if (clonedExpected.size() != 0) fail("Expected " + expected + " got " + depends); } protected void assertDemands(Set expected, Set demands) { assertNotNull(demands); assertEquals(expected.size(), demands.size()); HashSet clonedExpected = new HashSet(expected); for (DemandMetaData demand : demands) { if (clonedExpected.remove(demand.getDemand()) == false) fail("Did not expect " + demand + " expected " + expected); } if (clonedExpected.size() != 0) fail("Expected " + expected + " got " + demands); } protected void assertSupplies(Set expected, Set supplies) { assertNotNull(supplies); assertEquals(expected.size(), supplies.size()); HashSet clonedExpected = new HashSet(expected); for (Iterator i = supplies.iterator(); i.hasNext();) { SupplyMetaData supply = (SupplyMetaData) i.next(); if (clonedExpected.remove(supply.getSupply()) == false) fail("Did not expect " + supply + " expected " + expected); } if (clonedExpected.size() != 0) fail("Expected " + expected + " got " + supplies); } protected void assertInstalls(List expected, List installs) { assertNotNull(installs); assertEquals(expected.size(), installs.size()); for (int i = 0; i < expected.size(); ++i) { InstallMetaData install = (InstallMetaData) installs.get(i); String method = (String) expected.get(i); assertEquals(method, install.getMethodName()); } } protected void assertCallbacks(List expected, List callbacks) { assertNotNull(callbacks); assertEquals(expected.size(), callbacks.size()); for (int i = 0; i < expected.size(); ++i) { CallbackMetaData callback = (CallbackMetaData) callbacks.get(i); String method = (String) expected.get(i); assertEquals(method, callback.getMethodName()); } } protected void assertParameters(List expected, List parameters) { assertNotNull(parameters); assertEquals(expected.size(), parameters.size()); for (int i = 0; i < expected.size(); ++i) { ParameterMetaData parameter = (ParameterMetaData) parameters.get(i); String method = (String) expected.get(i); assertEquals(method, parameter.getType()); } } protected void assertPlainValue(String expected, ValueMetaData valueMetaData) { assertValue(expected, valueMetaData); } protected void assertValue(String expected, ValueMetaData valueMetaData) { assertNotNull(valueMetaData); assertTrue(valueMetaData instanceof StringValueMetaData); Object value = valueMetaData.getUnderlyingValue(); assertEquals(expected, value); } protected void assertStringValue(String type, String expected, ValueMetaData valueMetaData) { assertValue(expected, valueMetaData); StringValueMetaData stringValueMetaData = (StringValueMetaData) valueMetaData; assertEquals(type, stringValueMetaData.getType()); } protected void assertInjection(ValueMetaData value) { assertNotNull(value); assertTrue(value instanceof AbstractDependencyValueMetaData); } protected void assertNullValue(ValueMetaData value) { assertNotNull(value); assertTrue(value instanceof AbstractValueMetaData); assertNull(value.getUnderlyingValue()); } protected void assertWildcard(ValueMetaData value) { assertNotNull(value); assertEquals(AbstractValueMetaData.class, value.getClass()); Object wildcard = value.getUnderlyingValue(); assertNotNull(wildcard); } protected void assertCollection(ValueMetaData value) { assertNotNull(value); assertTrue(value instanceof AbstractCollectionMetaData); } protected void assertList(ValueMetaData value) { assertNotNull(value); assertTrue(value instanceof AbstractListMetaData); } protected void assertSet(ValueMetaData value) { assertNotNull(value); assertTrue(value instanceof AbstractSetMetaData); } protected void assertArray(ValueMetaData value) { assertNotNull(value); assertTrue(value instanceof AbstractArrayMetaData); } protected void assertMap(ValueMetaData value) { assertNotNull(value); assertTrue(value instanceof AbstractMapMetaData); } protected void assertThis(ValueMetaData value) { assertNotNull(value); assertTrue(value instanceof ThisValueMetaData); } protected void checkJBossXBException(Class expected, Throwable throwable) { checkThrowable(JBossXBException.class, throwable); JBossXBException e = (JBossXBException) throwable; checkThrowable(expected, e.getCause()); } /** * Find the xml * * @param name the name * @return the url of the xml */ protected String findXML(String name) { name = getName().substring(4) + ".xml"; URL url = getClass().getResource(name); if (url == null) fail(name + " not found"); return url.toString(); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/MapTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/MapTe0000644000175000017500000001505311061473704033033 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractMapMetaData; import org.jboss.test.xb.builder.object.mc.support.model.PropertyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ValueMetaData; /** * MapTestCase. * * @author Adrian Brock * @version $Revision: 40781 $ */ public class MapTestCase extends AbstractMCTest { protected AbstractMapMetaData getMap() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); Set properties = bean.getProperties(); assertNotNull(properties); assertEquals(1, properties.size()); PropertyMetaData property = (PropertyMetaData) properties.iterator().next(); assertNotNull(property); ValueMetaData value = property.getValue(); assertNotNull(property); assertTrue(value instanceof AbstractMapMetaData); return (AbstractMapMetaData) value; } public void testMap() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertNull(map.getKeyType()); assertNull(map.getValueType()); } public void testMapWithClass() throws Exception { AbstractMapMetaData map = getMap(); assertEquals("MapClass", map.getType()); assertNull(map.getKeyType()); assertNull(map.getValueType()); } public void testMapWithKeyClass() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertEquals("KeyClass", map.getKeyType()); assertNull(map.getValueType()); } public void testMapWithValueClass() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertNull(map.getKeyType()); assertEquals("ValueClass", map.getValueType()); } public void testMapWithValue() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertNull(map.getKeyType()); assertNull(map.getValueType()); assertValue("Key", getKey(map)); assertValue("Value", getValue(map)); } public void testMapWithKeyValueOverrides() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertNull(map.getKeyType()); assertNull(map.getValueType()); assertStringValue(Integer.class.getName(), "4", getKey(map)); assertStringValue(Boolean.class.getName(), "true", getValue(map)); } public void testMapWithInjection() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertNull(map.getKeyType()); assertNull(map.getValueType()); assertInjection(getKey(map)); assertInjection(getValue(map)); } public void testMapWithCollection() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertNull(map.getKeyType()); assertNull(map.getValueType()); assertCollection(getKey(map)); assertCollection(getValue(map)); } public void testMapWithList() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertNull(map.getKeyType()); assertNull(map.getValueType()); assertList(getKey(map)); assertList(getValue(map)); } public void testMapWithSet() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertNull(map.getKeyType()); assertNull(map.getValueType()); assertSet(getKey(map)); assertSet(getValue(map)); } public void testMapWithArray() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertNull(map.getKeyType()); assertNull(map.getValueType()); assertArray(getKey(map)); assertArray(getValue(map)); } public void testMapWithMap() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertNull(map.getKeyType()); assertNull(map.getValueType()); assertMap(getKey(map)); assertMap(getValue(map)); } public void testMapWithNull() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertNull(map.getKeyType()); assertNull(map.getValueType()); assertNullValue(getKey(map)); assertNullValue(getValue(map)); } public void testMapWithThis() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertNull(map.getKeyType()); assertNull(map.getValueType()); assertThis(getKey(map)); assertThis(getValue(map)); } public void testMapWithWildcard() throws Exception { AbstractMapMetaData map = getMap(); assertNull(map.getType()); assertNull(map.getKeyType()); assertNull(map.getValueType()); assertWildcard(getKey(map)); assertWildcard(getValue(map)); } protected ValueMetaData getKey(AbstractMapMetaData map) { assertEquals(1, map.size()); return (ValueMetaData) map.keySet().iterator().next(); } protected ValueMetaData getValue(AbstractMapMetaData map) { assertEquals(1, map.size()); return (ValueMetaData) map.values().iterator().next(); } public static Test suite() { return suite(MapTestCase.class); } public MapTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/ListTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/ListT0000644000175000017500000001302111061473704033055 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractListMetaData; import org.jboss.test.xb.builder.object.mc.support.model.PropertyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ValueMetaData; /** * ListTestCase. * * @author Adrian Brock * @version $Revision: 40781 $ */ public class ListTestCase extends AbstractMCTest { protected AbstractListMetaData getCollection() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); Set properties = bean.getProperties(); assertNotNull(properties); assertEquals(1, properties.size()); PropertyMetaData property = (PropertyMetaData) properties.iterator().next(); assertNotNull(property); ValueMetaData value = property.getValue(); assertNotNull(property); assertTrue(value instanceof AbstractListMetaData); return (AbstractListMetaData) value; } public void testList() throws Exception { AbstractListMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); } public void testListWithClass() throws Exception { AbstractListMetaData collection = getCollection(); assertEquals("CollectionClass", collection.getType()); assertNull(collection.getElementType()); } public void testListWithElementClass() throws Exception { AbstractListMetaData collection = getCollection(); assertNull(collection.getType()); assertEquals("ElementClass", collection.getElementType()); } public void testListWithValue() throws Exception { AbstractListMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertValue("Value", getValue(collection)); } public void testListWithInjection() throws Exception { AbstractListMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertInjection(getValue(collection)); } public void testListWithCollection() throws Exception { AbstractListMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertCollection(getValue(collection)); } public void testListWithList() throws Exception { AbstractListMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertList(getValue(collection)); } public void testListWithSet() throws Exception { AbstractListMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertSet(getValue(collection)); } public void testListWithArray() throws Exception { AbstractListMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertArray(getValue(collection)); } public void testListWithMap() throws Exception { AbstractListMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertMap(getValue(collection)); } public void testListWithNull() throws Exception { AbstractListMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertNullValue(getValue(collection)); } public void testListWithThis() throws Exception { AbstractListMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertThis(getValue(collection)); } public void testListWithWildcard() throws Exception { AbstractListMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertWildcard(getValue(collection)); } protected ValueMetaData getValue(AbstractListMetaData collection) { assertEquals(1, collection.size()); return (ValueMetaData) collection.iterator().next(); } public static Test suite() { return suite(ListTestCase.class); } public ListTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/DeploymentTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Deplo0000644000175000017500000002634611310425750033072 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.List; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.MyObject; import org.jboss.test.xb.builder.object.mc.support.TestBeanMetaDataFactory; import org.jboss.test.xb.builder.object.mc.support.TestBeanMetaDataFactory1; import org.jboss.test.xb.builder.object.mc.support.TestBeanMetaDataFactory2; import org.jboss.test.xb.builder.object.mc.support.model.AbstractArrayMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractKernelDeployment; import org.jboss.test.xb.builder.object.mc.support.model.AbstractValueMetaData; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaDataFactory; import org.jboss.test.xb.builder.object.mc.support.model.PropertyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ValueMetaData; /** * DeploymentTestCase. * * @author Adrian Brock * @version $Revision: 56476 $ */ public class DeploymentTestCase extends AbstractMCTest { public void testDeployment() throws Exception { AbstractKernelDeployment deployment = unmarshalDeployment(); assertNull(deployment.getName()); assertNull(deployment.getClassLoader()); assertNull(deployment.getBeans()); } public void testDeploymentWithName() throws Exception { AbstractKernelDeployment deployment = unmarshalDeployment(); assertEquals("SimpleDeployment", deployment.getName()); assertNull(deployment.getClassLoader()); assertNull(deployment.getBeans()); } public void testDeploymentWithClassLoader() throws Exception { AbstractKernelDeployment deployment = unmarshalDeployment(); assertEquals("SimpleDeployment", deployment.getName()); assertNotNull(deployment.getClassLoader()); assertNull(deployment.getBeans()); } public void testDeploymentWithBean() throws Exception { AbstractKernelDeployment deployment = unmarshalDeployment(); assertEquals("SimpleDeployment", deployment.getName()); assertNull(deployment.getClassLoader()); List beans = deployment.getBeans(); assertNotNull(beans); assertEquals(1, beans.size()); BeanMetaData bean = (BeanMetaData) beans.get(0); assertNotNull(bean); assertEquals("Bean1", bean.getName()); assertEquals(Object.class.getName(), bean.getBean()); } public void testDeploymentWithMultipleBeans() throws Exception { AbstractKernelDeployment deployment = unmarshalDeployment(); assertEquals("SimpleDeployment", deployment.getName()); assertNull(deployment.getClassLoader()); List beans = deployment.getBeans(); assertNotNull(beans); assertEquals(3, beans.size()); BeanMetaData bean = (BeanMetaData) beans.get(0); assertNotNull(bean); assertEquals("Bean1", bean.getName()); assertEquals(Object.class.getName(), bean.getBean()); bean = (BeanMetaData) beans.get(1); assertNotNull(bean); assertEquals("Bean2", bean.getName()); assertEquals(Object.class.getName(), bean.getBean()); bean = (BeanMetaData) beans.get(2); assertNotNull(bean); assertEquals("Bean3", bean.getName()); assertEquals(Object.class.getName(), bean.getBean()); } public void testDeploymentWithBeanFactory() throws Exception { AbstractKernelDeployment deployment = unmarshalDeployment(); assertEquals("SimpleDeployment", deployment.getName()); assertNull(deployment.getClassLoader()); List beans = deployment.getBeans(); assertNotNull(beans); assertEquals(1, beans.size()); BeanMetaData bean = (BeanMetaData) beans.get(0); assertNotNull(bean); assertEquals("Bean1", bean.getName()); assertEquals("GenericBeanFactory", bean.getBean()); } public void testDeploymentWithMultipleBeanFactorys() throws Exception { AbstractKernelDeployment deployment = unmarshalDeployment(); assertEquals("SimpleDeployment", deployment.getName()); assertNull(deployment.getClassLoader()); List beans = deployment.getBeans(); assertNotNull(beans); assertEquals(3, beans.size()); BeanMetaData bean = (BeanMetaData) beans.get(0); assertNotNull(bean); assertEquals("Bean1", bean.getName()); assertEquals("GenericBeanFactory", bean.getBean()); bean = (BeanMetaData) beans.get(1); assertNotNull(bean); assertEquals("Bean2", bean.getName()); assertEquals("GenericBeanFactory", bean.getBean()); bean = (BeanMetaData) beans.get(2); assertNotNull(bean); assertEquals("Bean3", bean.getName()); assertEquals("GenericBeanFactory", bean.getBean()); } public void testDeploymentWithMultipleBeanMetaDataFactorys() throws Exception { AbstractKernelDeployment deployment = unmarshalDeployment(); assertEquals("SimpleDeployment", deployment.getName()); assertNull(deployment.getClassLoader()); List beanFactories = deployment.getBeanFactories(); assertNotNull(beanFactories); assertEquals(3, beanFactories.size()); BeanMetaDataFactory factory = (BeanMetaDataFactory) beanFactories.get(0); assertEquals(TestBeanMetaDataFactory.class.getName(), factory.getClass().getName()); factory = (BeanMetaDataFactory) beanFactories.get(1); assertEquals(TestBeanMetaDataFactory1.class.getName(), factory.getClass().getName()); factory = (BeanMetaDataFactory) beanFactories.get(2); assertEquals(TestBeanMetaDataFactory2.class.getName(), factory.getClass().getName()); List beans = deployment.getBeans(); assertNotNull(beans); assertEquals(6, beans.size()); BeanMetaData bean = (BeanMetaData) beans.get(0); assertNotNull(bean); assertEquals("Bean1", bean.getBean()); bean = (BeanMetaData) beans.get(1); assertNotNull(bean); assertEquals("Bean2", bean.getBean()); bean = (BeanMetaData) beans.get(2); assertNotNull(bean); assertEquals("Bean3", bean.getBean()); bean = (BeanMetaData) beans.get(3); assertNotNull(bean); assertEquals("Bean4", bean.getBean()); bean = (BeanMetaData) beans.get(4); assertNotNull(bean); assertEquals("Bean5", bean.getBean()); bean = (BeanMetaData) beans.get(5); assertNotNull(bean); assertEquals("Bean6", bean.getBean()); } public void testDeploymentWithBeanMetaDataFactory() throws Exception { AbstractKernelDeployment deployment = unmarshalDeployment(); assertEquals("SimpleDeployment", deployment.getName()); assertNull(deployment.getClassLoader()); List beanFactories = deployment.getBeanFactories(); assertNotNull(beanFactories); assertEquals(1, beanFactories.size()); BeanMetaDataFactory factory = (BeanMetaDataFactory) beanFactories.get(0); assertEquals(TestBeanMetaDataFactory.class.getName(), factory.getClass().getName()); List beans = deployment.getBeans(); assertNotNull(beans); assertEquals(2, beans.size()); BeanMetaData bean = (BeanMetaData) beans.get(0); assertNotNull(bean); assertEquals("Bean1", bean.getBean()); bean = (BeanMetaData) beans.get(1); assertNotNull(bean); assertEquals("Bean2", bean.getBean()); } public void testDeploymentWithMixed() throws Exception { AbstractKernelDeployment deployment = unmarshalDeployment(); assertEquals("SimpleDeployment", deployment.getName()); assertNull(deployment.getClassLoader()); List beans = deployment.getBeans(); assertNotNull(beans); assertEquals(8, beans.size()); BeanMetaData bean = (BeanMetaData) beans.get(0); assertNotNull(bean); assertEquals("Bean1", bean.getName()); assertEquals(Object.class.getName(), bean.getBean()); bean = (BeanMetaData) beans.get(1); assertNotNull(bean); assertEquals("Bean2", bean.getName()); assertEquals("GenericBeanFactory", bean.getBean()); bean = (BeanMetaData) beans.get(2); assertNotNull(bean); assertEquals("Bean1", bean.getBean()); bean = (BeanMetaData) beans.get(3); assertNotNull(bean); assertEquals("Bean2", bean.getBean()); bean = (BeanMetaData) beans.get(4); assertNotNull(bean); assertEquals("Bean3", bean.getName()); assertEquals(Object.class.getName(), bean.getBean()); bean = (BeanMetaData) beans.get(5); assertNotNull(bean); assertEquals("Bean4", bean.getName()); assertEquals("GenericBeanFactory", bean.getBean()); bean = (BeanMetaData) beans.get(6); assertNotNull(bean); assertEquals("Bean3", bean.getBean()); bean = (BeanMetaData) beans.get(7); assertNotNull(bean); assertEquals("Bean4", bean.getBean()); } public void testDeploymentWithArrayOfJavaBeans() throws Exception { AbstractKernelDeployment deployment = unmarshalDeployment(); List beans = deployment.getBeans(); assertNotNull(beans); assertEquals(1, beans.size()); BeanMetaData beanMetaData = beans.get(0); assertNotNull(beanMetaData); Set properties = beanMetaData.getProperties(); assertNotNull(properties); assertEquals(1, properties.size()); PropertyMetaData property = properties.iterator().next(); assertNotNull(property); ValueMetaData value = property.getValue(); assertNotNull(value); assertTrue(value instanceof AbstractArrayMetaData); AbstractArrayMetaData array = (AbstractArrayMetaData) value; assertEquals(4, array.size()); String keys[] = new String[]{"object1", "object2", "object2", "object1"}; for(int i = 0; i < keys.length; ++i) { Object o = array.get(i); assertNotNull(o); assertTrue(o instanceof AbstractValueMetaData); AbstractValueMetaData v = (AbstractValueMetaData) o; Object uv = v.getUnderlyingValue(); assertNotNull(uv); assertTrue(uv instanceof MyObject); MyObject mo = (MyObject) uv; assertEquals(keys[i], mo.getKey()); } } public static Test suite() { return suite(DeploymentTestCase.class); } public DeploymentTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/CollectionTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Colle0000644000175000017500000001455311061473704033067 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.Iterator; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractCollectionMetaData; import org.jboss.test.xb.builder.object.mc.support.model.PropertyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ValueMetaData; /** * CollectionTestCase. * * @author Adrian Brock * @version $Revision: 40781 $ */ public class CollectionTestCase extends AbstractMCTest { protected AbstractCollectionMetaData getCollection() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); Set properties = bean.getProperties(); assertNotNull(properties); assertEquals(1, properties.size()); PropertyMetaData property = (PropertyMetaData) properties.iterator().next(); assertNotNull(property); ValueMetaData value = property.getValue(); assertNotNull(property); assertTrue(value instanceof AbstractCollectionMetaData); return (AbstractCollectionMetaData) value; } public void testCollection() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); } public void testCollectionWithClass() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertEquals("CollectionClass", collection.getType()); assertNull(collection.getElementType()); } public void testCollectionWithElementClass() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertNull(collection.getType()); assertEquals("ElementClass", collection.getElementType()); } public void testCollectionWithValue() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertValue("Value", getValue(collection)); } public void testCollectionWithValues() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertValues(collection, "Value1", "Value2", "Value3"); } public void testCollectionWithInjection() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertInjection(getValue(collection)); } public void testCollectionWithCollection() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertCollection(getValue(collection)); } public void testCollectionWithList() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertList(getValue(collection)); } public void testCollectionWithSet() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertSet(getValue(collection)); } public void testCollectionWithArray() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertArray(getValue(collection)); } public void testCollectionWithMap() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertMap(getValue(collection)); } public void testCollectionWithNull() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertNullValue(getValue(collection)); } public void testCollectionWithThis() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertThis(getValue(collection)); } public void testCollectionWithWildcard() throws Exception { AbstractCollectionMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertWildcard(getValue(collection)); } protected ValueMetaData getValue(AbstractCollectionMetaData collection) { assertEquals(1, collection.size()); return (ValueMetaData) collection.iterator().next(); } protected void assertValues(AbstractCollectionMetaData collection, String... values) { assertEquals(values.length, collection.size()); Iterator iterator = collection.iterator(); for (int i = 0; i < values.length; ++i) { assertValue(values[i], (ValueMetaData) iterator.next()); } } public static Test suite() { return suite(CollectionTestCase.class); } public CollectionTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/AnnotationTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Annot0000644000175000017500000000462611061473704033110 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.Annotation1; import org.jboss.test.xb.builder.object.mc.support.model.AbstractAnnotationMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ConstructorMetaData; /** * AnnotationTestCase. * * @author Adrian Brock * @version $Revision: 55527 $ */ public class AnnotationTestCase extends AbstractMCTest { protected AbstractAnnotationMetaData getAnnotation() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); ConstructorMetaData constructor = bean.getConstructor(); assertNotNull(constructor); Set annotations = constructor.getAnnotations(); assertEquals(1, annotations.size()); AbstractAnnotationMetaData annotation = (AbstractAnnotationMetaData) annotations.iterator().next(); assertNotNull(annotation); return annotation; } public void testAnnotationSimple() throws Exception { AbstractAnnotationMetaData annotation = getAnnotation(); assertEquals("@" + Annotation1.class.getName(), annotation.getAnnotation()); } public static Test suite() { return suite(AnnotationTestCase.class); } public AnnotationTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/SupplyTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Suppl0000644000175000017500000000461411061473704033131 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractSupplyMetaData; /** * SupplyTestCase. * * @author Adrian Brock * @version $Revision: 40800 $ */ public class SupplyTestCase extends AbstractMCTest { protected AbstractSupplyMetaData getSupply() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); Set supplies = bean.getSupplies(); assertNotNull(supplies); assertEquals(1, supplies.size()); AbstractSupplyMetaData supply = (AbstractSupplyMetaData) supplies.iterator().next(); assertNotNull(supply); return supply; } public void testSupply() throws Exception { AbstractSupplyMetaData supply = getSupply(); assertEquals("Supply", supply.getSupply()); } /* TODO public void testSupplyBadNoValue() throws Exception { try { unmarshalBean("SupplyBadNoValue.xml"); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ public static Test suite() { return suite(SupplyTestCase.class); } public SupplyTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/PropertyTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Prope0000644000175000017500000001625411061473704033116 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.HashSet; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.Annotation1; import org.jboss.test.xb.builder.object.mc.support.Annotation2; import org.jboss.test.xb.builder.object.mc.support.Annotation3; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.PropertyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.StringValueMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ValueMetaData; /** * PropertyTestCase. * * @author Adrian Brock * @version $Revision: 56471 $ */ public class PropertyTestCase extends AbstractMCTest { protected PropertyMetaData getProperty() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); Set properties = bean.getProperties(); assertNotNull(properties); assertEquals(1, properties.size()); PropertyMetaData property = (PropertyMetaData) properties.iterator().next(); assertNotNull(property); return property; } public void testProperty() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); assertNull(property.getAnnotations()); assertNull(property.getValue()); } public void testPropertyWithBean() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); assertNull(property.getAnnotations()); ValueMetaData value = property.getValue(); assertNotNull(value); assertTrue(value instanceof BeanMetaData); } public void testPropertyWithClass() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); assertNull(property.getAnnotations()); ValueMetaData value = property.getValue(); assertNotNull(value); assertTrue(value instanceof StringValueMetaData); StringValueMetaData string = (StringValueMetaData) value; assertEquals("PropertyClass", string.getType()); } public void testPropertyWithAnnotation() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); assertAnnotations(expected, property.getAnnotations()); assertNull(property.getValue()); } public void testPropertyWithAnnotations() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); expected.add("@" + Annotation2.class.getName()); expected.add("@" + Annotation3.class.getName()); assertAnnotations(expected, property.getAnnotations()); assertNull(property.getValue()); } public void testPropertyWithPlainValue() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); assertNull(property.getAnnotations()); assertPlainValue("PlainValue", property.getValue()); } public void testPropertyWithValue() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); assertNull(property.getAnnotations()); assertValue("Value", property.getValue()); } public void testPropertyWithInjection() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); assertNull(property.getAnnotations()); assertInjection(property.getValue()); } public void testPropertyWithCollection() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); assertNull(property.getAnnotations()); assertCollection(property.getValue()); } public void testPropertyWithList() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); assertNull(property.getAnnotations()); assertList(property.getValue()); } public void testPropertyWithSet() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); assertNull(property.getAnnotations()); assertSet(property.getValue()); } public void testPropertyWithArray() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); assertNull(property.getAnnotations()); assertArray(property.getValue()); } public void testPropertyWithMap() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); assertNull(property.getAnnotations()); assertMap(property.getValue()); } public void testPropertyWithThis() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); assertNull(property.getAnnotations()); assertThis(property.getValue()); } public void testPropertyWithWildcard() throws Exception { PropertyMetaData property = getProperty(); assertNotNull("PropertyName", property.getName()); assertNull(property.getAnnotations()); assertWildcard(property.getValue()); } /* TODO public void testPropertyBadNoName() throws Exception { try { unmarshalBean("PropertyBadNoName.xml"); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ public static Test suite() { return suite(PropertyTestCase.class); } public PropertyTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/XMLTestDelegate.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/XMLTe0000644000175000017500000000537011061473704032757 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import org.jboss.test.AbstractTestDelegate; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory; /** * XMLTestDelegate. * * @author Adrian Brock * @version $Revision: 60393 $ */ public class XMLTestDelegate extends AbstractTestDelegate { /** The unmarshaller factory */ protected UnmarshallerFactory unmarshallerFactory; /** The resolver */ protected SchemaBindingResolver resolver; /** * Create a new XMLTestDelegate. * * @param clazz the test class */ public XMLTestDelegate(Class clazz) { super(clazz); } public void setUp() throws Exception { super.setUp(); unmarshallerFactory = UnmarshallerFactory.newInstance(); resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver(); } /** * Unmarshal an object * * @param url the url * @return the object * @throws Exception for any error */ public Object unmarshal(String url) throws Exception { long start = System.currentTimeMillis(); Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller(); log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms"); try { Object result = unmarshaller.unmarshal(url, resolver); log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms"); return result; } catch (Exception e) { log.debug("Error during parsing: " + url, e); throw e; } } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/ParameterTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Param0000644000175000017500000001474611061473704033075 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.HashSet; import java.util.List; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.Annotation1; import org.jboss.test.xb.builder.object.mc.support.Annotation2; import org.jboss.test.xb.builder.object.mc.support.Annotation3; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ConstructorMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ParameterMetaData; /** * ParameterTestCase. * * @author Adrian Brock * @version $Revision: 56471 $ */ public class ParameterTestCase extends AbstractMCTest { protected ParameterMetaData getParameter() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); ConstructorMetaData constructor = bean.getConstructor(); assertNotNull(constructor); List parameters = constructor.getParameters(); assertNotNull(parameters); assertEquals(1, parameters.size()); ParameterMetaData parameter = (ParameterMetaData) parameters.get(0); assertNotNull(parameter); return parameter; } public void testParameter() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getType()); assertNull(parameter.getAnnotations()); assertNull(parameter.getValue()); } public void testParameterWithBean() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getAnnotations()); assertNotNull(parameter.getValue()); assertTrue(parameter.getValue() instanceof BeanMetaData); } public void testParameterWithClass() throws Exception { ParameterMetaData parameter = getParameter(); assertEquals("ParameterClass", parameter.getType()); assertNull(parameter.getAnnotations()); assertNull(parameter.getValue()); } public void testParameterWithAnnotation() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getType()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); assertAnnotations(expected, parameter.getAnnotations()); assertNull(parameter.getValue()); } public void testParameterWithAnnotations() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getType()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); expected.add("@" + Annotation2.class.getName()); expected.add("@" + Annotation3.class.getName()); assertAnnotations(expected, parameter.getAnnotations()); assertNull(parameter.getValue()); } public void testParameterWithPlainValue() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getType()); assertNull(parameter.getAnnotations()); assertPlainValue("PlainValue", parameter.getValue()); } public void testParameterWithValue() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getType()); assertNull(parameter.getAnnotations()); assertValue("Value", parameter.getValue()); } public void testParameterWithInjection() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getType()); assertNull(parameter.getAnnotations()); assertInjection(parameter.getValue()); } public void testParameterWithCollection() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getType()); assertNull(parameter.getAnnotations()); assertCollection(parameter.getValue()); } public void testParameterWithList() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getType()); assertNull(parameter.getAnnotations()); assertList(parameter.getValue()); } public void testParameterWithSet() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getType()); assertNull(parameter.getAnnotations()); assertSet(parameter.getValue()); } public void testParameterWithArray() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getType()); assertNull(parameter.getAnnotations()); assertArray(parameter.getValue()); } public void testParameterWithMap() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getType()); assertNull(parameter.getAnnotations()); assertMap(parameter.getValue()); } public void testParameterWithThis() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getType()); assertNull(parameter.getAnnotations()); assertThis(parameter.getValue()); } public void testParameterWithWildcard() throws Exception { ParameterMetaData parameter = getParameter(); assertNull(parameter.getType()); assertNull(parameter.getAnnotations()); assertWildcard(parameter.getValue()); } public static Test suite() { return suite(ParameterTestCase.class); } public ParameterTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/LifecycleTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Lifec0000644000175000017500000001072310763275165033057 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.ArrayList; import java.util.HashSet; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.Annotation1; import org.jboss.test.xb.builder.object.mc.support.Annotation2; import org.jboss.test.xb.builder.object.mc.support.Annotation3; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.LifecycleMetaData; /** * LifecycleTestCase. * * @author Adrian Brock * @version $Revision: 63037 $ */ public class LifecycleTestCase extends AbstractMCTest { protected LifecycleMetaData getLifecycle() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); LifecycleMetaData lifecycle = bean.getCreate(); assertNotNull(lifecycle); return lifecycle; } public void testLifecycle() throws Exception { LifecycleMetaData lifecycle = getLifecycle(); assertNull(lifecycle.getMethodName()); assertNull(lifecycle.getAnnotations()); assertNull(lifecycle.getParameters()); } public void testLifecycleWithMethod() throws Exception { LifecycleMetaData lifecycle = getLifecycle(); assertEquals("Method", lifecycle.getMethodName()); assertNull(lifecycle.getAnnotations()); assertNull(lifecycle.getParameters()); } public void testLifecycleWithIgnored() throws Exception { LifecycleMetaData lifecycle = getLifecycle(); assertTrue(lifecycle.isIgnored()); assertNull(lifecycle.getMethodName()); assertNull(lifecycle.getAnnotations()); assertNull(lifecycle.getParameters()); } public void testLifecycleWithAnnotation() throws Exception { LifecycleMetaData lifecycle = getLifecycle(); assertNull(lifecycle.getMethodName()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); assertAnnotations(expected, lifecycle.getAnnotations()); assertNull(lifecycle.getParameters()); } public void testLifecycleWithAnnotations() throws Exception { LifecycleMetaData lifecycle = getLifecycle(); assertNull(lifecycle.getMethodName()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); expected.add("@" + Annotation2.class.getName()); expected.add("@" + Annotation3.class.getName()); assertAnnotations(expected, lifecycle.getAnnotations()); assertNull(lifecycle.getParameters()); } public void testLifecycleWithParameter() throws Exception { LifecycleMetaData lifecycle = getLifecycle(); assertNull(lifecycle.getMethodName()); assertNull(lifecycle.getAnnotations()); ArrayList expected = new ArrayList(); expected.add("Parameter1"); assertParameters(expected, lifecycle.getParameters()); } public void testLifecycleWithParameters() throws Exception { LifecycleMetaData lifecycle = getLifecycle(); assertNull(lifecycle.getMethodName()); assertNull(lifecycle.getAnnotations()); ArrayList expected = new ArrayList(); expected.add("Parameter1"); expected.add("Parameter2"); expected.add("Parameter3"); assertParameters(expected, lifecycle.getParameters()); } public static Test suite() { return suite(LifecycleTestCase.class); } public LifecycleTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/AliasTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Alias0000644000175000017500000000703211061473704033054 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.factory.GenericBeanFactoryMetaData; /** * AliasTestCase. * * @author Ales Justin */ public class AliasTestCase extends AbstractMCTest { public AliasTestCase(String name) { super(name); } public static Test suite() { return suite(AliasTestCase.class); } protected Object getAlias() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); Set aliases = bean.getAliases(); assertNotNull(aliases); assertEquals(1, aliases.size()); Object alias = aliases.iterator().next(); assertNotNull(alias); return alias; } public void testAlias() throws Exception { Object alias = getAlias(); assertEquals("SimpleAlias", alias); } /* TODO public void testAliasWithClass() throws Exception { Object alias = getAlias(); assertEquals(12345, alias); } */ /* TODO public void testAliasWithReplace() throws Exception { SecurityManager sm = suspendSecurity(); try { System.setProperty("alias.test.name", "SimpleAlias"); Object alias = getAlias("AliasWithReplace.xml"); assertEquals("XSimpleAliasX", alias); } finally { resumeSecurity(sm); } } */ /* TODO public void testAliasWithNoReplace() throws Exception { SecurityManager sm = suspendSecurity(); try { System.setProperty("alias.test.name", "SimpleAlias"); Object alias = getAlias("AliasWithNoReplace.xml"); assertEquals("X${alias.test.name}X", alias); } finally { resumeSecurity(sm); } } */ public void testMultipleAlias() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); Set aliases = bean.getAliases(); assertNotNull(aliases); int size = aliases.size(); assertTrue(size > 1); for(Object alias : aliases) assertNotNull(alias); } public void testAliasWithBeanFactory() throws Exception { GenericBeanFactoryMetaData bean = unmarshalBeanFactory(); Set aliases = bean.getAliases(); assertNotNull(aliases); assertFalse(aliases.isEmpty()); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/InstallTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Insta0000644000175000017500000001330011061473704033074 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.Annotation1; import org.jboss.test.xb.builder.object.mc.support.Annotation2; import org.jboss.test.xb.builder.object.mc.support.Annotation3; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ControllerState; import org.jboss.test.xb.builder.object.mc.support.model.InstallMetaData; /** * InstallTestCase. * * @author Adrian Brock * @version $Revision: 46386 $ */ public class InstallTestCase extends AbstractMCTest { protected InstallMetaData getInstall() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); List installs = bean.getInstalls(); assertNotNull(installs); assertEquals(1, installs.size()); InstallMetaData install = (InstallMetaData) installs.get(0); assertNotNull(install); return install; } public void testInstallWithBean() throws Exception { InstallMetaData install = getInstall(); assertEquals("Bean", install.getBean()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); assertNull(install.getAnnotations()); assertNull(install.getParameters()); } public void testInstallWithState() throws Exception { InstallMetaData install = getInstall(); assertNull(install.getBean()); assertEquals(ControllerState.CONFIGURED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); assertNull(install.getAnnotations()); assertNull(install.getParameters()); } public void testInstallWithMethod() throws Exception { InstallMetaData install = getInstall(); assertNull(install.getBean()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Method", install.getMethodName()); assertNull(install.getAnnotations()); assertNull(install.getParameters()); } public void testInstallWithAnnotation() throws Exception { InstallMetaData install = getInstall(); assertNull(install.getBean()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); assertAnnotations(expected, install.getAnnotations()); assertNull(install.getParameters()); } public void testInstallWithAnnotations() throws Exception { InstallMetaData install = getInstall(); assertNull(install.getBean()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); expected.add("@" + Annotation2.class.getName()); expected.add("@" + Annotation3.class.getName()); assertAnnotations(expected, install.getAnnotations()); assertNull(install.getParameters()); } public void testInstallWithParameter() throws Exception { InstallMetaData install = getInstall(); assertNull(install.getBean()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); assertNull(install.getAnnotations()); ArrayList expected = new ArrayList(); expected.add("Parameter1"); assertParameters(expected, install.getParameters()); } public void testInstallWithParameters() throws Exception { InstallMetaData install = getInstall(); assertNull(install.getBean()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); assertNull(install.getAnnotations()); ArrayList expected = new ArrayList(); expected.add("Parameter1"); expected.add("Parameter2"); expected.add("Parameter3"); assertParameters(expected, install.getParameters()); } /* TODO public void testInstallBadNoMethod() throws Exception { try { unmarshalBean("InstallBadNoMethod.xml"); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ public static Test suite() { return suite(InstallTestCase.class); } public InstallTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/DependencyTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Depen0000644000175000017500000000511210625561630033054 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractDependencyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.DependencyMetaData; /** * DependencyTestCase. * * @author Adrian Brock * @version $Revision: 55527 $ */ public class DependencyTestCase extends AbstractMCTest { protected AbstractDependencyMetaData getDependency() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); Set dependencies = bean.getDepends(); assertNotNull(dependencies); assertEquals(1, dependencies.size()); AbstractDependencyMetaData dependency = (AbstractDependencyMetaData) dependencies.iterator().next(); assertNotNull(dependency); return dependency; } public void testDependency() throws Exception { AbstractDependencyMetaData dependency = getDependency(); assertEquals("Dependency", dependency.getDependency()); } /* TODO public void testDependencyBadNoValue() throws Exception { try { unmarshalBean("DependencyBadNoValue.xml"); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ public static Test suite() { return suite(DependencyTestCase.class); } public DependencyTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/BeanTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/BeanT0000644000175000017500000006355610763275165033042 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.ArrayList; import java.util.HashSet; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.Annotation1; import org.jboss.test.xb.builder.object.mc.support.Annotation2; import org.jboss.test.xb.builder.object.mc.support.Annotation3; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ControllerMode; /** * BeanTestCase. * * @author Adrian Brock * @version $Revision: 62474 $ */ public class BeanTestCase extends AbstractMCTest { public void testBeanWithName() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertEquals("Name1", bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithClass() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals(Object.class.getName(), bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithMode() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertEquals(ControllerMode.MANUAL, bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithAnnotation() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); assertAnnotations(expected, bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithAnnotations() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); expected.add("@" + Annotation2.class.getName()); expected.add("@" + Annotation3.class.getName()); assertAnnotations(expected, bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithClassLoader() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNotNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithConstructor() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNotNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithProperty() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); HashSet expected = new HashSet(); expected.add("Property1"); assertProperties(expected, bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithProperties() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); HashSet expected = new HashSet(); expected.add("Property1"); expected.add("Property2"); expected.add("Property3"); assertProperties(expected, bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithCreate() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNotNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithStart() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNotNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithStop() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNotNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithDestroy() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNotNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithDependency() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); HashSet expected = new HashSet(); expected.add("Depends1"); assertDepends(expected, bean.getDepends()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithDependencies() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); HashSet expected = new HashSet(); expected.add("Depends1"); expected.add("Depends2"); expected.add("Depends3"); assertDepends(expected, bean.getDepends()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithDemand() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); HashSet expected = new HashSet(); expected.add("Demand1"); assertDemands(expected, bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithDemands() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); HashSet expected = new HashSet(); expected.add("Demand1"); expected.add("Demand2"); expected.add("Demand3"); assertDemands(expected, bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithSupply() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); HashSet expected = new HashSet(); expected.add("Supply1"); assertSupplies(expected, bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithSupplies() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); HashSet expected = new HashSet(); expected.add("Supply1"); expected.add("Supply2"); expected.add("Supply3"); assertSupplies(expected, bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithInstall() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); ArrayList expected = new ArrayList(); expected.add("Install1"); assertInstalls(expected, bean.getInstalls()); assertNull(bean.getUninstalls()); } public void testBeanWithInstalls() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); ArrayList expected = new ArrayList(); expected.add("Install1"); expected.add("Install2"); expected.add("Install3"); assertInstalls(expected, bean.getInstalls()); assertNull(bean.getUninstalls()); } public void testBeanWithUninstall() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); ArrayList expected = new ArrayList(); expected.add("Uninstall1"); assertInstalls(expected, bean.getUninstalls()); } public void testBeanWithUninstalls() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); ArrayList expected = new ArrayList(); expected.add("Uninstall1"); expected.add("Uninstall2"); expected.add("Uninstall3"); assertInstalls(expected, bean.getUninstalls()); } public void testBeanWithInstallCallback() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); ArrayList expected = new ArrayList(); expected.add("Install1"); assertCallbacks(expected, bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithInstallCallbacks() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); ArrayList expected = new ArrayList(); expected.add("Install1"); expected.add("Install2"); expected.add("Install3"); assertCallbacks(expected, bean.getInstallCallbacks()); assertNull(bean.getUninstallCallbacks()); } public void testBeanWithUninstallCallback() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); ArrayList expected = new ArrayList(); expected.add("Uninstall1"); assertCallbacks(expected, bean.getUninstallCallbacks()); } public void testBeanWithUninstallCallbacks() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); assertNull(bean.getName()); assertEquals("Dummy", bean.getBean()); assertNull(bean.getMode()); assertNull(bean.getAnnotations()); assertNull(bean.getClassLoader()); assertNull(bean.getConstructor()); assertNull(bean.getProperties()); assertNull(bean.getCreate()); assertNull(bean.getStart()); assertNull(bean.getStop()); assertNull(bean.getDestroy()); assertNull(bean.getDemands()); assertNull(bean.getSupplies()); assertNull(bean.getInstalls()); assertNull(bean.getUninstalls()); assertNull(bean.getInstallCallbacks()); ArrayList expected = new ArrayList(); expected.add("Uninstall1"); expected.add("Uninstall2"); expected.add("Uninstall3"); assertCallbacks(expected, bean.getUninstallCallbacks()); } /* TODO public void testBeanBadNoClassOrConstructor() throws Exception { try { unmarshalBean(); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ /* TODO public void testBeanBadNoClassOrFactoryMethod() throws Exception { try { unmarshalBean(); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ /* TODO public void testBeanBadNoClassOrFactory() throws Exception { try { unmarshalBean(); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ public static Test suite() { return suite(BeanTestCase.class); } public BeanTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/ArrayTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Array0000644000175000017500000001306711061473704033106 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.AbstractArrayMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.PropertyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ValueMetaData; /** * ArrayTestCase. * * @author Adrian Brock * @version $Revision: 40781 $ */ public class ArrayTestCase extends AbstractMCTest { protected AbstractArrayMetaData getCollection() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); Set properties = bean.getProperties(); assertNotNull(properties); assertEquals(1, properties.size()); PropertyMetaData property = (PropertyMetaData) properties.iterator().next(); assertNotNull(property); ValueMetaData value = property.getValue(); assertNotNull(property); assertTrue(value instanceof AbstractArrayMetaData); return (AbstractArrayMetaData) value; } public void testArray() throws Exception { AbstractArrayMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); } public void testArrayWithClass() throws Exception { AbstractArrayMetaData collection = getCollection(); assertEquals("CollectionClass", collection.getType()); assertNull(collection.getElementType()); } public void testArrayWithElementClass() throws Exception { AbstractArrayMetaData collection = getCollection(); assertNull(collection.getType()); assertEquals("ElementClass", collection.getElementType()); } public void testArrayWithValue() throws Exception { AbstractArrayMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertValue("Value", getValue(collection)); } public void testArrayWithInjection() throws Exception { AbstractArrayMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertInjection(getValue(collection)); } public void testArrayWithCollection() throws Exception { AbstractArrayMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertCollection(getValue(collection)); } public void testArrayWithList() throws Exception { AbstractArrayMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertList(getValue(collection)); } public void testArrayWithSet() throws Exception { AbstractArrayMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertSet(getValue(collection)); } public void testArrayWithArray() throws Exception { AbstractArrayMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertArray(getValue(collection)); } public void testArrayWithMap() throws Exception { AbstractArrayMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertMap(getValue(collection)); } public void testArrayWithNull() throws Exception { AbstractArrayMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertNullValue(getValue(collection)); } public void testArrayWithThis() throws Exception { AbstractArrayMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertThis(getValue(collection)); } public void testArrayWithWildcard() throws Exception { AbstractArrayMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertWildcard(getValue(collection)); } protected ValueMetaData getValue(AbstractArrayMetaData collection) { assertEquals(1, collection.size()); return (ValueMetaData) collection.iterator().next(); } public static Test suite() { return suite(ArrayTestCase.class); } public ArrayTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/ClassLoaderTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Class0000644000175000017500000000575410625561630033102 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.AbstractKernelDeployment; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ClassLoaderMetaData; /** * ClassLoaderTestCase. * * @author Adrian Brock * @version $Revision: 56471 $ */ public class ClassLoaderTestCase extends AbstractMCTest { protected ClassLoaderMetaData getClassLoader() throws Exception { AbstractKernelDeployment deployment = unmarshalDeployment(); ClassLoaderMetaData classLoader = deployment.getClassLoader(); assertNotNull(classLoader); return classLoader; } public void testClassLoaderWithBean() throws Exception { ClassLoaderMetaData classLoader = getClassLoader(); assertNotNull(classLoader.getClassLoader()); assertTrue(classLoader.getClassLoader() instanceof BeanMetaData); } public void testClassLoaderWithInject() throws Exception { ClassLoaderMetaData classLoader = getClassLoader(); assertInjection(classLoader.getClassLoader()); } public void testClassLoaderWithNull() throws Exception { ClassLoaderMetaData classLoader = getClassLoader(); assertNullValue(classLoader.getClassLoader()); } public void testClassLoaderWithWildcard() throws Exception { ClassLoaderMetaData classLoader = getClassLoader(); assertWildcard(classLoader.getClassLoader()); } /* TODO public void testClassLoaderBadNoValue() throws Exception { try { unmarshalDeployment("ClassLoaderBadNoValue.xml"); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ public static Test suite() { return suite(ClassLoaderTestCase.class); } public ClassLoaderTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/SetTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/SetTe0000644000175000017500000001276111061473704033054 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractSetMetaData; import org.jboss.test.xb.builder.object.mc.support.model.PropertyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ValueMetaData; /** * SetTestCase. * * @author Adrian Brock * @version $Revision: 40781 $ */ public class SetTestCase extends AbstractMCTest { protected AbstractSetMetaData getCollection() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); Set properties = bean.getProperties(); assertNotNull(properties); assertEquals(1, properties.size()); PropertyMetaData property = (PropertyMetaData) properties.iterator().next(); assertNotNull(property); ValueMetaData value = property.getValue(); assertNotNull(property); assertTrue(value instanceof AbstractSetMetaData); return (AbstractSetMetaData) value; } public void testSet() throws Exception { AbstractSetMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); } public void testSetWithClass() throws Exception { AbstractSetMetaData collection = getCollection(); assertEquals("CollectionClass", collection.getType()); assertNull(collection.getElementType()); } public void testSetWithElementClass() throws Exception { AbstractSetMetaData collection = getCollection(); assertNull(collection.getType()); assertEquals("ElementClass", collection.getElementType()); } public void testSetWithValue() throws Exception { AbstractSetMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertValue("Value", getValue(collection)); } public void testSetWithInjection() throws Exception { AbstractSetMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertInjection(getValue(collection)); } public void testSetWithCollection() throws Exception { AbstractSetMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertCollection(getValue(collection)); } public void testSetWithList() throws Exception { AbstractSetMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertList(getValue(collection)); } public void testSetWithSet() throws Exception { AbstractSetMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertSet(getValue(collection)); } public void testSetWithArray() throws Exception { AbstractSetMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertArray(getValue(collection)); } public void testSetWithMap() throws Exception { AbstractSetMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertMap(getValue(collection)); } public void testSetWithNull() throws Exception { AbstractSetMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertNullValue(getValue(collection)); } public void testSetWithThis() throws Exception { AbstractSetMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertThis(getValue(collection)); } public void testSetWithWildcard() throws Exception { AbstractSetMetaData collection = getCollection(); assertNull(collection.getType()); assertNull(collection.getElementType()); assertWildcard(getValue(collection)); } protected ValueMetaData getValue(AbstractSetMetaData collection) { assertEquals(1, collection.size()); return (ValueMetaData) collection.iterator().next(); } public static Test suite() { return suite(SetTestCase.class); } public SetTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/CallbackTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Callb0000644000175000017500000002356410763275165033061 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.HashSet; import java.util.List; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.Annotation1; import org.jboss.test.xb.builder.object.mc.support.Annotation2; import org.jboss.test.xb.builder.object.mc.support.Annotation3; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.CallbackMetaData; import org.jboss.test.xb.builder.object.mc.support.model.Cardinality; import org.jboss.test.xb.builder.object.mc.support.model.ControllerState; /** * CallbackTestCase. * * @author Ales Justin */ public class CallbackTestCase extends AbstractMCTest { public CallbackTestCase(String name) { super(name); } public static Test suite() { return suite(CallbackTestCase.class); } protected CallbackMetaData getInstallCallback() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); List callbacks = bean.getInstallCallbacks(); assertNotNull(callbacks); assertEquals(1, callbacks.size()); CallbackMetaData callback = callbacks.get(0); assertNotNull(callback); return callback; } protected CallbackMetaData getUninstallCallback() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); List callbacks = bean.getUninstallCallbacks(); assertNotNull(callbacks); assertEquals(1, callbacks.size()); CallbackMetaData callback = callbacks.get(0); assertNotNull(callback); return callback; } public void testCallbackInstallWithProperty() throws Exception { CallbackMetaData install = getInstallCallback(); assertEquals("someProperty", install.getProperty()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertNull(install.getAnnotations()); assertNull(install.getParameters()); } public void testCallbackInstallWithMethod() throws Exception { CallbackMetaData install = getInstallCallback(); assertNull(install.getProperty()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("someMethod", install.getMethodName()); assertNull(install.getAnnotations()); assertNull(install.getParameters()); } public void testCallbackInstallWithState() throws Exception { CallbackMetaData install = getInstallCallback(); assertNull(install.getProperty()); assertEquals(ControllerState.CONFIGURED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); assertNull(install.getAnnotations()); assertNull(install.getParameters()); } public void testCallbackInstallWithAnnotation() throws Exception { CallbackMetaData install = getInstallCallback(); assertNull(install.getProperty()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); assertAnnotations(expected, install.getAnnotations()); assertNull(install.getParameters()); } public void testCallbackInstallWithAnnotations() throws Exception { CallbackMetaData install = getInstallCallback(); assertNull(install.getProperty()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); expected.add("@" + Annotation2.class.getName()); expected.add("@" + Annotation3.class.getName()); assertAnnotations(expected, install.getAnnotations()); assertNull(install.getParameters()); } public void testCallbackInstallWithSignature() throws Exception { CallbackMetaData install = getInstallCallback(); assertNull(install.getProperty()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); assertNull(install.getAnnotations()); assertNotNull(install.getSignature()); assertEquals("someSignature", install.getSignature()); } public void testCallbackInstallWithCardinality() throws Exception { CallbackMetaData install = getInstallCallback(); assertNull(install.getProperty()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); assertNull(install.getAnnotations()); assertNotNull(install.getCardinality()); assertEquals(install.getCardinality(), Cardinality.ONE_TO_MANY); } /* TODO public void testInstallBothMethodProperty() throws Exception { try { unmarshalBean("CallbackInstallBadMethodProperty.xml"); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ // --- Uninstall public void testCallbackUninstallWithProperty() throws Exception { CallbackMetaData install = getUninstallCallback(); assertEquals("someProperty", install.getProperty()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertNull(install.getAnnotations()); assertNull(install.getParameters()); } public void testCallbackUninstallWithMethod() throws Exception { CallbackMetaData install = getUninstallCallback(); assertNull(install.getProperty()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("someMethod", install.getMethodName()); assertNull(install.getAnnotations()); assertNull(install.getParameters()); } public void testCallbackUninstallWithState() throws Exception { CallbackMetaData install = getUninstallCallback(); assertNull(install.getProperty()); assertEquals(ControllerState.CONFIGURED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); assertNull(install.getAnnotations()); assertNull(install.getParameters()); } public void testCallbackUninstallWithAnnotation() throws Exception { CallbackMetaData install = getUninstallCallback(); assertNull(install.getProperty()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); assertAnnotations(expected, install.getAnnotations()); assertNull(install.getParameters()); } public void testCallbackUninstallWithAnnotations() throws Exception { CallbackMetaData install = getUninstallCallback(); assertNull(install.getProperty()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); HashSet expected = new HashSet(); expected.add("@" + Annotation1.class.getName()); expected.add("@" + Annotation2.class.getName()); expected.add("@" + Annotation3.class.getName()); assertAnnotations(expected, install.getAnnotations()); assertNull(install.getParameters()); } public void testCallbackUninstallWithSignature() throws Exception { CallbackMetaData install = getUninstallCallback(); assertNull(install.getProperty()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); assertNull(install.getAnnotations()); assertNotNull(install.getSignature()); assertEquals("someSignature", install.getSignature()); } public void testCallbackUninstallWithCardinality() throws Exception { CallbackMetaData install = getUninstallCallback(); assertNull(install.getProperty()); assertEquals(ControllerState.INSTALLED, install.getDependentState()); assertEquals("Dummy", install.getMethodName()); assertNull(install.getAnnotations()); assertNotNull(install.getCardinality()); assertEquals(install.getCardinality(), Cardinality.fromString("2..10")); } /* TODO public void testUninstallBothMethodProperty() throws Exception { try { unmarshalBean("CallbackUninstallBadMethodProperty.xml"); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/FactoryTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Facto0000644000175000017500000000742010625561630033061 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractDependencyValueMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractValueMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ConstructorMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ControllerState; import org.jboss.test.xb.builder.object.mc.support.model.ValueMetaData; /** * FactoryTestCase. * * @author Adrian Brock * @version $Revision: 40798 $ */ public class FactoryTestCase extends AbstractMCTest { protected AbstractValueMetaData getFactory() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); ConstructorMetaData constructor = bean.getConstructor(); assertNotNull(constructor); ValueMetaData factory = constructor.getFactory(); assertNotNull(factory); assertTrue(factory instanceof AbstractValueMetaData); return (AbstractValueMetaData) factory; } protected AbstractDependencyValueMetaData getFactoryDependency() throws Exception { return (AbstractDependencyValueMetaData) getFactory(); } public void testFactoryWithBean() throws Exception { AbstractDependencyValueMetaData dependency = getFactoryDependency(); assertEquals("Bean1", dependency.getValue()); assertNull(dependency.getProperty()); assertEquals(ControllerState.INSTALLED, dependency.getDependentState()); } public void testFactoryWithProperty() throws Exception { AbstractDependencyValueMetaData dependency = getFactoryDependency(); assertEquals("Dummy", dependency.getValue()); assertEquals("Property1", dependency.getProperty()); assertEquals(ControllerState.INSTALLED, dependency.getDependentState()); } public void testFactoryWithState() throws Exception { AbstractDependencyValueMetaData dependency = getFactoryDependency(); assertEquals("Dummy", dependency.getValue()); assertNull(dependency.getProperty()); assertEquals(ControllerState.CONFIGURED, dependency.getDependentState()); } public void testFactoryWithWildcard() throws Exception { assertWildcard(getFactory()); } /* TODO public void testFactoryBadNoBeanOrWildcard() throws Exception { try { unmarshalBean("FactoryBadNoBeanOrWildcard.xml"); fail("Should not be here"); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ public static Test suite() { return suite(FactoryTestCase.class); } public FactoryTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/InjectionTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/Injec0000644000175000017500000000723311061473704033056 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.Set; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractDependencyValueMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ControllerState; import org.jboss.test.xb.builder.object.mc.support.model.PropertyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ValueMetaData; /** * InjectionTestCase. * * @author Adrian Brock * @version $Revision: 57133 $ */ public class InjectionTestCase extends AbstractMCTest { protected AbstractDependencyValueMetaData getInjection() throws Exception { AbstractBeanMetaData bean = unmarshalBean(); Set properties = bean.getProperties(); assertNotNull(properties); assertEquals(1, properties.size()); PropertyMetaData property = (PropertyMetaData) properties.iterator().next(); assertNotNull(property); ValueMetaData value = property.getValue(); assertNotNull(property); assertTrue(value instanceof AbstractDependencyValueMetaData); return (AbstractDependencyValueMetaData) value; } public void testInjectionWithBean() throws Exception { AbstractDependencyValueMetaData dependency = getInjection(); assertEquals("Bean1", dependency.getValue()); assertNull(dependency.getProperty()); assertEquals(ControllerState.INSTALLED, dependency.getDependentState()); } public void testInjectionWithProperty() throws Exception { AbstractDependencyValueMetaData dependency = getInjection(); assertEquals("Dummy", dependency.getValue()); assertEquals("Property1", dependency.getProperty()); assertEquals(ControllerState.INSTALLED, dependency.getDependentState()); } public void testInjectionWithState() throws Exception { AbstractDependencyValueMetaData dependency = getInjection(); assertEquals("Dummy", dependency.getValue()); assertNull(dependency.getProperty()); assertEquals(ControllerState.CONFIGURED, dependency.getDependentState()); } /* TODO public void testInjectionBadNoBean() throws Exception { try { AbstractDependencyValueMetaData dependency = getInjection("InjectionBadNoBean.xml"); assertNull(dependency.getValue()); } catch (Exception expected) { checkJBossXBException(IllegalArgumentException.class, expected); } } */ public static Test suite() { return suite(InjectionTestCase.class); } public InjectionTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/BeanFactoryTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/test/BeanF0000644000175000017500000005446510625561630033013 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.test; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import junit.framework.Test; import org.jboss.test.xb.builder.object.mc.support.model.ControllerMode; import org.jboss.test.xb.builder.object.mc.support.model.factory.GenericBeanFactoryMetaData; /** * BeanFactoryTestCase * * @author Adrian Brock * @version $Revision: 62474 $ */ public class BeanFactoryTestCase extends AbstractMCTest { public void testBeanFactoryWithName() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertEquals("Name1", factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithClass() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals(Object.class.getName(), factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithMode() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertEquals(ControllerMode.MANUAL, factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithClassLoader() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNotNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithConstructor() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNotNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithProperty() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNotNull(factory.getProperties()); HashSet expected = new HashSet(); expected.add("Property1"); assertProperties(expected, factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithProperties() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNotNull(factory.getProperties()); HashSet expected = new HashSet(); expected.add("Property1"); expected.add("Property2"); expected.add("Property3"); assertProperties(expected, factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithCreate() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNotNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithStart() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNotNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithDependency() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); HashSet expected = new HashSet(); expected.add("Depends1"); assertDepends(expected, factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithDependencies() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); HashSet expected = new HashSet(); expected.add("Depends1"); expected.add("Depends2"); expected.add("Depends3"); assertDepends(expected, factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithDemand() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); HashSet expected = new HashSet(); expected.add("Demand1"); assertDemands(expected, factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithDemands() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); HashSet expected = new HashSet(); expected.add("Demand1"); expected.add("Demand2"); expected.add("Demand3"); assertDemands(expected, factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithSupply() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); HashSet expected = new HashSet(); expected.add("Supply1"); assertSupplies(expected, factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithSupplies() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); HashSet expected = new HashSet(); expected.add("Supply1"); expected.add("Supply2"); expected.add("Supply3"); assertSupplies(expected, factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithInstall() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); List expected = new ArrayList(); expected.add("Install1"); assertInstalls(expected, factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithInstalls() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); List expected = new ArrayList(); expected.add("Install1"); expected.add("Install2"); expected.add("Install3"); assertInstalls(expected, factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithUninstall() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); List expected = new ArrayList(); expected.add("Uninstall1"); assertInstalls(expected, factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithUninstalls() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); List expected = new ArrayList(); expected.add("Uninstall1"); expected.add("Uninstall2"); expected.add("Uninstall3"); assertInstalls(expected, factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithInstallCallback() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); List expected = new ArrayList(); expected.add("Install1"); assertCallbacks(expected, factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithInstallCallbacks() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); List expected = new ArrayList(); expected.add("Install1"); expected.add("Install2"); expected.add("Install3"); assertCallbacks(expected, factory.getInstallCallbacks()); assertNull(factory.getUninstallCallbacks()); } public void testBeanFactoryWithUninstallCallback() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); List expected = new ArrayList(); expected.add("Uninstall1"); assertCallbacks(expected, factory.getUninstallCallbacks()); } public void testBeanFactoryWithUninstallCallbacks() throws Exception { GenericBeanFactoryMetaData factory = unmarshalBeanFactory(); assertNull(factory.getName()); assertEquals("Dummy", factory.getBean()); assertNull(factory.getMode()); assertNull(factory.getAnnotations()); assertNull(factory.getClassLoader()); assertNull(factory.getConstructor()); assertNull(factory.getProperties()); assertNull(factory.getCreate()); assertNull(factory.getStart()); assertNull(factory.getDepends()); assertNull(factory.getDemands()); assertNull(factory.getSupplies()); assertNull(factory.getInstalls()); assertNull(factory.getUninstalls()); assertNull(factory.getInstallCallbacks()); List expected = new ArrayList(); expected.add("Uninstall1"); expected.add("Uninstall2"); expected.add("Uninstall3"); assertCallbacks(expected, factory.getUninstallCallbacks()); } public static Test suite() { return suite(BeanFactoryTestCase.class); } public BeanFactoryTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/ObjectMCTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/ObjectMCTe0000644000175000017500000000775410625561630032777 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.mc.test.AliasTestCase; import org.jboss.test.xb.builder.object.mc.test.AnnotationTestCase; import org.jboss.test.xb.builder.object.mc.test.ArrayTestCase; import org.jboss.test.xb.builder.object.mc.test.BeanFactoryTestCase; import org.jboss.test.xb.builder.object.mc.test.BeanTestCase; import org.jboss.test.xb.builder.object.mc.test.CallbackTestCase; import org.jboss.test.xb.builder.object.mc.test.ClassLoaderTestCase; import org.jboss.test.xb.builder.object.mc.test.CollectionTestCase; import org.jboss.test.xb.builder.object.mc.test.ConstructorTestCase; import org.jboss.test.xb.builder.object.mc.test.DemandTestCase; import org.jboss.test.xb.builder.object.mc.test.DependencyTestCase; import org.jboss.test.xb.builder.object.mc.test.DeploymentTestCase; import org.jboss.test.xb.builder.object.mc.test.FactoryTestCase; import org.jboss.test.xb.builder.object.mc.test.InjectionTestCase; import org.jboss.test.xb.builder.object.mc.test.InstallTestCase; import org.jboss.test.xb.builder.object.mc.test.LifecycleTestCase; import org.jboss.test.xb.builder.object.mc.test.ListTestCase; import org.jboss.test.xb.builder.object.mc.test.MapTestCase; import org.jboss.test.xb.builder.object.mc.test.ParameterTestCase; import org.jboss.test.xb.builder.object.mc.test.PropertyTestCase; import org.jboss.test.xb.builder.object.mc.test.SetTestCase; import org.jboss.test.xb.builder.object.mc.test.SupplyTestCase; import org.jboss.test.xb.builder.object.mc.test.ValueTestCase; /** * MC Test Suite. * * @author Adrian Brock * @version $Revision: 62474 $ */ public class ObjectMCTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("MC Tests"); suite.addTest(DeploymentTestCase.suite()); suite.addTest(BeanTestCase.suite()); suite.addTest(BeanFactoryTestCase.suite()); suite.addTest(ClassLoaderTestCase.suite()); suite.addTest(ConstructorTestCase.suite()); suite.addTest(FactoryTestCase.suite()); suite.addTest(ParameterTestCase.suite()); suite.addTest(PropertyTestCase.suite()); suite.addTest(LifecycleTestCase.suite()); suite.addTest(DependencyTestCase.suite()); suite.addTest(DemandTestCase.suite()); suite.addTest(SupplyTestCase.suite()); suite.addTest(InstallTestCase.suite()); suite.addTest(ValueTestCase.suite()); suite.addTest(InjectionTestCase.suite()); suite.addTest(CollectionTestCase.suite()); suite.addTest(ListTestCase.suite()); suite.addTest(SetTestCase.suite()); suite.addTest(ArrayTestCase.suite()); suite.addTest(MapTestCase.suite()); suite.addTest(AnnotationTestCase.suite()); suite.addTest(AliasTestCase.suite()); suite.addTest(CallbackTestCase.suite()); return suite; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/0000755000175000017500000000000011620316756032637 5ustar twernertwerner././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/TestBeanMetaDataFactory2.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/Te0000644000175000017500000000370110625561630033130 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaDataFactory; import org.jboss.util.JBossObject; /** * TestBeanMetaDataFactory. * * @author Adrian Brock * @version $Revision: 59941 $ */ public class TestBeanMetaDataFactory2 extends JBossObject implements BeanMetaDataFactory, Serializable { private static final long serialVersionUID = 1L; public List getBeans() { ArrayList result = new ArrayList(); AbstractBeanMetaData bean = new AbstractBeanMetaData("Bean5"); result.add(bean); bean = new AbstractBeanMetaData("Bean6"); result.add(bean); return result; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000755000175000017500000000000011620316756033173 5ustar twernertwerner././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/SupplyMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000257610625561630033204 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.util.JBossInterface; /** * Metadata about what a bean demands. * * @author Adrian Brock * @version $Revision: 40781 $ */ public interface SupplyMetaData extends JBossInterface, MetaDataVisitorNode { /** * Get what is supplied * * @return the supply */ Object getSupply(); } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/MetaDataVisitorNode.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000230410625561630033171 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; /** * A metadata vistor node. * * @author Adrian Brock * @version $Revision: 56022 $ */ public interface MetaDataVisitorNode { } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/LifecycleCallbackMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000432010625561630033171 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.util.JBossInterface; /** * Metadata about lifecycle callbacks * * @author Kabir Khan * @version $Revision: 1.1 $ */ public interface LifecycleCallbackMetaData extends JBossInterface, MetaDataVisitorNode { /** * Get the target state of the bean this callback applies to indicating when this callback should trigger * @return the state */ ControllerState getWhenRequired(); /** * The required state of the lifecycle callback bean * @return the dependant state */ ControllerState getDependentState(); /** * Get the bean this callback should be made on * @return the state */ String getBean(); /** * Get the method on the bean that should be called when reaching the required state on installation * @return name of the install method */ public String getInstallMethod(); /** * Get the method on the bean that should be called when reaching the required state on uninstallation * @return name of the uninstall method */ public String getUninstallMethod(); } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/InjectionType.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000615310625561630033177 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * Injection type: * * ByClass - matching the class type of value (default) * * ByName - matching the property name * * @author Ales Justin */ public class InjectionType extends JBossObject implements Serializable { private static final long serialVersionUID = 1L; /** Strict */ public static final InjectionType BY_CLASS = new InjectionType("ByClass"); /** Loose */ public static final InjectionType BY_NAME = new InjectionType("ByName"); /** The type string */ protected final String typeString; /** * Create a new state * * @param typeString the string representation */ private InjectionType(String typeString) { if (typeString == null) throw new IllegalArgumentException("Null type string"); this.typeString = typeString; } /** * Return injection type. * Or exception if no matching type. * * @param typeString type * @return InjectionType instance */ public static InjectionType getInstance(String typeString) { if ("ByClass".equalsIgnoreCase(typeString)) return BY_CLASS; else if ("ByName".equalsIgnoreCase(typeString)) return BY_NAME; else throw new IllegalArgumentException("No such type: " + typeString); } /** * Get the state string * * @return the state string */ public String getTypeString() { return typeString; } public boolean equals(Object object) { if (object == null || object instanceof InjectionType == false) return false; InjectionType other = (InjectionType) object; return typeString.equals(other.getTypeString()); } public void toString(JBossStringBuilder buffer) { buffer.append(typeString); } protected int getHashCode() { return typeString.hashCode(); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractAliasMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000751610625561630033203 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; import org.jboss.util.StringPropertyReplacer; /** * Metadata for an alias. * * @author Ales Justin */ public class AbstractAliasMetaData extends JBossObject implements AliasMetaData, Serializable { private static final long serialVersionUID = 1L; private static TypeInfoFactory typeInfoFactory = new IntrospectionTypeInfoFactory(); public String alias; protected boolean replace = true; protected String clazz; /** * Create a new annotation meta data */ public AbstractAliasMetaData() { super(); } public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } public boolean isReplace() { return replace; } public void setReplace(boolean replace) { this.replace = replace; } public String getClazz() { return clazz; } public void setClazz(String clazz) { this.clazz = clazz; } public Object getAliasValue() { try { if (clazz != null) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); TypeInfo info = typeInfoFactory.getTypeInfo(clazz, cl); return info.convertValue(alias, replace); } String aliasString = alias; if (replace) { aliasString = StringPropertyReplacer.replaceProperties(aliasString); } return aliasString; } catch (Throwable t) { throw new RuntimeException("Error creating alias for " + alias, t); } } public void toString(JBossStringBuilder buffer) { buffer.append("alias=").append(alias); buffer.append(" replace=").append(replace); if (clazz != null) buffer.append(" class=").append(clazz); } public void toShortString(JBossStringBuilder buffer) { buffer.append(alias); } protected int getHashCode() { return alias.hashCode(); } public boolean equals(Object object) { if (object == null || object instanceof AbstractAliasMetaData == false) return false; AbstractAliasMetaData amd = (AbstractAliasMetaData)object; // this is what we probably want? - never saw duplicate annotation on a bean/prop/... return alias.equals(amd.alias) && (replace == amd.replace) && (clazz != null && clazz.equals(amd.clazz)); } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractConstructorMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000001264010645631363033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import java.util.List; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlType; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * Metadata for construction. * * @author Adrian Brock * @version $Revision: 60019 $ */ @XmlType(propOrder={"annotations", "factory", "parameters", "value"}) public class AbstractConstructorMetaData extends AbstractFeatureMetaData implements ConstructorMetaData, MutableParameterizedMetaData, ValueMetaDataAware, Serializable { private static final long serialVersionUID = 1L; /** * The paramaters List */ protected List parameters; /** * The value */ protected ValueMetaData value; /** * The factory */ protected ValueMetaData factory; /** * The factory class name */ protected String factoryClassName; /** * The factory method */ protected String factoryMethod; /** * Create a new constructor meta data */ public AbstractConstructorMetaData() { } /** * Set the parameters * * @param parameters List */ @XmlElement(name="parameter", type=AbstractParameterMetaData.class) public void setParameters(List parameters) { this.parameters = parameters; flushJBossObjectCache(); } /** * Set the value * * @param value the value */ @XmlElements ({ @XmlElement(name="array", type=AbstractArrayMetaData.class), @XmlElement(name="collection", type=AbstractCollectionMetaData.class), @XmlElement(name="list", type=AbstractListMetaData.class), @XmlElement(name="map", type=AbstractMapMetaData.class), @XmlElement(name="set", type=AbstractSetMetaData.class), @XmlElement(name="value", type=StringValueMetaData.class) }) public void setValue(ValueMetaData value) { this.value = value; flushJBossObjectCache(); } @XmlAnyElement public void setValueObject(Object value) { if (value == null) setValue(null); else if (value instanceof ValueMetaData) setValue((ValueMetaData) value); else setValue(new AbstractValueMetaData(value)); } /** * Set the factory * * @param factory the factory */ @XmlElement(name="factory", type=AbstractDependencyValueMetaData.class) public void setFactory(ValueMetaData factory) { // HACK to have wildcard factories if (factory != null && factory instanceof AbstractDependencyValueMetaData) { Object underlying = factory.getUnderlyingValue(); if (underlying != null && underlying instanceof ValueMetaData) factory = (ValueMetaData) underlying; } this.factory = factory; flushJBossObjectCache(); } /** * Set the factory class name * * @param name the factory class name */ @XmlAttribute(name="factoryClass") public void setFactoryClass(String name) { this.factoryClassName = name; flushJBossObjectCache(); } /** * Set the factory method * * @param name the factory method */ @XmlAttribute(name="factoryMethod") public void setFactoryMethod(String name) { this.factoryMethod = name; flushJBossObjectCache(); } public List getParameters() { return parameters; } public ValueMetaData getValue() { return value; } public ValueMetaData getFactory() { return factory; } public String getFactoryClass() { return factoryClassName; } public String getFactoryMethod() { return factoryMethod; } public void toString(JBossStringBuilder buffer) { buffer.append("parameters="); JBossObject.list(buffer, parameters); if (value != null) buffer.append(" value=").append(value); if (factory != null) buffer.append(" factory=").append(factory); if (factoryClassName != null) buffer.append(" factoryClass=").append(factoryClassName); if (factoryMethod != null) buffer.append(" factoryMethod=").append(factoryMethod); super.toString(buffer); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AnnotationMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000250110763275165033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.util.JBossInterface; /** * Metadata about an annotation attribute. * * @author Adrian Brock * @version $Revision: 46386 $ */ public interface AnnotationMetaData extends JBossInterface, MetaDataVisitorNode { String getAnnotation(); } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractLifecycleMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000757210625561630033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import java.util.List; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * Metadata for lifecycle. * * @author Adrian Brock * @version $Revision: 63037 $ */ @XmlType(propOrder={"annotations", "parameters"}) public class AbstractLifecycleMetaData extends AbstractFeatureMetaData implements LifecycleMetaData, MutableParameterizedMetaData, Serializable { private static final long serialVersionUID = 1L; /** The state */ protected ControllerState state; /** The method name */ protected String methodName; /** The ignored attribute */ boolean ignored; /** The paramaters List */ protected List parameters; /** The type - create, start, stop, destroy, install */ protected String type; /** * Create a new lifecycle meta data */ public AbstractLifecycleMetaData() { } public AbstractLifecycleMetaData(String methodName) { this.methodName = methodName; } public ControllerState getState() { return state; } public void setState(ControllerState state) { this.state = state; } public String getMethodName() { return methodName; } /** * Set the method name * * @param name the factory method */ @XmlAttribute(name="method") public void setMethodName(String name) { this.methodName = name; flushJBossObjectCache(); } public boolean isIgnored() { return ignored; } /** * Set ignored attribute. * * @param ignored the ignored */ @XmlAttribute public void setIgnored(boolean ignored) { this.ignored = ignored; } public List getParameters() { return parameters; } /** * Set the parameters * * @param parameters List */ @XmlElement(name="parameter", type=AbstractParameterMetaData.class) public void setParameters(List parameters) { this.parameters = parameters; flushJBossObjectCache(); } /** * Get type - create, start, stop, destroy, install * * @return lifecycle type */ public String getType() { return type; } public void setType(String type) { this.type = type; } public void toString(JBossStringBuilder buffer) { if (methodName != null) buffer.append("method=").append(methodName); buffer.append(" parameters="); JBossObject.list(buffer, parameters); buffer.append(" "); super.toString(buffer); } public void toShortString(JBossStringBuilder buffer) { buffer.append(methodName); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractArrayMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000512310645631363033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import javax.xml.bind.annotation.XmlType; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossStringBuilder; import org.jboss.xb.annotations.JBossXmlChild; import org.jboss.xb.annotations.JBossXmlChildWildcard; import org.jboss.xb.annotations.JBossXmlChildren; import org.jboss.xb.annotations.JBossXmlNoElements; /** * Array metadata. * * @author Adrian Brock * @version $Revision: 59429 $ */ @XmlType() @JBossXmlNoElements @JBossXmlChildren ({ @JBossXmlChild(name="array", type=AbstractArrayMetaData.class), @JBossXmlChild(name="collection", type=AbstractCollectionMetaData.class), @JBossXmlChild(name="inject", type=AbstractDependencyValueMetaData.class), @JBossXmlChild(name="list", type=AbstractListMetaData.class), @JBossXmlChild(name="map", type=AbstractMapMetaData.class), @JBossXmlChild(name="null", type=AbstractValueMetaData.class), @JBossXmlChild(name="set", type=AbstractSetMetaData.class), @JBossXmlChild(name="this", type=ThisValueMetaData.class), @JBossXmlChild(name="value", type=StringValueMetaData.class) }) @JBossXmlChildWildcard(wrapper=AbstractValueMetaData.class, property="value") public class AbstractArrayMetaData extends AbstractListMetaData { private static final long serialVersionUID = 1L; /** * Create a new array value */ public AbstractArrayMetaData() { } public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable { return null; } public void toString(JBossStringBuilder buffer) { super.toString(buffer); } }././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractClassLoaderMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000671510645631363033206 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlType; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * A classloader. * * @author Adrian Brock * @version $Revision: 60558 $ */ @XmlType(propOrder="classLoader") public class AbstractClassLoaderMetaData extends JBossObject implements ClassLoaderMetaData, BeanMetaDataFactory, Serializable { private static final long serialVersionUID = 1L; /** The classloader */ protected ValueMetaData classloader; /** * Create a new classloader */ public AbstractClassLoaderMetaData() { } /** * Create a new classloader * * @param classloader the classloader value */ public AbstractClassLoaderMetaData(ValueMetaData classloader) { this.classloader = classloader; } /** * Set the classloader * * @param classloader the classloader value */ @XmlElements ({ @XmlElement(name="inject", type=AbstractDependencyValueMetaData.class), @XmlElement(name="null", type=AbstractValueMetaData.class) }) public void setClassLoader(ValueMetaData classloader) { this.classloader = classloader; flushJBossObjectCache(); } @XmlAnyElement public void setClassLoaderObject(Object classloader) { if (classloader == null) setClassLoader(null); else if (classloader instanceof ValueMetaData) setClassLoader((ValueMetaData) classloader); else setClassLoader(new AbstractValueMetaData(classloader)); } public ValueMetaData getClassLoader() { return classloader; } public List getBeans() { if (classloader instanceof BeanMetaDataFactory) { return ((BeanMetaDataFactory)classloader).getBeans(); } else if (classloader instanceof BeanMetaData) { return Collections.singletonList((BeanMetaData)classloader); } return new ArrayList(); } public void toString(JBossStringBuilder buffer) { buffer.append("classloader=").append(classloader); } public void toShortString(JBossStringBuilder buffer) { buffer.append(classloader); } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractPropertyMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000001352110645631363033177 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import org.jboss.util.JBossStringBuilder; /** * Metadata for a property. * * @author Adrian Brock * @version $Revision: 60019 $ */ @XmlType(propOrder={"annotations", "value"}) public class AbstractPropertyMetaData extends AbstractFeatureMetaData implements PropertyMetaData, ValueMetaDataAware, Serializable { private static final long serialVersionUID = 1L; /** The property name */ protected String name; /** The property value */ protected ValueMetaData value; /** * Create a new property meta data */ public AbstractPropertyMetaData() { } /** * Create a new property meta data * * @param name the name * @param value the value */ public AbstractPropertyMetaData(String name, Object value) { this.name = name; this.value = new AbstractValueMetaData(value); } /** * Create a new property meta data * * @param name the name * @param value the string value */ public AbstractPropertyMetaData(String name, String value) { this.name = name; this.value = new StringValueMetaData(value); } /** * Create a new attribute meta data * * @param name the name * @param value the value meta data */ public AbstractPropertyMetaData(String name, ValueMetaData value) { this.name = name; this.value = value; } /** * Create a new property meta data * * @param name the name * @param value the string value * @param type the type */ public AbstractPropertyMetaData(String name, String value, String type) { this.name = name; StringValueMetaData svmd = new StringValueMetaData(value); svmd.setType(type); this.value = svmd; } public String getName() { return name; } /** * Set the name * * @param name the name */ @XmlAttribute public void setName(String name) { this.name = name; flushJBossObjectCache(); } public String getType() { if (value instanceof AbstractTypeMetaData) { return ((AbstractTypeMetaData)value).getType(); } return null; } public ValueMetaData getValue() { return value; } /** * Set the value * * @param value the value */ @XmlElements ({ @XmlElement(name="array", type=AbstractArrayMetaData.class), @XmlElement(name="collection", type=AbstractCollectionMetaData.class), @XmlElement(name="inject", type=AbstractDependencyValueMetaData.class), @XmlElement(name="list", type=AbstractListMetaData.class), @XmlElement(name="map", type=AbstractMapMetaData.class), @XmlElement(name="set", type=AbstractSetMetaData.class), @XmlElement(name="this", type=ThisValueMetaData.class), @XmlElement(name="value", type=StringValueMetaData.class) }) public void setValue(ValueMetaData value) { this.value = value; flushJBossObjectCache(); } @XmlAnyElement public void setValueObject(Object value) { if (value == null) setValue(null); else if (value instanceof ValueMetaData) setValue((ValueMetaData) value); else setValue(new AbstractValueMetaData(value)); } @XmlValue public void setValueString(String value) { if (value == null) setValue(null); else { ValueMetaData valueMetaData = getValue(); if (valueMetaData instanceof StringValueMetaData) { ((StringValueMetaData) valueMetaData).setValue(value); return; } StringValueMetaData stringValue = new StringValueMetaData(value); stringValue.setType(getType()); setValue(stringValue); } } @XmlAttribute(name="class") public void setPropertyType(String type) { ValueMetaData valueMetaData = getValue(); if (valueMetaData != null && valueMetaData instanceof StringValueMetaData == false) throw new IllegalArgumentException("Property is not a string"); if (valueMetaData == null) { valueMetaData = new StringValueMetaData(); setValue(valueMetaData); } ((StringValueMetaData) valueMetaData).setType(type); } public void toString(JBossStringBuilder buffer) { buffer.append("name=").append(name); if (value != null) buffer.append(" value=").append(value); super.toString(buffer); } public void toShortString(JBossStringBuilder buffer) { buffer.append(name); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/package-info.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000271411046574376033207 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ @JBossXmlAdaptedTypes ({ //@JBossXmlAdaptedType(type=Cardinality.class, valueAdapter=CardinalityValueAdapter.class), @JBossXmlAdaptedType(type=ControllerMode.class, valueAdapter=ControllerModeValueAdapter.class), @JBossXmlAdaptedType(type=ControllerState.class, valueAdapter=ControllerStateValueAdapter.class) }) package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.xb.annotations.JBossXmlAdaptedType; import org.jboss.xb.annotations.JBossXmlAdaptedTypes; ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/ControllerStateValueAdapter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000261011061473704033170 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; /** * ControllerStateValueAdapter. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ControllerStateValueAdapter implements ValueAdapter { public Object cast(Object o, Class c) { return new ControllerState((String) o); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/ParameterizedMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000253410625561630033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.util.List; /** * ParameterizedMetaData. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface ParameterizedMetaData { /** * Get the parameters. * * @return List. */ List getParameters(); } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/InstallMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000277710625561630033207 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; /** * Metadata about an installation method. * * @author Adrian Brock * @version $Revision: 40727 $ */ public interface InstallMetaData extends LifecycleMetaData { /** * Get the bean name. * * @return the bean name. */ String getBean(); /** * Get the required state of the dependency * * @return the required state or null if it must be in the registry */ ControllerState getDependentState(); } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractKernelDeployment.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000001365511061473704033203 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.test.xb.builder.object.mc.support.model.factory.GenericBeanFactoryMetaData; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; import org.jboss.xb.annotations.JBossXmlSchema; /** * An abstract kernel deployment. * * @author Adrian Brock * @version $Revision: 60497 $ */ @JBossXmlSchema(namespace="urn:jboss:bean-deployer:2.0", elementFormDefault=XmlNsForm.QUALIFIED) @XmlRootElement(name="deployment") @XmlType(propOrder={"classLoader", "beanFactories"}) public class AbstractKernelDeployment extends JBossObject implements KernelDeployment, Serializable { private static final long serialVersionUID = 1; /** The name of the deployment */ protected String name; /** Whether it is installed */ protected boolean installed; /** Is deployment scoped */ protected Boolean scoped; /** The annotations */ protected Set annotations; /** The beans List */ protected List beanFactories; /** The ClassLoader */ protected ClassLoaderMetaData classLoader; /** * Create a new kernel deployment */ public AbstractKernelDeployment() { } /** * Set the bean factories. * * @deprecated use setBeanFactories * @param beans a List. */ @SuppressWarnings("unchecked") public void setBeans(List beans) { this.beanFactories = beans; flushJBossObjectCache(); } /** * Set the bean factories. * * @param beanFactories a List. */ @XmlElements ({ @XmlElement(name="bean", type=AbstractBeanMetaData.class), @XmlElement(name="beanfactory", type=GenericBeanFactoryMetaData.class) }) @XmlAnyElement public void setBeanFactories(List beanFactories) { this.beanFactories = beanFactories; flushJBossObjectCache(); } public String getName() { return name; } @XmlAttribute public void setName(String name) { this.name = name; flushJBossObjectCache(); } public boolean isInstalled() { return installed; } public void setInstalled(boolean installed) { this.installed = installed; flushJBossObjectCache(); } public List getBeans() { if (beanFactories == null || beanFactories.size() == 0) return null; List result = new ArrayList(beanFactories.size()); for (BeanMetaDataFactory factory : beanFactories) { List beans = factory.getBeans(); // add all deployment annotations to bean's annotations if (annotations != null && annotations.isEmpty() == false) { for (BeanMetaData bmd : beans) { Set annotationsBMD = bmd.getAnnotations(); if (annotationsBMD == null) { annotationsBMD = new HashSet(); bmd.setAnnotations(annotationsBMD); } annotationsBMD.addAll(annotations); } } result.addAll(beans); } return result; } public Boolean isScoped() { return scoped; } public void setScoped(Boolean scoped) { this.scoped = scoped; } public Set getAnnotations() { return annotations; } public void setAnnotations(Set annotations) { this.annotations = annotations; } public List getBeanFactories() { return beanFactories; } public ClassLoaderMetaData getClassLoader() { return classLoader; } /** * Set the classloader * * @param classLoader the classloader metadata */ @XmlElement(name="classloader", type=AbstractClassLoaderMetaData.class) public void setClassLoader(ClassLoaderMetaData classLoader) { this.classLoader = classLoader; } public void toString(JBossStringBuilder buffer) { buffer.append("name=").append(name); buffer.append(" installed=").append(installed); if (classLoader != null) buffer.append(" classLoader=").append(classLoader); if (beanFactories != null) buffer.append(" beanFactories=").append(beanFactories); } public void toShortString(JBossStringBuilder buffer) { buffer.append(name); } }././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/KernelDeployment.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000471010625561630033174 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.util.List; import java.util.Set; import org.jboss.util.JBossInterface; /** * A kernel deployment. * * @author Adrian Brock * @version $Revision: 60491 $ */ public interface KernelDeployment extends JBossInterface { /** * Get the name of the deployment * * @return the name */ String getName(); /** * Set the name of the deployment * * @param name the name */ void setName(String name); /** * Whether the deployment is installed * * @return true when installed */ boolean isInstalled(); /** * Set the intalled state * * @param installed true when installed */ void setInstalled(boolean installed); /** * Is deployment scoped * * @return true if scoped, false if isolated, null by default */ Boolean isScoped(); /** * Get the deployment annotations. * * @return the annotations */ Set getAnnotations(); /** * Get the classloader for this deployment * * @return the classloader */ ClassLoaderMetaData getClassLoader(); /** * Get the beans in the deployment * * @return List */ List getBeans(); /** * Get the bean factories in the deployment * * @return List */ List getBeanFactories(); } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractValueMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000515611171577572033212 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; import org.jboss.xb.annotations.JBossXmlNoElements; /** * Plain value. * * @author Adrian Brock * @version $Revision: 59429 $ */ @XmlType @JBossXmlNoElements public class AbstractValueMetaData extends JBossObject implements ValueMetaData, Serializable { private static final long serialVersionUID = 1L; /** * The value */ protected Object value; /** * Create a new plain value */ public AbstractValueMetaData() { } /** * Create a new plain value * * @param value the value */ public AbstractValueMetaData(Object value) { this.value = value; } @Override @XmlTransient public String getClassShortName() { return super.getClassShortName(); } public Object getValue() { return value; } public void setValue(Object value) { this.value = value; flushJBossObjectCache(); } @XmlTransient public Object getUnderlyingValue() { return value; } public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable { return info != null ? info.convertValue(value) : value; } public void toString(JBossStringBuilder buffer) { buffer.append("value=").append(value); } public void toShortString(JBossStringBuilder buffer) { buffer.append(value); } } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/UninstallCallbackMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000264111171577572033206 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; /** * Metadata for uninstall callback. * * @author Ales Justin */ public class UninstallCallbackMetaData extends AbstractCallbackMetaData { /** The serialVersionUID */ private static final long serialVersionUID = 1888688138196290492L; public UninstallCallbackMetaData() { super(); } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/InjectionOption.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000634110625561630033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * Injection option: * * Strict - exactly one matching context (default) * * Callback - issue callback once context with matching is present * * @author Ales Justin */ public class InjectionOption extends JBossObject implements Serializable { private static final long serialVersionUID = 1L; /** Strict */ public static final InjectionOption STRICT = new InjectionOption("Strict"); /** Loose */ public static final InjectionOption CALLBACK = new InjectionOption("Callback"); /** The type string */ protected final String optionString; /** * Create a new state * * @param optionString the string representation */ private InjectionOption(String optionString) { if (optionString == null) throw new IllegalArgumentException("Null option string"); this.optionString = optionString; } /** * Return injection type. * Or exception if no matching type. * * @param optionString type * @return InjectionType instance */ public static InjectionOption getInstance(String optionString) { if (STRICT.getOptionString().equalsIgnoreCase(optionString)) return STRICT; else if (CALLBACK.getOptionString().equalsIgnoreCase(optionString)) return CALLBACK; else throw new IllegalArgumentException("No such option: " + optionString); } /** * Get the state string * * @return the state string */ public String getOptionString() { return optionString; } public boolean equals(Object object) { if (object == null || object instanceof InjectionOption == false) return false; InjectionOption other = (InjectionOption) object; return optionString.equals(other.getOptionString()); } public void toString(JBossStringBuilder buffer) { buffer.append(optionString); } protected int getHashCode() { return optionString.hashCode(); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/ClassLoaderMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000261510625561630033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.util.JBossInterface; /** * Metadata about a classloader. * * @author Adrian Brock * @version $Revision: 40781 $ */ public interface ClassLoaderMetaData extends JBossInterface, MetaDataVisitorNode { /** * Get the classloader * * @return the classloader */ ValueMetaData getClassLoader(); } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractFeatureMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000562611171577572033214 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import java.util.Set; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlTransient; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * General metadata. * * @author Adrian Brock * @version $Revision: 59429 $ */ public abstract class AbstractFeatureMetaData extends JBossObject implements FeatureMetaData, Serializable { private static final long serialVersionUID = 1; /** The description */ protected String description; /** The annotations */ protected Set annotations; /** * Create a new meta data */ public AbstractFeatureMetaData() { } @Override @XmlTransient public String getClassShortName() { return super.getClassShortName(); } /** * Set the description. * * @param description the description. */ public void setDescription(String description) { this.description = description; flushJBossObjectCache(); } /** * Set the annotations. * * @param annotations Set */ @XmlElement(name="annotation", type=AbstractAnnotationMetaData.class) public void setAnnotations(Set annotations) { this.annotations = annotations; flushJBossObjectCache(); } public String getDescription() { return description; } public Set getAnnotations() { return annotations; } public void toString(JBossStringBuilder buffer) { if (description != null) buffer.append("description=").append(description); if (annotations != null) buffer.append(" annotations=").append(annotations); } public void toShortString(JBossStringBuilder buffer) { buffer.append(description); } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/CardinalityValueAdapter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000260611061473704033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; /** * CardinalityValueAdapter. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class CardinalityValueAdapter implements ValueAdapter { public Object cast(Object o, Class c) { return Cardinality.toCardinality((String) o); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/MapEntry.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000340510746353474033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlMapKey; import org.jboss.xb.annotations.JBossXmlMapValue; /** * MapEntry. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlType(propOrder= {"key", "value"}) public class MapEntry { /** The key */ private ValueMetaData key; /** The value */ private ValueMetaData value; @JBossXmlMapKey public ValueMetaData getKey() { return key; } public void setKey(ValueMetaData key) { this.key = key; } @JBossXmlMapValue public ValueMetaData getValue() { return value; } public void setValue(ValueMetaData value) { this.value = value; } }././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractDependencyValueMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000001106310625561630033173 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossStringBuilder; import org.jboss.xb.annotations.JBossXmlAttribute; /** * Dependency value. * * @author Adrian Brock * @version $Revision: 62474 $ */ @XmlType public class AbstractDependencyValueMetaData extends AbstractValueMetaData { private static final long serialVersionUID = 2L; /** The property name */ protected String property; /** The when required state of the dependency or null to use current context state */ protected ControllerState whenRequiredState; /** The required state of the dependency or null to look in the registry */ protected ControllerState dependentState = ControllerState.INSTALLED; /** * Create a new dependency value */ public AbstractDependencyValueMetaData() { } /** * Create a new dependency value * * @param value the value */ public AbstractDependencyValueMetaData(Object value) { super(value); } /** * Create a new dependency value * * @param value the value * @param property the property */ public AbstractDependencyValueMetaData(Object value, String property) { super(value); this.property = property; } /** * Get the property * * @return the property */ public String getProperty() { return property; } /** * Set the property * * @param property the property name */ @XmlAttribute public void setProperty(String property) { this.property = property; } /** * Set the when required state of the dependency * * @param whenRequiredState the when required state or null if it uses current context state */ public void setWhenRequiredState(ControllerState whenRequiredState) { this.whenRequiredState = whenRequiredState; flushJBossObjectCache(); } public ControllerState getWhenRequiredState() { return whenRequiredState; } /** * Set the required state of the dependency * * @param dependentState the required state or null if it must be in the registry */ @XmlAttribute(name="state") public void setDependentState(ControllerState dependentState) { this.dependentState = dependentState; flushJBossObjectCache(); } public ControllerState getDependentState() { return dependentState; } @XmlAttribute(name="bean") @JBossXmlAttribute(type=String.class) public void setValue(Object value) { super.setValue(value); } @XmlAnyElement public void setValueObject(Object value) { if (value == null) setValue(null); else if (value instanceof ValueMetaData) setValue(value); else setValue(new AbstractValueMetaData(value)); } public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable { return null; } protected boolean addDependencyItem() { return true; } public void toString(JBossStringBuilder buffer) { super.toString(buffer); if (property != null) buffer.append(" property=").append(property); if (whenRequiredState != null) buffer.append(" whenRequiredState=").append(whenRequiredState.getStateString()); if (dependentState != null) buffer.append(" dependentState=").append(dependentState.getStateString()); } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractDemandMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000561310625561630033177 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * A demand. * * @author Adrian Brock * @version $Revision: 60143 $ */ @XmlType public class AbstractDemandMetaData extends JBossObject implements DemandMetaData, Serializable { private static final long serialVersionUID = 1L; /** The demand */ protected Object demand; /** When the dependency is required */ protected ControllerState whenRequired = ControllerState.DESCRIBED; /** * Create a new demand */ public AbstractDemandMetaData() { } /** * Create a new demand * * @param demand the demand */ public AbstractDemandMetaData(Object demand) { this.demand = demand; } /** * Set the required state of the dependency * * @param whenRequired when the dependecy is required */ @XmlAttribute(name="state") public void setWhenRequired(ControllerState whenRequired) { this.whenRequired = whenRequired; flushJBossObjectCache(); } /** * Set the demand * * @param demand the demand */ @XmlValue public void setDemand(Object demand) { this.demand = demand; flushJBossObjectCache(); } public Object getDemand() { return demand; } public ControllerState getWhenRequired() { return whenRequired; } public void toString(JBossStringBuilder buffer) { buffer.append("demand=").append(demand); if (whenRequired != null) buffer.append(" whenRequired=").append(whenRequired.getStateString()); } public void toShortString(JBossStringBuilder buffer) { buffer.append(demand); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/factory/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000755000175000017500000000000011620316755033172 5ustar twernertwerner././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/factory/BeanFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000253710625561630033201 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model.factory; /** * Bean factory interface. * * @author Ales Justin */ public interface BeanFactory { /** * Create bean. * * @return bean * @throws Throwable for any error */ Object createBean() throws Throwable; } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/factory/package.htmllibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000151410625561630033173 0ustar twernertwerner

Classes used to dynamically create beans.

Package Specification

Related Documentation

Package Status

  • ALPHA

Todo

  • ???
././@LongLink0000000000000000000000000000022000000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/factory/GenericBeanFactoryMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000002475610625561630033210 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model.factory; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.test.xb.builder.object.mc.support.model.AbstractAnnotationMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractClassLoaderMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractConstructorMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractDemandMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractDependencyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractInstallMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractLifecycleMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractMapMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractPropertyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractSupplyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AbstractValueMetaData; import org.jboss.test.xb.builder.object.mc.support.model.AnnotationMetaData; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaDataFactory; import org.jboss.test.xb.builder.object.mc.support.model.CallbackMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ClassLoaderMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ConstructorMetaData; import org.jboss.test.xb.builder.object.mc.support.model.ControllerMode; import org.jboss.test.xb.builder.object.mc.support.model.DemandMetaData; import org.jboss.test.xb.builder.object.mc.support.model.DependencyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.InstallCallbackMetaData; import org.jboss.test.xb.builder.object.mc.support.model.InstallMetaData; import org.jboss.test.xb.builder.object.mc.support.model.LifecycleMetaData; import org.jboss.test.xb.builder.object.mc.support.model.PropertyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.SupplyMetaData; import org.jboss.test.xb.builder.object.mc.support.model.UninstallCallbackMetaData; import org.jboss.util.JBossObject; import org.jboss.xb.annotations.JBossXmlSchema; /** * GenericBeanFactoryMetaData. * * @author Adrian Brock * @version $Revision: 59429 $ */ @JBossXmlSchema(namespace="urn:jboss:bean-deployer:2.0", elementFormDefault=XmlNsForm.QUALIFIED) @XmlRootElement(name="beanfactory") @XmlType(propOrder={"aliases", "annotations", "classLoader", "constructor", "properties", "create", "start", "depends", "demands", "supplies", "installs", "uninstalls", "installCallbacks", "uninstallCallbacks"}) public class GenericBeanFactoryMetaData extends JBossObject implements BeanMetaDataFactory { private static final long serialVersionUID = 1L; /** The name */ protected String name; /** The bean class name */ protected String bean; /** The controller mode */ protected ControllerMode mode; /** The annotations */ protected Set annotations; /** The aliases */ protected Set aliases; /** The classloader */ protected ClassLoaderMetaData classLoader; /** The constructor metadata */ protected ConstructorMetaData constructor; /** The properties Map */ protected Set properties; /** The create lifecycle method */ protected LifecycleMetaData create; /** The start lifecycle method */ protected LifecycleMetaData start; protected Set depends; protected Set demands; protected Set supplies; protected List installs; protected List uninstalls; protected List installCallbacks; protected List uninstallCallbacks; public String getName() { return name; } @XmlAttribute public void setName(String name) { this.name = name; } public String getBean() { return bean; } @XmlAttribute(name="class") public void setBean(String bean) { this.bean = bean; } public Set getAliases() { return aliases; } @XmlElement(name="alias", type=String.class) public void setAliases(Set aliases) { this.aliases = aliases; } public ControllerMode getMode() { return mode; } @XmlAttribute public void setMode(ControllerMode mode) { this.mode = mode; } public Set getAnnotations() { return annotations; } @XmlElement(name="annotation", type=AbstractAnnotationMetaData.class) public void setAnnotations(Set annotations) { this.annotations = annotations; } public ClassLoaderMetaData getClassLoader() { return classLoader; } @XmlElement(name="classloader", type=AbstractClassLoaderMetaData.class) public void setClassLoader(ClassLoaderMetaData classLoader) { this.classLoader = classLoader; } public ConstructorMetaData getConstructor() { return constructor; } @XmlElement(name="constructor", type=AbstractConstructorMetaData.class) public void setConstructor(ConstructorMetaData constructor) { this.constructor = constructor; } public LifecycleMetaData getCreate() { return create; } @XmlElement(name="create", type=AbstractLifecycleMetaData.class) public void setCreate(LifecycleMetaData create) { this.create = create; } public Set getProperties() { return properties; } @XmlElement(name="property", type=AbstractPropertyMetaData.class) public void setProperties(Set properties) { this.properties = properties; } public LifecycleMetaData getStart() { return start; } @XmlElement(name="start", type=AbstractLifecycleMetaData.class) public void setStart(LifecycleMetaData start) { this.start = start; } @XmlElement(name="demand", type=AbstractDemandMetaData.class) public Set getDemands() { return demands; } public void setDemands(Set demands) { this.demands = demands; } public Set getDepends() { return depends; } @XmlElement(name="depends", type=AbstractDependencyMetaData.class) public void setDepends(Set depends) { this.depends = depends; } public List getInstallCallbacks() { return installCallbacks; } @XmlElement(name="incallback", type=InstallCallbackMetaData.class) public void setInstallCallbacks(List installCallbacks) { this.installCallbacks = installCallbacks; } public List getInstalls() { return installs; } @XmlElement(name="install", type=AbstractInstallMetaData.class) public void setInstalls(List installs) { this.installs = installs; } public Set getSupplies() { return supplies; } @XmlElement(name="supply", type=AbstractSupplyMetaData.class) public void setSupplies(Set supplies) { this.supplies = supplies; } public List getUninstallCallbacks() { return uninstallCallbacks; } @XmlElement(name="uncallback", type=UninstallCallbackMetaData.class) public void setUninstallCallbacks(List uninstallCallbacks) { this.uninstallCallbacks = uninstallCallbacks; } public List getUninstalls() { return uninstalls; } @XmlElement(name="uninstall", type=AbstractInstallMetaData.class) public void setUninstalls(List uninstalls) { this.uninstalls = uninstalls; } public List getBeans() { AbstractBeanMetaData gbf = new AbstractBeanMetaData(); gbf.setName(name); gbf.setAliases(aliases); gbf.setBean("GenericBeanFactory"); gbf.setMode(mode); Set properties = new HashSet(); gbf.setProperties(properties); properties.add(createProperty("bean", bean)); properties.add(createProperty("classLoader", classLoader)); properties.add(createProperty("constructor", constructor)); properties.add(createMapProperty("properties", properties)); properties.add(createProperty("start", start)); properties.add(createProperty("create", create)); // etc. return Collections.singletonList((BeanMetaData) gbf); } protected PropertyMetaData createProperty(String name, Object value) { return new AbstractPropertyMetaData(name, value); } protected PropertyMetaData createMapProperty(String name, Set properties) { AbstractMapMetaData map = new AbstractMapMetaData(); if (properties != null) { for (PropertyMetaData property : properties) map.put(new AbstractValueMetaData(property.getName()), new AbstractValueMetaData(property)); } return new AbstractPropertyMetaData(name, map); } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractCallbackMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000001124711171577572033210 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlTransient; import org.jboss.util.JBossStringBuilder; /** * Metadata for callback. * * @author Ales Justin */ public abstract class AbstractCallbackMetaData extends AbstractLifecycleMetaData implements CallbackMetaData, Serializable { private static final long serialVersionUID = 1L; /** The cardinality */ protected Cardinality cardinality; /** The property name */ protected String property; /** The required state of the dependency */ protected ControllerState whenRequired = ControllerState.CONFIGURED; /** The required state of the dependency */ protected ControllerState dependentState = ControllerState.INSTALLED; /** The signature */ protected String signature; public AbstractCallbackMetaData() { setState(ControllerState.CONFIGURED); } public String getProperty() { return property; } /** * Set the property. * * @param property property name */ @XmlAttribute public void setProperty(String property) { this.property = property; flushJBossObjectCache(); } public Cardinality getCardinality() { return cardinality; } /** * Set the cardinality. * * @param cardinality the cardinality */ @XmlAttribute public void setCardinality(Cardinality cardinality) { this.cardinality = cardinality; flushJBossObjectCache(); } @XmlTransient public ControllerState getWhenRequiredState() { return whenRequired; } /** * Set when required state. * * @param whenRequired when is this call back required (default Configured) */ @XmlAttribute(name="whenRequired") public void setWhenRequired(ControllerState whenRequired) { this.whenRequired = whenRequired; flushJBossObjectCache(); } public String getSignature() { return signature; } /** * Set the signature. * * @param signature method / property parameter signature */ @XmlAttribute public void setSignature(String signature) { this.signature = signature; flushJBossObjectCache(); } /** * Set the required state of the dependency * * @param dependentState the required state or null if it must be in the registry */ @XmlAttribute(name="state") public void setDependentState(ControllerState dependentState) { this.dependentState = dependentState; flushJBossObjectCache(); } public ControllerState getDependentState() { return dependentState; } public void toString(JBossStringBuilder buffer) { super.toString(buffer); if (property != null) buffer.append(" property=").append(property); if (cardinality != null) buffer.append(" cardinality=").append(cardinality); if (signature != null) buffer.append(" signature=").append(signature); if (ControllerState.INSTALLED.equals(dependentState) == false) buffer.append(" dependentState=" + dependentState); if (ControllerState.CONFIGURED.equals(whenRequired) == false) buffer.append(" whenRequiredState=" + dependentState); } public void toShortString(JBossStringBuilder buffer) { if (property != null) buffer.append("property=").append(property); if (methodName != null) buffer.append("method=").append(methodName); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/ValueMetaDataAware.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000264610625561630033202 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; /** * Simple ValueMetaData aware. * * @author Ales Justin */ public interface ValueMetaDataAware { /** * Get the value. * * @return the value. */ ValueMetaData getValue(); /** * Set the value. * * @param value the value */ void setValue(ValueMetaData value); } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/BeanMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000001057410625561630033201 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.util.List; import java.util.Set; /** * Metadata about a bean. * * @author Adrian Brock * @version $Revision: 62474 $ */ public interface BeanMetaData extends FeatureMetaData, ValueMetaData { /** * Get the bean. * * @return the bean. */ String getBean(); /** * Get the name * * @return the name */ String getName(); /** * Set the name * * @param name the name */ void setName(String name); /** * The aliases * * @return the aliases or null if there are no aliases */ Set getAliases(); /** * Get the mode * * @return the mode */ ControllerMode getMode(); /** * Set the name * * @param mode the mode */ void setMode(ControllerMode mode); /** * Set the annotations * * @param annotations the annotations */ void setAnnotations(Set annotations); /** * Get the properties. * * @return List. */ Set getProperties(); /** * Get the bean ClassLoader * * @return the ClassLoader metadata */ ClassLoaderMetaData getClassLoader(); /** * Set the bean ClassLoader * * @param classLoader the ClassLoader metadata */ void setClassLoader(ClassLoaderMetaData classLoader); /** * Get the constructor * * @return the constructor metadata */ ConstructorMetaData getConstructor(); /** * Get the create lifecycle * * @return the create lifecycle */ LifecycleMetaData getCreate(); /** * Get the start lifecycle * * @return the start lifecycle */ LifecycleMetaData getStart(); /** * Get the stop lifecycle * * @return the stop lifecycle */ LifecycleMetaData getStop(); /** * Get the destroy lifecycle * * @return the destroy lifecycle */ LifecycleMetaData getDestroy(); /** * Get what this bean demands. * * @return Set */ Set getDemands(); /** * Get what this bean supplies. * * @return Set */ Set getSupplies(); /** * Get what this bean depends. * * @return Set */ Set getDepends(); /** * Get the installation oeprations. * * @return List */ List getInstalls(); /** * Get the uninstallation operations. * * @return List */ List getUninstalls(); /** * Get the installation oeprations. * * @return List */ List getInstallCallbacks(); /** * Get the uninstallation operations. * * @return List */ List getUninstallCallbacks(); /** * Get the lifecycle callbacks. * * @return List */ List getLifecycleCallbacks(); /** * Get the lifecycle callbacks for a particular state. * * @param state the state callbacks refer to * @return List */ List getLifecycleCallbacks(ControllerState state); } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/ThisValueMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000316410625561630033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import javax.xml.bind.annotation.XmlType; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.annotations.JBossXmlNoElements; /** * Dependency value. * * @author Adrian Brock * @version $Revision: 60562 $ */ @XmlType @JBossXmlNoElements public class ThisValueMetaData extends AbstractValueMetaData { private static final long serialVersionUID = 2L; /** * Create a new dependency value */ public ThisValueMetaData() { } public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable { return null; } } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractLifecycleCallbackMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000557310625561630033204 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * Metadata about lifecycle callbacks that should be invoked once a * bean reaches a certain lifecycle state * * @author Kabir Khan * @version $Revision: 1.1 $ */ public class AbstractLifecycleCallbackMetaData extends JBossObject implements LifecycleCallbackMetaData, MetaDataVisitorNode { String bean; ControllerState whenRequired; ControllerState dependentState; String installMethod; String uninstallMethod; public AbstractLifecycleCallbackMetaData(String bean, ControllerState whenRequired, ControllerState dependentState, String installMethod, String uninstallMethod) { super(); this.bean = bean; this.whenRequired = whenRequired; this.dependentState = dependentState; this.installMethod = installMethod; this.uninstallMethod = uninstallMethod; } public String getBean() { return bean; } public ControllerState getDependentState() { return dependentState; } public ControllerState getWhenRequired() { return whenRequired; } public String getInstallMethod() { return installMethod; } public String getUninstallMethod() { return uninstallMethod; } public String toShortString() { JBossStringBuilder buffer = new JBossStringBuilder(); toShortString(buffer); return buffer.toString(); } public void toShortString(JBossStringBuilder buffer) { if (bean != null) buffer.append(bean); if (whenRequired != null) buffer.append("." + whenRequired.toString()); } public String toString() { return toShortString(); } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractInstallMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000600510625561630033173 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; import org.jboss.util.JBossStringBuilder; /** * Metadata for installation. * * @author Adrian Brock * @version $Revision: 62474 $ */ @XmlType(propOrder={"annotations", "parameters"}) public class AbstractInstallMetaData extends AbstractLifecycleMetaData implements InstallMetaData, Serializable { private static final long serialVersionUID = 1L; /** The bean name */ protected String bean; /** The required state of the dependency or null to look in the registry */ protected ControllerState dependentState = ControllerState.INSTALLED; /** * Create a new install meta data */ public AbstractInstallMetaData() { setState(ControllerState.INSTALLED); } public String getBean() { return bean; } /** * Set the bean * * @param bean the bean */ @XmlAttribute public void setBean(String bean) { this.bean = bean; } /** * Set the required state of the dependency * * @param dependentState the required state or null if it must be in the registry */ @XmlAttribute(name="state") public void setDependentState(ControllerState dependentState) { this.dependentState = dependentState; flushJBossObjectCache(); } public ControllerState getDependentState() { return dependentState; } public void toString(JBossStringBuilder buffer) { if (bean != null) buffer.append("bean=").append(bean); if (ControllerState.INSTALLED.equals(dependentState) == false) buffer.append(" dependentState=" + dependentState); buffer.append(" "); super.toString(buffer); } public void toShortString(JBossStringBuilder buffer) { if (bean != null) { buffer.append(bean).append("."); } if (methodName != null) buffer.append(methodName); } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/FeatureMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000302510625561630033172 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.util.Set; import org.jboss.util.JBossInterface; /** * General MetaData * * @author Adrian Brock * @version $Revision: 45764 $ */ public interface FeatureMetaData extends JBossInterface, MetaDataVisitorNode { /** * Get the descrition. * * @return the description. */ String getDescription(); /** * Get the annotations. * * @return Set. */ Set getAnnotations(); } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/InstallCallbackMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000263411171577572033210 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; /** * Metadata for install callback. * * @author Ales Justin */ public class InstallCallbackMetaData extends AbstractCallbackMetaData { /** The serialVersionUID */ private static final long serialVersionUID = -8687489846562385403L; public InstallCallbackMetaData() { super(); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/DemandMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000302110625561630033166 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.util.JBossInterface; /** * Metadata about what a bean demands. * * @author Adrian Brock * @version $Revision: 40756 $ */ public interface DemandMetaData extends MetaDataVisitorNode, JBossInterface { /** * What is demanded * * @return the demand */ Object getDemand(); /** * Get when the dependency is required * * @return when the dependency is required */ ControllerState getWhenRequired(); } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/CallbackMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000355010625561630033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; /** * Metadata about a callback method. * * @author Ales Justin */ public interface CallbackMetaData extends LifecycleMetaData { /** * Get the cardinality. * * @return cardinality */ Cardinality getCardinality(); /** * Get the property name. * * @return the property name. */ String getProperty(); /** * Get the required state of the dependency * * @return the required state */ ControllerState getDependentState(); /** * Get the when required state * * @return the required state */ ControllerState getWhenRequiredState(); /** * Get signature. * * @return method / property parameter signature */ String getSignature(); } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/ControllerModeValueAdapter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000260511061473704033174 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; /** * ControllerModeValueAdapter. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ControllerModeValueAdapter implements ValueAdapter { public Object cast(Object o, Class c) { return new ControllerMode((String) o); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/DependencyMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000262110625561630033173 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.util.JBossInterface; /** * Metadata about what a bean's dependency. * * @author Adrian Brock * @version $Revision: 40756 $ */ public interface DependencyMetaData extends MetaDataVisitorNode, JBossInterface { /** * What is the dependency * * @return the dependency */ Object getDependency(); } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractCollectionMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000001107211061473704033172 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; import org.jboss.xb.annotations.JBossXmlChild; import org.jboss.xb.annotations.JBossXmlChildWildcard; import org.jboss.xb.annotations.JBossXmlChildren; import org.jboss.xb.annotations.JBossXmlNoElements; /** * Collection metadata. * * @author Adrian Brock * @version $Revision: 59429 $ */ @XmlType() @JBossXmlNoElements @JBossXmlChildren ({ @JBossXmlChild(name="array", type=AbstractArrayMetaData.class), @JBossXmlChild(name="collection", type=AbstractCollectionMetaData.class), @JBossXmlChild(name="inject", type=AbstractDependencyValueMetaData.class), @JBossXmlChild(name="list", type=AbstractListMetaData.class), @JBossXmlChild(name="map", type=AbstractMapMetaData.class), @JBossXmlChild(name="null", type=AbstractValueMetaData.class), @JBossXmlChild(name="set", type=AbstractSetMetaData.class), @JBossXmlChild(name="this", type=ThisValueMetaData.class), @JBossXmlChild(name="value", type=StringValueMetaData.class) }) @JBossXmlChildWildcard(wrapper=AbstractValueMetaData.class, property="value") public class AbstractCollectionMetaData extends AbstractTypeMetaData implements Collection, Serializable { private static final long serialVersionUID = 1L; /** The collection */ protected ArrayList collection = new ArrayList(); /** The element type */ protected String elementType; /** * Create a new collection value */ public AbstractCollectionMetaData() { } /** * Get the element type * * @return the element type */ public String getElementType() { return elementType; } /** * Set the element type * * @param elementType the element type */ @XmlAttribute(name="elementClass") public void setElementType(String elementType) { this.elementType = elementType; } public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable { return null; } public boolean add(MetaDataVisitorNode o) { return collection.add(o); } public boolean addAll(Collection c) { return collection.addAll(c); } public void clear() { collection.clear(); } public boolean contains(Object o) { return collection.contains(o); } public boolean containsAll(Collection c) { return collection.containsAll(c); } public boolean isEmpty() { return collection.isEmpty(); } public Iterator iterator() { return collection.iterator(); } public boolean remove(Object o) { return collection.remove(o); } public boolean removeAll(Collection c) { return collection.removeAll(c); } public boolean retainAll(Collection c) { return collection.retainAll(c); } public int size() { return collection.size(); } public Object[] toArray() { return collection.toArray(); } public T[] toArray(T[] a) { return collection.toArray(a); } public void toString(JBossStringBuilder buffer) { super.toString(buffer); buffer.append(" collection="); JBossObject.list(buffer, collection); } }././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/LifecycleMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000325210625561630033174 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; /** * Metadata about a lifecycle method. * * @author Adrian Brock * @version $Revision: 63037 $ */ public interface LifecycleMetaData extends ParameterizedMetaData, FeatureMetaData { /** * Get the state * * @return the state */ ControllerState getState(); /** * Set the state * * @param state the state */ void setState(ControllerState state); /** * Get the method name. * * @return the method name. */ String getMethodName(); /** * Is default ignored. * * @return should we ignore default */ boolean isIgnored(); } ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/MutableParameterizedMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000262710625561630033201 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.util.List; /** * MutableParameterizedMetaData. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface MutableParameterizedMetaData extends ParameterizedMetaData { /** * Set the parameters. * * @param parameters the parameters */ void setParameters(List parameters); } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/Cardinality.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000001420411171577572033204 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import javax.xml.bind.annotation.XmlType; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; import org.jboss.xb.annotations.JBossXmlAdaptedType; /** * Cardinality def. * * @author Ales Justin */ @XmlType(propOrder={}) @JBossXmlAdaptedType(valueAdapter=CardinalityValueAdapter.class) public class Cardinality extends JBossObject implements Serializable { private static final long serialVersionUID = 2L; public static final int INFINITY = -1; public static final Cardinality ZERO_TO_ONE = new Cardinality("0..1", 0, 1); public static final Cardinality ZERO_TO_MANY = new Cardinality("0..n", 0, INFINITY); public static final Cardinality ONE_TO_ONE = new Cardinality("1..1", 1, 1); public static final Cardinality ONE_TO_MANY = new Cardinality("1..n", 1, INFINITY); private static Cardinality[] values = new Cardinality[] { ZERO_TO_ONE, ZERO_TO_MANY, ONE_TO_ONE, ONE_TO_MANY }; private String type; private int left; private int right; private Cardinality(String type, int left, int right) { this.type = type; this.left = left; this.right = right; } /** * Is number in cardinality's range. * * @param number number to check * @return left <= number <= right */ public boolean isInRange(int number) { return (number < 0 || number < left || left == INFINITY) == false && (number <= right || right == INFINITY); } /** * Get the cardinality by type. * * @param type the commont type * @return cardinality by type */ public static Cardinality toCardinality(String type) { for (Cardinality c : values) { if (c.getType().equals(type)) { return c; } } return fromString(type); } /** * Get limit from string. * * @param limit from string * @return limit as int from string */ protected static int getLimitFromString(String limit) { try { return Integer.parseInt(limit); } catch (NumberFormatException e) { return INFINITY; } } /** * Get limit as string. * * @param limit right limit * @return limit as string */ protected static String getLimitFromInt(int limit) { return limit == INFINITY ? "n" : String.valueOf(limit); } /** * Parse cardinality from string - #1..#2. * * @param string cardinality string * @return cardinality */ public static Cardinality fromString(String string) { if (string == null) throw new IllegalArgumentException("Null string."); if (string.contains("..")) { String[] args = string.split("\\.\\."); if (args == null || args.length != 2) throw new IllegalArgumentException("Illegal cardinality format: " + string); return createCardinality(getLimitFromString(args[0]), getLimitFromString(args[1])); } else return createUnlimitedCardinality(getLimitFromString(string)); } /** * Create cardinality which starts at #start and has no limit. * * @param start the left number of cardinality interval * @return cardinality */ public static Cardinality createUnlimitedCardinality(int start) { return createCardinality(start, INFINITY); } /** * Create cardinality which ends at #end and starts at zero. * * @param end the right number of cardinality interval * @return cardinality */ public static Cardinality createLimitedCardinality(int end) { return createCardinality(0, end); } /** * Create cardinality with [#left, #right] interval. * * @param left left point in interval * @param right right point in interval * @return cardinality */ public static Cardinality createCardinality(int left, int right) { return new Cardinality(getLimitFromInt(left) + ".." + getLimitFromInt(right), left, right); } protected int getHashCode() { return type.hashCode(); } public void toShortString(JBossStringBuilder buffer) { buffer.append("type=").append(type); } protected void toString(JBossStringBuilder buffer) { buffer.append("type=").append(type); } public boolean equals(Object obj) { if (obj instanceof Cardinality == false) return false; Cardinality card = (Cardinality)obj; return left == card.left && right == card.right; } public String getType() { return type; } public int getLeft() { return left; } public int getRight() { return right; } public boolean isLeftInfinity() { return left <= INFINITY; } public boolean isRightInfinity() { return right <= INFINITY; } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractSupplyMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000436710625561630033204 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * A supply. * * @author Adrian Brock * @version $Revision: 59429 $ */ @XmlType public class AbstractSupplyMetaData extends JBossObject implements SupplyMetaData, Serializable { private static final long serialVersionUID = 1L; /** The supply */ protected Object supply; /** * Create a new supply */ public AbstractSupplyMetaData() { } /** * Create a new supply * * @param supply the supply */ public AbstractSupplyMetaData(Object supply) { this.supply = supply; } /** * Set the supply * * @param supply the supply */ @XmlValue public void setSupply(Object supply) { this.supply = supply; flushJBossObjectCache(); } public Object getSupply() { return supply; } public void toString(JBossStringBuilder buffer) { buffer.append("supply=").append(supply); } public void toShortString(JBossStringBuilder buffer) { buffer.append(supply); } } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractParameterMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000001215110645631363033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import org.jboss.util.JBossStringBuilder; /** * Metadata for a parameter. * * @author Adrian Brock * @version $Revision: 60019 $ */ @XmlType(propOrder={"annotations", "value"}) public class AbstractParameterMetaData extends AbstractFeatureMetaData implements ParameterMetaData, ValueMetaDataAware, Serializable { private static final long serialVersionUID = 1L; /** * The parameter type */ protected String type; /** * The parameter value */ protected ValueMetaData value; /** * The index in parameter list */ protected int index; /** * Create a new parameter meta data */ public AbstractParameterMetaData() { } /** * Create a new parameter meta data * * @param value the value */ public AbstractParameterMetaData(Object value) { this.type = value.getClass().getName(); this.value = new AbstractValueMetaData(value); } /** * Create a new parameter meta data * * @param value the value metadata */ public AbstractParameterMetaData(ValueMetaData value) { this.value = value; } /** * Create a new parameter meta data * * @param type the type * @param value the value */ public AbstractParameterMetaData(String type, Object value) { this.type = type; this.value = new AbstractValueMetaData(value); } /** * Create a new parameter meta data * * @param type the type * @param value the string value */ public AbstractParameterMetaData(String type, String value) { this.type = type; this.value = new StringValueMetaData(value); } /** * Create a new parameter meta data * * @param type the type * @param value the value meta data */ public AbstractParameterMetaData(String type, ValueMetaData value) { this.type = type; this.value = value; } public String getType() { return type; } @XmlAttribute(name="class") public void setType(String type) { this.type = type; flushJBossObjectCache(); } public ValueMetaData getValue() { return value; } public int getIndex() { return index; } public void setIndex(int index) { this.index = index; } @XmlElements ({ @XmlElement(name="array", type=AbstractArrayMetaData.class), @XmlElement(name="collection", type=AbstractCollectionMetaData.class), @XmlElement(name="inject", type=AbstractDependencyValueMetaData.class), @XmlElement(name="list", type=AbstractListMetaData.class), @XmlElement(name="map", type=AbstractMapMetaData.class), @XmlElement(name="set", type=AbstractSetMetaData.class), @XmlElement(name="this", type=ThisValueMetaData.class), @XmlElement(name="value", type=StringValueMetaData.class) }) public void setValue(ValueMetaData value) { this.value = value; flushJBossObjectCache(); } @XmlAnyElement public void setValueObject(Object value) { if (value == null) setValue(null); else if (value instanceof ValueMetaData) setValue((ValueMetaData) value); else setValue(new AbstractValueMetaData(value)); } @XmlValue public void setValueString(String value) { if (value == null) setValue(null); else { StringValueMetaData stringValue = new StringValueMetaData(value); stringValue.setType(getType()); setValue(stringValue); } } public void toString(JBossStringBuilder buffer) { buffer.append("type=").append(type); buffer.append(" value=").append(value); super.toString(buffer); } public void toShortString(JBossStringBuilder buffer) { buffer.append(type); } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractInjectionValueMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000661310625561630033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossStringBuilder; /** * Injection value. * * @author Ales Justin */ public class AbstractInjectionValueMetaData extends AbstractDependencyValueMetaData { private static final long serialVersionUID = 2L; protected InjectionType injectionType = InjectionType.BY_CLASS; protected InjectionOption injectionOption = InjectionOption.STRICT; /** * Simplyifies things with InjectionType.BY_NAME */ protected AbstractPropertyMetaData propertyMetaData; /** * Create a new injection value */ public AbstractInjectionValueMetaData() { } /** * Create a new injection value * * @param value the value */ public AbstractInjectionValueMetaData(Object value) { super(value); } /** * Create a new injection value * * @param value the value * @param property the property */ public AbstractInjectionValueMetaData(Object value, String property) { super(value, property); } public InjectionType getInjectionType() { return injectionType; } public void setInjectionType(InjectionType injectionType) { this.injectionType = injectionType; } public InjectionOption getInjectionOption() { return injectionOption; } public void setInjectionOption(InjectionOption injectionOption) { this.injectionOption = injectionOption; } public AbstractPropertyMetaData getPropertyMetaData() { return propertyMetaData; } public void setPropertyMetaData(AbstractPropertyMetaData propertyMetaData) { this.propertyMetaData = propertyMetaData; } public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable { return null; } protected boolean addDependencyItem() { return InjectionOption.STRICT.equals(injectionOption); } public void toString(JBossStringBuilder buffer) { super.toString(buffer); if (injectionType != null) buffer.append(" injectionType=").append(injectionType); if (propertyMetaData != null) buffer.append(" propertyMetaData=").append(propertyMetaData.getName()); //else overflow - indefinite recursion } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/ValueMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000516710645631363033206 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossInterface; import org.jboss.xb.annotations.JBossXmlChild; import org.jboss.xb.annotations.JBossXmlGroup; import org.jboss.xb.annotations.JBossXmlGroupText; import org.jboss.xb.annotations.JBossXmlGroupWildcard; /** * Metadata about a value. * * @author Adrian Brock * @version $Revision: 38049 $ */ @JBossXmlGroup ({ @JBossXmlChild(name="array", type=AbstractArrayMetaData.class), @JBossXmlChild(name="collection", type=AbstractCollectionMetaData.class), @JBossXmlChild(name="inject", type=AbstractDependencyValueMetaData.class), @JBossXmlChild(name="list", type=AbstractListMetaData.class), @JBossXmlChild(name="map", type=AbstractMapMetaData.class), @JBossXmlChild(name="null", type=AbstractValueMetaData.class), @JBossXmlChild(name="set", type=AbstractSetMetaData.class), @JBossXmlChild(name="this", type=ThisValueMetaData.class), @JBossXmlChild(name="value", type=StringValueMetaData.class) }) @JBossXmlGroupText(wrapper=StringValueMetaData.class, property="value") @JBossXmlGroupWildcard(wrapper=AbstractValueMetaData.class, property="value") public interface ValueMetaData extends JBossInterface, MetaDataVisitorNode { /** * Get the underlying value * * @return the underlying value */ public Object getUnderlyingValue(); /** * Get the value. * * @param info the type info * @param cl the classloader * @return the value. * @throws Throwable for any error */ Object getValue(TypeInfo info, ClassLoader cl) throws Throwable; } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractAnnotationMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000566310763275165033214 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import java.lang.annotation.Annotation; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * Metadata for an annotation. * * @author Adrian Brock * @version $Revision: 60497 $ */ @XmlType(propOrder={"annotation"}) public class AbstractAnnotationMetaData extends JBossObject implements AnnotationMetaData, Serializable { private static final long serialVersionUID = 1L; public String annotation; protected Annotation ann; protected boolean replace = true; /** * Create a new annotation meta data */ public AbstractAnnotationMetaData() { super(); } public String getAnnotation() { return annotation; } @XmlValue public void setAnnotation(String annotation) { this.annotation = annotation; } public boolean isReplace() { return replace; } public void setReplace(boolean replace) { this.replace = replace; } public void toString(JBossStringBuilder buffer) { if (ann == null) buffer.append("expr=").append(annotation); else buffer.append("expr=").append(ann); } public void toShortString(JBossStringBuilder buffer) { if (ann == null) buffer.append(annotation); else buffer.append(ann); } protected int getHashCode() { return annotation.hashCode(); } public boolean equals(Object object) { if (object == null || object instanceof AbstractAnnotationMetaData == false) return false; AbstractAnnotationMetaData amd = (AbstractAnnotationMetaData)object; // this is what we probably want? - never saw duplicate annotation on a bean/prop/... return (replace == amd.replace) && annotation.equals(amd.annotation); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AliasMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000247510625561630033202 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.util.JBossInterface; /** * Metadata about an alias attribute. * * @author Ales Justin */ public interface AliasMetaData extends JBossInterface, MetaDataVisitorNode { Object getAliasValue(); } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/ConstructorMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000326310625561630033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; /** * Metadata about construction. * * @author Adrian Brock * @version $Revision: 59524 $ */ public interface ConstructorMetaData extends ParameterizedMetaData, FeatureMetaData { /** * Get the value. * * @return the value. */ ValueMetaData getValue(); /** * Get the factory. * * @return the factory. */ ValueMetaData getFactory(); /** * Get the factory class. * * @return the class name of the factory. */ String getFactoryClass(); /** * Get the factory method. * * @return the factory method. */ String getFactoryMethod(); } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractBeanMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000003544310625561630033203 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; import org.jboss.xb.annotations.JBossXmlSchema; /** * Metadata for a bean. * * @author Adrian Brock * @version $Revision: 62474 $ */ @JBossXmlSchema(namespace="urn:jboss:bean-deployer:2.0", elementFormDefault=XmlNsForm.QUALIFIED) @XmlRootElement(name="bean") @XmlType(propOrder={"aliases", "annotations", "classLoader", "constructor", "properties", "create", "start", "stop", "destroy", "depends", "demands", "supplies", "installs", "uninstalls", "installCallbacks", "uninstallCallbacks"}) public class AbstractBeanMetaData extends AbstractFeatureMetaData implements BeanMetaData, BeanMetaDataFactory, Serializable { private static final long serialVersionUID = 1L; private static final List EMPTY_LIFECYCLE_CALLBACKS = Collections.unmodifiableList(new ArrayList()); /** The bean fully qualified class name */ protected String bean; /** The name of this instance */ protected String name; /** The aliases */ protected Set aliases; /** The mode */ protected ControllerMode mode; /** The properties configuration Set */ private Set properties; /** The bean ClassLoader */ protected ClassLoaderMetaData classLoader; /** The constructor */ protected ConstructorMetaData constructor; /** The create lifecycle */ protected LifecycleMetaData create; /** The start lifecycle */ protected LifecycleMetaData start; /** The stop lifecycle */ protected LifecycleMetaData stop; /** The destroy lifecycle */ protected LifecycleMetaData destroy; /** What the bean demands Set */ protected Set demands; /** What the bean supplies Set */ protected Set supplies; /** What the bean dependencies Set */ protected Set depends; /** The install operations List */ protected List installs; /** The uninstall operations List */ protected List uninstalls; /** The install callback List */ protected List installCallbacks; /** The uninstall callback List */ protected List uninstallCallbacks; /** The uninstall operations List */ protected List lifecycleCallbacks; /** * Create a new bean meta data */ public AbstractBeanMetaData() { super(); } /** * Create a new bean meta data * * @param bean the bean class name */ public AbstractBeanMetaData(String bean) { this.bean = bean; } /** * Create a new bean meta data * * @param name the name * @param bean the bean class name */ public AbstractBeanMetaData(String name, String bean) { this.name = name; this.bean = bean; } public List getBeans() { return Collections.singletonList((BeanMetaData) this); } /** * Get the bean class name. * @return the fully qualified bean class name. */ public String getBean() { return bean; } /** * Set the bean class name and flush the object cache. * * @param bean The bean class name to set. */ @XmlAttribute(name="class") public void setBean(String bean) { this.bean = bean; flushJBossObjectCache(); } /** * Get a property * * @param name the name * @return the property name */ public PropertyMetaData getProperty(String name) { if (name == null) throw new IllegalArgumentException("Null name"); if (properties != null && properties.size() > 0) { for (PropertyMetaData prop : properties) { if (name.equals(prop.getName())) return prop; } } return null; } /** * Add a property * * @param property the property */ public void addProperty(PropertyMetaData property) { if (property == null) throw new IllegalArgumentException("Null property"); if (properties == null) properties = new HashSet(); properties.add(property); flushJBossObjectCache(); } /** * Set the propertiess. * * @param properties Set */ @XmlElement(name="property", type=AbstractPropertyMetaData.class) public void setProperties(Set properties) { this.properties = properties; flushJBossObjectCache(); } public ClassLoaderMetaData getClassLoader() { return classLoader; } @XmlElement(name="classloader", type=AbstractClassLoaderMetaData.class) public void setClassLoader(ClassLoaderMetaData classLoader) { this.classLoader = classLoader; } /** * Set the constructor * * @param constructor the constructor metadata */ @XmlElement(name="constructor", type=AbstractConstructorMetaData.class) public void setConstructor(ConstructorMetaData constructor) { this.constructor = constructor; } /** * Set what the bean demands. * * @param demands Set */ @XmlElement(name="demand", type=AbstractDemandMetaData.class) public void setDemands(Set demands) { this.demands = demands; flushJBossObjectCache(); } /** * Set what the bean supplies. * * @param supplies Set */ @XmlElement(name="supply", type=AbstractSupplyMetaData.class) public void setSupplies(Set supplies) { this.supplies = supplies; flushJBossObjectCache(); } /** * Set what the bean depends. * * @param depends Set */ @XmlElement(name="depends", type=AbstractDependencyMetaData.class) public void setDepends(Set depends) { this.depends = depends; flushJBossObjectCache(); } public String getName() { return name; } /** * Set the name. * * @param name The name to set. */ @XmlAttribute public void setName(String name) { this.name = name; flushJBossObjectCache(); } public Set getAliases() { return aliases; } @XmlElement(name="alias", type=String.class) public void setAliases(Set aliases) { this.aliases = aliases; } public ControllerMode getMode() { return mode; } @XmlAttribute public void setMode(ControllerMode mode) { this.mode = mode; flushJBossObjectCache(); } public Set getProperties() { return properties; } public ConstructorMetaData getConstructor() { return constructor; } public LifecycleMetaData getCreate() { return create; } /** * Set the lifecycle metadata * * @param lifecycle the lifecycle metadata */ @XmlElement(name="create", type=AbstractLifecycleMetaData.class) public void setCreate(LifecycleMetaData lifecycle) { lifecycle.setState(ControllerState.CREATE); this.create = lifecycle; } public LifecycleMetaData getStart() { return start; } /** * Set the start metadata * * @param lifecycle the lifecycle metadata */ @XmlElement(name="start", type=AbstractLifecycleMetaData.class) public void setStart(LifecycleMetaData lifecycle) { lifecycle.setState(ControllerState.START); this.start = lifecycle; } public LifecycleMetaData getStop() { return stop; } /** * Set the stop metadata * * @param lifecycle the lifecycle metadata */ @XmlElement(name="stop", type=AbstractLifecycleMetaData.class) public void setStop(LifecycleMetaData lifecycle) { lifecycle.setState(ControllerState.START); this.stop = lifecycle; } public LifecycleMetaData getDestroy() { return destroy; } /** * Set the destroy metadata * * @param lifecycle the lifecycle metadata */ @XmlElement(name="destroy", type=AbstractLifecycleMetaData.class) public void setDestroy(LifecycleMetaData lifecycle) { lifecycle.setState(ControllerState.CREATE); this.destroy = lifecycle; } public Set getDemands() { return demands; } public Set getSupplies() { return supplies; } public Set getDepends() { return depends; } public List getInstalls() { return installs; } public List getLifecycleCallbacks() { return lifecycleCallbacks; } public void setLifecycleCallbacks(List lifecycleCallbacks) { this.lifecycleCallbacks = lifecycleCallbacks; flushJBossObjectCache(); } /** * Set the installs * * @param installs List */ @XmlElement(name="install", type=AbstractInstallMetaData.class) public void setInstalls(List installs) { this.installs = installs; flushJBossObjectCache(); } public List getUninstalls() { return uninstalls; } /** * Set the uninstalls * * @param uninstalls List */ @XmlElement(name="uninstall", type=AbstractInstallMetaData.class) public void setUninstalls(List uninstalls) { this.uninstalls = uninstalls; flushJBossObjectCache(); } public List getInstallCallbacks() { return installCallbacks; } @XmlElement(name="incallback", type=InstallCallbackMetaData.class) public void setInstallCallbacks(List installCallbacks) { this.installCallbacks = installCallbacks; flushJBossObjectCache(); } public List getUninstallCallbacks() { return uninstallCallbacks; } @XmlElement(name="uncallback", type=UninstallCallbackMetaData.class) public void setUninstallCallbacks(List uninstallCallbacks) { this.uninstallCallbacks = uninstallCallbacks; flushJBossObjectCache(); } public Object getUnderlyingValue() { return name; } @SuppressWarnings("unchecked") public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable { return null; } public void toString(JBossStringBuilder buffer) { buffer.append("name=").append(name); if (aliases != null) buffer.append(" aliases=").append(aliases); buffer.append(" bean=").append(bean); buffer.append(" properties="); JBossObject.list(buffer, properties); if (classLoader != null && classLoader.getClassLoader() != this) buffer.append(" classLoader=").append(classLoader); buffer.append(" constructor=").append(constructor); if (create != null) buffer.append(" create=").append(create); if (start != null) buffer.append(" start=").append(start); if (stop != null) buffer.append(" stop=").append(stop); if (destroy != null) buffer.append(" destroy=").append(destroy); if (demands != null) { buffer.append(" demands="); JBossObject.list(buffer, demands); } super.toString(buffer); if (supplies != null) { buffer.append(" supplies="); JBossObject.list(buffer, supplies); } if (depends != null) { buffer.append(" depends="); JBossObject.list(buffer, depends); } if (installs != null) { buffer.append(" installs="); JBossObject.list(buffer, installs); } if (uninstalls != null) { buffer.append(" uninstalls="); JBossObject.list(buffer, uninstalls); } if (installCallbacks != null) { buffer.append(" installCallbacks="); JBossObject.list(buffer, installCallbacks); } if (uninstallCallbacks != null) { buffer.append(" uninstallCallbacks="); JBossObject.list(buffer, uninstallCallbacks); } if (lifecycleCallbacks != null) { buffer.append(" lifecycleCallbacks="); JBossObject.list(buffer, lifecycleCallbacks); } } public List getLifecycleCallbacks(ControllerState state) { if (state == null) throw new IllegalArgumentException("ControllerState cannot be null!"); List callbacks = EMPTY_LIFECYCLE_CALLBACKS; List allCallbacks = getLifecycleCallbacks(); if (allCallbacks != null && allCallbacks.size() > 0) { for (LifecycleCallbackMetaData lifecycleCallback : allCallbacks) { if (state.equals(lifecycleCallback.getWhenRequired())) { if (callbacks == EMPTY_LIFECYCLE_CALLBACKS) { callbacks = new ArrayList(); } callbacks.add(lifecycleCallback); } } } return callbacks; } public void toShortString(JBossStringBuilder buffer) { buffer.append(bean); buffer.append('/'); buffer.append(name); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/PropertyMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000302210625561630033167 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; /** * Metadata about a property. * * @author Adrian Brock * @version $Revision: 59176 $ */ public interface PropertyMetaData extends FeatureMetaData { /** * Get the name. * * @return the name. */ String getName(); /** * Get property type if possible. * * @return class type if set, otherwise null */ String getType(); /** * Get the value. * * @return the value. */ ValueMetaData getValue(); } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/StringValueMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000504710716074411033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import org.jboss.reflect.spi.TypeInfo; /** * String value. * * @author Adrian Brock * @version $Revision: 59990 $ */ @XmlType //@JBossXmlNoElements public class StringValueMetaData extends AbstractTypeMetaData { private static final long serialVersionUID = 1L; /** * Do we replace String with System property, * by default it is true. */ private boolean replace = true; /** * Create a new string value */ public StringValueMetaData() { } /** * Create a new string value * * @param value the value */ public StringValueMetaData(String value) { super(value); } @Override public String getValue() { return (String) super.getValue(); } /** * Set the value * * @param value the value */ @XmlValue public void setValue(String value) { super.setValue(value); } public void setValue(Object value) { if (value != null && value instanceof String == false) throw new ClassCastException("value is not a String: " + value); super.setValue(value); } public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable { return null; } public boolean isReplace() { return replace; } @XmlTransient public void setReplace(boolean replace) { this.replace = replace; } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractTypeMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000434110625561630033174 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import javax.xml.bind.annotation.XmlAttribute; import org.jboss.util.JBossStringBuilder; /** * A typed value. * * @author Adrian Brock * @version $Revision: 62474 $ */ public abstract class AbstractTypeMetaData extends AbstractValueMetaData implements Serializable { private static final long serialVersionUID = 2L; /** * The type */ protected String type; /** * The property name */ protected String propertyName; /** * The bean name */ protected String beanName; /** * Create a new typed value */ public AbstractTypeMetaData() { } /** * Create a new typed value * * @param value the value */ public AbstractTypeMetaData(String value) { super(value); } /** * Set the type * * @param type the type */ @XmlAttribute(name="class") public void setType(String type) { this.type = type; } public String getType() { return type; } public void toString(JBossStringBuilder buffer) { super.toString(buffer); if (type != null) buffer.append(" type=").append(type); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/ParameterMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000276110625561630033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; /** * Metadata about a parameter. * * @author Adrian Brock * @version $Revision: 59990 $ */ public interface ParameterMetaData extends FeatureMetaData { /** * Get the type. * * @return the type. */ String getType(); /** * Get the value. * * @return the value. */ ValueMetaData getValue(); /** * Get the index * * @return index in list */ int getIndex(); } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractSetMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000636710645631363033211 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import java.util.Collection; import java.util.HashSet; import java.util.Set; import javax.xml.bind.annotation.XmlType; import org.jboss.util.JBossStringBuilder; import org.jboss.xb.annotations.JBossXmlChild; import org.jboss.xb.annotations.JBossXmlChildWildcard; import org.jboss.xb.annotations.JBossXmlChildren; import org.jboss.xb.annotations.JBossXmlNoElements; /** * Set metadata. * * @author Adrian Brock * @version $Revision: 59429 $ */ @XmlType() @JBossXmlNoElements @JBossXmlChildren ({ @JBossXmlChild(name="array", type=AbstractArrayMetaData.class), @JBossXmlChild(name="collection", type=AbstractCollectionMetaData.class), @JBossXmlChild(name="inject", type=AbstractDependencyValueMetaData.class), @JBossXmlChild(name="list", type=AbstractListMetaData.class), @JBossXmlChild(name="map", type=AbstractMapMetaData.class), @JBossXmlChild(name="null", type=AbstractValueMetaData.class), @JBossXmlChild(name="set", type=AbstractSetMetaData.class), @JBossXmlChild(name="this", type=ThisValueMetaData.class), @JBossXmlChild(name="value", type=StringValueMetaData.class) }) @JBossXmlChildWildcard(wrapper=AbstractValueMetaData.class, property="value") public class AbstractSetMetaData extends AbstractCollectionMetaData implements Set, Serializable { private static final long serialVersionUID = 1L; /** * Create a new set value */ public AbstractSetMetaData() { } public boolean add(MetaDataVisitorNode o) { if (collection.contains(o)) return false; return super.add(o); } public boolean addAll(Collection c) { boolean changed = false; if (c != null && c.size() > 0) { for (MetaDataVisitorNode o : c) { if (collection.contains(o) == false) { if (super.add(o)) changed = true; } } } return changed; } public void toString(JBossStringBuilder buffer) { super.toString(buffer); } protected Collection getDefaultCollectionInstance() throws Throwable { return new HashSet(); } }././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/BeanMetaDataFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000261410625561630033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.util.List; import org.jboss.util.JBossInterface; /** * BeanMetaDataFactory. * * @author Adrian Brock * @version $Revision: 45764 $ */ public interface BeanMetaDataFactory extends JBossInterface { /** * Get the beans * * @return a List */ public List getBeans(); } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractMapMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000001273711171577572033215 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import org.jboss.test.xb.builder.object.mc.support.model.MapEntry; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.annotations.JBossXmlMapEntry; /** * Map metadata. * * @author Adrian Brock * @version $Revision: 59429 $ */ @XmlType @JBossXmlMapEntry(name = "entry", type = MapEntry.class) public class AbstractMapMetaData extends AbstractTypeMetaData implements Map, Serializable { private static final long serialVersionUID = 2L; /** The map */ private Map map = new HashMap(); /** The key type */ protected String keyType; /** The value type */ protected String valueType; /** * Create a new map value */ public AbstractMapMetaData() { } /** * Get the key type * * @return the key type */ public String getKeyType() { return keyType; } /** * Set the key type * * @param keyType the key type */ @XmlAttribute(name = "keyClass") public void setKeyType(String keyType) { this.keyType = keyType; } /** * Get the value type * * @return the value type */ public String getValueType() { return valueType; } /** * Set the value type * * @param valueType the value type */ @XmlAttribute(name = "valueClass") public void setValueType(String valueType) { this.valueType = valueType; } @SuppressWarnings("unchecked") public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable { Map result = getExpectedClass().newInstance();//getTypeInstance(info, cl, getExpectedClass()); TypeInfo keyTypeInfo = ((ClassInfo) info).getKeyType();// getKeyClassInfo(cl); TypeInfo valueTypeInfo = ((ClassInfo) info).getValueType();//getValueClassInfo(cl); if (map.size() > 0) { for (Iterator i = map.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); ValueMetaData key = (ValueMetaData) entry.getKey(); ValueMetaData value = (ValueMetaData) entry.getValue(); Object keyValue = key.getValue(keyTypeInfo, cl); Object valueValue = value.getValue(valueTypeInfo, cl); result.put(keyValue, valueValue); } } return result; } public void clear() { map.clear(); } public boolean containsKey(Object key) { return map.containsKey(key); } public boolean containsValue(Object value) { return map.containsValue(value); } public Set> entrySet() { return map.entrySet(); } public MetaDataVisitorNode get(Object key) { return map.get(key); } @XmlTransient public boolean isEmpty() { return map.isEmpty(); } public Set keySet() { return map.keySet(); } public MetaDataVisitorNode put(MetaDataVisitorNode key, MetaDataVisitorNode value) { return map.put(key, value); } public void putAll(Map t) { map.putAll(t); } public MetaDataVisitorNode remove(Object key) { return map.remove(key); } public int size() { return map.size(); } public Collection values() { return map.values(); } @XmlTransient public Iterator getChildren() { ArrayList children = new ArrayList(keySet()); children.addAll(values()); return children.iterator(); } /** * Create the default map instance * * @return the class instance */ @XmlTransient protected Object getDefaultInstance() { return new HashMap(); } @XmlTransient protected Class getExpectedClass() { return Map.class; } }././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/ControllerState.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000001013610625561630033173 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.ObjectStreamException; import java.io.Serializable; import java.util.HashMap; import java.util.Map; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * Description of state. * * @author Adrian Brock * @version $Revision: 60558 $ */ public class ControllerState extends JBossObject implements Serializable { private static final long serialVersionUID = 2L; /** Error */ public static final ControllerState ERROR = new ControllerState("**ERROR**"); /** Not installed state */ public static final ControllerState NOT_INSTALLED = new ControllerState("Not Installed"); /** Pre install state */ public static final ControllerState PRE_INSTALL = new ControllerState("PreInstall"); /** Described state */ public static final ControllerState DESCRIBED = new ControllerState("Described"); /** Instantiated state */ public static final ControllerState INSTANTIATED = new ControllerState("Instantiated"); /** Configured state */ public static final ControllerState CONFIGURED = new ControllerState("Configured"); /** Create state */ public static final ControllerState CREATE = new ControllerState("Create"); /** Start state */ public static final ControllerState START = new ControllerState("Start"); /** Installed state */ public static final ControllerState INSTALLED = new ControllerState("Installed"); /** The state string */ protected final String stateString; private static Map values = new HashMap(); static { values.put(ERROR.getStateString(), ERROR); values.put(NOT_INSTALLED.getStateString(), NOT_INSTALLED); values.put(PRE_INSTALL.getStateString(), PRE_INSTALL); values.put(DESCRIBED.getStateString(), DESCRIBED); values.put(INSTANTIATED.getStateString(), INSTANTIATED); values.put(CONFIGURED.getStateString(), CONFIGURED); values.put(CREATE.getStateString(), CREATE); values.put(START.getStateString(), START); values.put(INSTALLED.getStateString(), INSTALLED); } /** * Create a new state * * @param stateString the string representation */ public ControllerState(String stateString) { if (stateString == null) throw new IllegalArgumentException("Null state string"); this.stateString = stateString; } /** * Get the state string * * @return the state string */ public String getStateString() { return stateString; } public boolean equals(Object object) { if (object == null || object instanceof ControllerState == false) return false; ControllerState other = (ControllerState) object; return stateString.equals(other.stateString); } public void toString(JBossStringBuilder buffer) { buffer.append(stateString); } protected int getHashCode() { return stateString.hashCode(); } protected Object readResolve() throws ObjectStreamException { return values.get(stateString); } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractDependencyMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000455710625561630033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; /** * A dependency. * * @author Adrian Brock * @version $Revision: 59429 $ */ @XmlType public class AbstractDependencyMetaData extends JBossObject implements DependencyMetaData, Serializable { private static final long serialVersionUID = 1L; /** The dependency, may transient? */ protected Object dependency; /** * Create a new dependency */ public AbstractDependencyMetaData() { } /** * Create a new dependency * * @param dependency the dependency */ public AbstractDependencyMetaData(Object dependency) { this.dependency = dependency; } /** * Set the dependency * * @param dependency the dependency */ @XmlValue public void setDependency(Object dependency) { this.dependency = dependency; flushJBossObjectCache(); } public Object getDependency() { return dependency; } public void toString(JBossStringBuilder buffer) { buffer.append("dependency=").append(dependency); } public void toShortString(JBossStringBuilder buffer) { buffer.append(dependency); } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/ControllerMode.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000631410625561630033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import org.jboss.util.JBossObject; import org.jboss.util.JBossStringBuilder; import java.util.Map; import java.util.HashMap; import java.io.ObjectStreamException; import java.io.Serializable; /** * Mode of the context. * * @author Adrian Brock * @version $Revision: 59941 $ */ public class ControllerMode extends JBossObject implements Serializable { private static final long serialVersionUID = 1L; /** Automatic */ public static final ControllerMode AUTOMATIC = new ControllerMode("Automatic"); /** On demand */ public static final ControllerMode ON_DEMAND = new ControllerMode("On Demand"); /** Manual */ public static final ControllerMode MANUAL = new ControllerMode("Manual"); /** Disabled */ public static final ControllerMode DISABLED = new ControllerMode("Disabled"); /** The mode string */ protected final String modeString; private static Map values = new HashMap(); static { values.put(AUTOMATIC.getModeString(), AUTOMATIC); values.put(ON_DEMAND.getModeString(), ON_DEMAND); values.put(MANUAL.getModeString(), MANUAL); values.put(DISABLED.getModeString(), DISABLED); } /** * Create a new mode * * @param modeString the mode representation */ public ControllerMode(String modeString) { if (modeString == null) throw new IllegalArgumentException("Null mode string"); this.modeString = modeString; } /** * Get the mode string * * @return the mdoe string */ public String getModeString() { return modeString; } public boolean equals(Object object) { if (object == null || object instanceof ControllerMode == false) return false; ControllerMode other = (ControllerMode) object; return modeString.equals(other.modeString); } public void toString(JBossStringBuilder buffer) { buffer.append(modeString); } protected int getHashCode() { return modeString.hashCode(); } protected Object readResolve() throws ObjectStreamException { return values.get(modeString); } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractPropertiesMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000377410625561630033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.util.Map; import java.util.Properties; /** * Properties metadata. * * @author Ales Justin */ public class AbstractPropertiesMetaData extends AbstractMapMetaData { private static final long serialVersionUID = 1L; protected Map getDefaultMapInstance() throws Throwable { return new Properties(); } protected Class expectedMapClass() { return Properties.class; } public String getKeyType() { return String.class.getName(); } public void setKeyType(String keyType) { throw new IllegalArgumentException("Illegal call to set properties key type!"); } public String getValueType() { return String.class.getName(); } public void setValueType(String valueType) { throw new IllegalArgumentException("Illegal call to set properties value type!"); } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/model/AbstractListMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/mo0000644000175000017500000000723110645631363033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support.model; import java.io.Serializable; import java.util.Collection; import java.util.List; import java.util.ListIterator; import javax.xml.bind.annotation.XmlType; import org.jboss.util.JBossStringBuilder; import org.jboss.xb.annotations.JBossXmlChild; import org.jboss.xb.annotations.JBossXmlChildWildcard; import org.jboss.xb.annotations.JBossXmlChildren; import org.jboss.xb.annotations.JBossXmlNoElements; /** * List metadata. * * @author Adrian Brock * @version $Revision: 59429 $ */ @XmlType() @JBossXmlNoElements @JBossXmlChildren ({ @JBossXmlChild(name="array", type=AbstractArrayMetaData.class), @JBossXmlChild(name="collection", type=AbstractCollectionMetaData.class), @JBossXmlChild(name="inject", type=AbstractDependencyValueMetaData.class), @JBossXmlChild(name="list", type=AbstractListMetaData.class), @JBossXmlChild(name="map", type=AbstractMapMetaData.class), @JBossXmlChild(name="null", type=AbstractValueMetaData.class), @JBossXmlChild(name="set", type=AbstractSetMetaData.class), @JBossXmlChild(name="this", type=ThisValueMetaData.class), @JBossXmlChild(name="value", type=StringValueMetaData.class) }) @JBossXmlChildWildcard(wrapper=AbstractValueMetaData.class, property="value") public class AbstractListMetaData extends AbstractCollectionMetaData implements List, Serializable { private static final long serialVersionUID = 1L; /** * Create a new list value */ public AbstractListMetaData() { } public void add(int index, MetaDataVisitorNode element) { collection.add(index, element); } public boolean addAll(int index, Collection c) { return collection.addAll(index, c); } public MetaDataVisitorNode get(int index) { return collection.get(index); } public int indexOf(Object o) { return collection.indexOf(o); } public int lastIndexOf(Object o) { return lastIndexOf(o); } public ListIterator listIterator() { return collection.listIterator(); } public ListIterator listIterator(int index) { return collection.listIterator(index); } public MetaDataVisitorNode remove(int index) { return collection.remove(index); } public MetaDataVisitorNode set(int index, MetaDataVisitorNode element) { return set(index, element); } public List subList(int fromIndex, int toIndex) { return subList(fromIndex, toIndex); } public void toString(JBossStringBuilder buffer) { super.toString(buffer); } }././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/SerializableObject.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/Se0000644000175000017500000000246410625561630033134 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support; import java.io.Serializable; /** * Simple serializable class. * * @author Ales Justin */ public class SerializableObject implements Serializable { private static final long serialVersionUID = -1L; } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/Annotation2.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/An0000644000175000017500000000224010625561630033113 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support; /** * * @author Kabir Khan * @version $Revision: 46386 $ */ public @interface Annotation2 { } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/TestBeanMetaDataFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/Te0000644000175000017500000000370010625561630033127 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaDataFactory; import org.jboss.util.JBossObject; /** * TestBeanMetaDataFactory. * * @author Adrian Brock * @version $Revision: 59941 $ */ public class TestBeanMetaDataFactory extends JBossObject implements BeanMetaDataFactory, Serializable { private static final long serialVersionUID = 1L; public List getBeans() { ArrayList result = new ArrayList(); AbstractBeanMetaData bean = new AbstractBeanMetaData("Bean1"); result.add(bean); bean = new AbstractBeanMetaData("Bean2"); result.add(bean); return result; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/Annotation3.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/An0000644000175000017500000000224010625561630033113 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support; /** * * @author Kabir Khan * @version $Revision: 46386 $ */ public @interface Annotation3 { } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/TestBeanMetaDataFactory1.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/Te0000644000175000017500000000370110625561630033130 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import org.jboss.test.xb.builder.object.mc.support.model.AbstractBeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaData; import org.jboss.test.xb.builder.object.mc.support.model.BeanMetaDataFactory; import org.jboss.util.JBossObject; /** * TestBeanMetaDataFactory. * * @author Adrian Brock * @version $Revision: 59941 $ */ public class TestBeanMetaDataFactory1 extends JBossObject implements BeanMetaDataFactory, Serializable { private static final long serialVersionUID = 1L; public List getBeans() { ArrayList result = new ArrayList(); AbstractBeanMetaData bean = new AbstractBeanMetaData("Bean3"); result.add(bean); bean = new AbstractBeanMetaData("Bean4"); result.add(bean); return result; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/MyObject.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/My0000644000175000017500000000360511310425750033142 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support; /** * A MyObject. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class MyObject { private String key; public MyObject() { } public MyObject(String key) { this.key = key; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public boolean equals(Object object) { if (this == object) return true; if (object == null || object instanceof MyObject == false) return false; MyObject other = (MyObject) object; return key.equals(other.key); } public int hashCode() { return key.hashCode(); } public String toString() { return key; } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/AnnotationWithAttribute.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/An0000644000175000017500000000230210625561630033112 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support; /** * * @author Kabir Khan * @version $Revision: 46386 $ */ public @interface AnnotationWithAttribute { Class attribute(); } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/Annotation1.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/An0000644000175000017500000000224010625561630033113 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support; /** * * @author Kabir Khan * @version $Revision: 46386 $ */ public @interface Annotation1 { } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/AnnotationWithAttributes.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/mc/support/An0000644000175000017500000000234210625561630033116 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.mc.support; /** * * @author Kabir Khan * @version $Revision: 46386 $ */ public @interface AnnotationWithAttributes { Class clazz(); int integer(); String str(); } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapentry/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapen0000755000175000017500000000000011620316750033321 5ustar twernertwerner././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapen0000755000175000017500000000000011620316750033321 5ustar twernertwerner././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapentry/test/JBossXmlMapEntryUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapen0000644000175000017500000001265110745477115033342 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlmapentry.test; import java.util.Map; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.jbossxmlmapentry.support.EntryTypeKeyAttributeValueEntry; import org.jboss.test.xb.builder.object.jbossxmlmapentry.support.Root; /** * A JBossXmlMapEntryUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class JBossXmlMapEntryUnitTestCase extends AbstractBuilderTest { public JBossXmlMapEntryUnitTestCase(String name) { super(name); } public void testKeyValueSequence() throws Exception { Root root = unmarshalObject(Root.class); assertMap(root.getKeyValueSequence()); } public void testAnnotatedMapKeyValueSequence() throws Exception { Root root = unmarshalObject(Root.class); assertMap(root.getAnnotatedMapKeyValueSequence()); } public void testWrappedKeyValueSequence() throws Exception { Root root = unmarshalObject(Root.class); assertMap(root.getWrappedKeyValueSequence()); } public void testAnnotatedMapWrappedKeyValueSequence() throws Exception { Root root = unmarshalObject(Root.class); assertMap(root.getAnnotatedMapWrappedKeyValueSequence()); } public void testKeyValueAttributes() throws Exception { Root root = unmarshalObject(Root.class); assertMap(root.getKeyValueAttributes()); } public void testAnnotatedMapKeyValueAttributes() throws Exception { Root root = unmarshalObject(Root.class); assertMap(root.getAnnotatedMapKeyValueAttributes()); } public void testKeyAttributeValueEntryContent() throws Exception { Root root = unmarshalObject(Root.class); assertMap(root.getKeyAttributeValueEntryContent()); } public void testAnnotatedMapKeyAttributeValueEntryContent() throws Exception { Root root = unmarshalObject(Root.class); assertMap(root.getAnnotatedMapKeyAttributeValueEntryContent()); } public void testEntryTypeKeyAttributeValueEntryContent() throws Exception { Root root = unmarshalObject(Root.class); assertMap(root.getEntryTypeKeyAttributeValueEntryContent()); } public void testAnnotatedMapWithEntryTypeKeyAttributeValueEntryContent() throws Exception { Root root = unmarshalObject(Root.class); assertMap(root.getAnnotatedMapWithEntryTypeKeyAttributeValueEntryContent()); } public void testEntryTypeKeyAttributeValueEntry() throws Exception { Root root = unmarshalObject(Root.class); Map map = root.getEntryTypeKeyAttributeValueEntry(); assertMapWithEntry(map); } public void testAnnotatedMapWithEntryTypeKeyAttributeValueEntry() throws Exception { Root root = unmarshalObject(Root.class); Map map = root.getAnnotatedMapWithEntryTypeKeyAttributeValueEntry(); assertMapWithEntry(map); } public void testXmlElementWrapperMap() throws Exception { Root root = unmarshalObject(Root.class); assertMap(root.getXmlElementWrapperMap()); } private void assertMapWithEntry(Map map) { assertNotNull(map); assertEquals(3, map.size()); EntryTypeKeyAttributeValueEntry entry = map.get("key1"); assertNotNull(entry); assertEquals("key1", entry.getKey()); assertEquals("attr1", entry.getValueAttribute()); assertEquals(new Integer(1), entry.getValueElement()); entry = map.get("key2"); assertNotNull(entry); assertEquals("key2", entry.getKey()); assertEquals("attr2", entry.getValueAttribute()); assertEquals(new Integer(22), entry.getValueElement()); entry = map.get("key3"); assertNotNull(entry); assertEquals("key3", entry.getKey()); assertEquals("attr3", entry.getValueAttribute()); assertEquals(new Integer(333), entry.getValueElement()); } private void assertMap(Map map) { assertNotNull(map); assertEquals(3, map.size()); assertEquals(new Integer(1), map.get("key1")); assertEquals(new Integer(22), map.get("key2")); assertEquals(new Integer(333), map.get("key3")); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapentry/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapen0000755000175000017500000000000011620316750033321 5ustar twernertwerner././@LongLink0000000000000000000000000000025400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapentry/support/AnnotatedMapWithEntryTypeKeyAttributeValueEntryContent.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapen0000644000175000017500000000325010744155032033323 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlmapentry.support; import java.util.HashMap; import org.jboss.xb.annotations.JBossXmlMapEntry; /** * A AnnotatedMapWithEntryTypeKeyAttributeValueEntryContent. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlMapEntry(name = "annotated-map-with-entry-type-key-attr-value-entry-content", type=EntryTypeKeyAttributeValueEntryContent.class) public class AnnotatedMapWithEntryTypeKeyAttributeValueEntryContent extends HashMap { /** The serialVersionUID */ private static final long serialVersionUID = 1L; } ././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapentry/support/AnnotatedMapKeyValueAttributes.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapen0000644000175000017500000000335310744155032033327 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlmapentry.support; import java.util.HashMap; import org.jboss.xb.annotations.JBossXmlMapEntry; import org.jboss.xb.annotations.JBossXmlMapKeyAttribute; import org.jboss.xb.annotations.JBossXmlMapValueAttribute; /** * A AnnotatedMapKeyValueAttributes. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlMapEntry(name = "annotated-map-key-value-attr") @JBossXmlMapKeyAttribute(name = "key") @JBossXmlMapValueAttribute(name = "value") public class AnnotatedMapKeyValueAttributes extends HashMap { /** The serialVersionUID */ private static final long serialVersionUID = 1L; } ././@LongLink0000000000000000000000000000023700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapentry/support/AnnotatedMapKeyAttributeValueEntryContent.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapen0000644000175000017500000000325510744155032033330 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlmapentry.support; import java.util.HashMap; import org.jboss.xb.annotations.JBossXmlMapEntry; import org.jboss.xb.annotations.JBossXmlMapKeyAttribute; /** * A AnnotatedMapKeyAttributeValueEntryContent. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlMapEntry(name = "annotated-map-key-attr-value-entry-content") @JBossXmlMapKeyAttribute(name = "key") public class AnnotatedMapKeyAttributeValueEntryContent extends HashMap { /** The serialVersionUID */ private static final long serialVersionUID = 1L; } ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapentry/support/EntryTypeKeyAttributeValueEntry.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapen0000644000175000017500000000421110743142021033312 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlmapentry.support; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import org.jboss.xb.annotations.JBossXmlMapKey; /** * A EntryTypeKeyAttributeValueEntry. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class EntryTypeKeyAttributeValueEntry { private String key; private String valueAttribute; private Integer valueElement; @JBossXmlMapKey @XmlAttribute public String getKey() { return key; } public void setKey(String key) { this.key = key; } @XmlAttribute(name="attr") public String getValueAttribute() { return valueAttribute; } public void setValueAttribute(String valueAttribute) { this.valueAttribute = valueAttribute; } @XmlElement(name="value") public Integer getValueElement() { return valueElement; } public void setValueElement(Integer valueElement) { this.valueElement = valueElement; } } ././@LongLink0000000000000000000000000000022200000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapentry/support/AnnotatedMapKeyValueSequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapen0000644000175000017500000000320110744155032033317 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlmapentry.support; import java.util.HashMap; import org.jboss.xb.annotations.JBossXmlMapKeyElement; import org.jboss.xb.annotations.JBossXmlMapValueElement; /** * A AnnotatedMapKeyValueSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlMapKeyElement(name = "key-kvs") @JBossXmlMapValueElement(name = "value-kvs") public class AnnotatedMapKeyValueSequence extends HashMap { /** The serialVersionUID */ private static final long serialVersionUID = 1L; } ././@LongLink0000000000000000000000000000024500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapentry/support/AnnotatedMapWithEntryTypeKeyAttributeValueEntry.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapen0000644000175000017500000000332610744155032033327 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlmapentry.support; import java.util.HashMap; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlMapEntry; /** * A AnnotatedMapWithEntryTypeKeyAttributeValueEntry. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlType @JBossXmlMapEntry(name = "annotated-map-entry-type-key-attr-value-entry", type=EntryTypeKeyAttributeValueEntry.class) public class AnnotatedMapWithEntryTypeKeyAttributeValueEntry extends HashMap { /** The serialVersionUID */ private static final long serialVersionUID = 1L; } ././@LongLink0000000000000000000000000000023100000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapentry/support/AnnotatedMapWrappedKeyValueSequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapen0000644000175000017500000000337110744155032033327 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlmapentry.support; import java.util.HashMap; import org.jboss.xb.annotations.JBossXmlMapEntry; import org.jboss.xb.annotations.JBossXmlMapKeyElement; import org.jboss.xb.annotations.JBossXmlMapValueElement; /** * A AnnotatedMapWrappedKeyValueSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlMapEntry(name = "annotated-map-wrapped-key-value") @JBossXmlMapKeyElement(name = "key") @JBossXmlMapValueElement(name = "value") public class AnnotatedMapWrappedKeyValueSequence extends HashMap { /** The serialVersionUID */ private static final long serialVersionUID = 1L; } ././@LongLink0000000000000000000000000000023400000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapentry/support/EntryTypeKeyAttributeValueEntryContent.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapen0000644000175000017500000000362610743142021033323 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlmapentry.support; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlValue; import org.jboss.xb.annotations.JBossXmlMapKey; import org.jboss.xb.annotations.JBossXmlMapValue; /** * A EntryTypeKeyAttributeValueEntryContent. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class EntryTypeKeyAttributeValueEntryContent { private String key; private Integer value; @JBossXmlMapKey @XmlAttribute public String getKey() { return key; } public void setKey(String key) { this.key = key; } @JBossXmlMapValue @XmlValue public Integer getValue() { return value; } public void setValue(Integer value) { this.value = value; } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapentry/support/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlmapen0000644000175000017500000001655711171577572033355 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlmapentry.support; import java.util.Map; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlMapEntry; import org.jboss.xb.annotations.JBossXmlMapKeyAttribute; import org.jboss.xb.annotations.JBossXmlMapKeyElement; import org.jboss.xb.annotations.JBossXmlMapValueAttribute; import org.jboss.xb.annotations.JBossXmlMapValueElement; import org.jboss.xb.annotations.JBossXmlSchema; import org.jboss.xb.annotations.JBossXmlType; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement @JBossXmlSchema(namespace="ns", elementFormDefault= XmlNsForm.QUALIFIED) @JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_CHOICE) public class Root { private Map stringToInteger; private Map entryTypeMap; private AnnotatedMapKeyValueSequence annotatedMapKeyValueSequence; private AnnotatedMapWrappedKeyValueSequence annotatedWrappedMapKeyValueSequence; private AnnotatedMapKeyValueAttributes annotatedMapKeyValueAttributes; private AnnotatedMapKeyAttributeValueEntryContent annotatedMapKeyAttributeValueEntryContent; private AnnotatedMapWithEntryTypeKeyAttributeValueEntryContent annotatedMapWithEntryTypeKeyAttributeValueEntryContent; private Map annotatedMapWithEntryTypeKeyAttributeValueEntry; @JBossXmlMapKeyElement(name = "key") @JBossXmlMapValueElement(name = "value") public Map getKeyValueSequence() { return this.stringToInteger; } public void setKeyValueSequence(Map value) { this.stringToInteger = value; } public AnnotatedMapKeyValueSequence getAnnotatedMapKeyValueSequence() { return this.annotatedMapKeyValueSequence; } public void setAnnotatedMapKeyValueSequence(AnnotatedMapKeyValueSequence value) { this.annotatedMapKeyValueSequence = value; } @JBossXmlMapEntry(name = "wrapped-key-value") @JBossXmlMapKeyElement(name = "key") @JBossXmlMapValueElement(name = "value") public Map getWrappedKeyValueSequence() { return this.stringToInteger; } public void setWrappedKeyValueSequence(Map value) { this.stringToInteger = value; } public AnnotatedMapWrappedKeyValueSequence getAnnotatedMapWrappedKeyValueSequence() { return this.annotatedWrappedMapKeyValueSequence; } public void setAnnotatedMapWrappedKeyValueSequence(AnnotatedMapWrappedKeyValueSequence value) { this.annotatedWrappedMapKeyValueSequence = value; } @JBossXmlMapEntry(name = "key-value-attr") @JBossXmlMapKeyAttribute(name = "key") @JBossXmlMapValueAttribute(name = "value") public Map getKeyValueAttributes() { return this.stringToInteger; } public void setKeyValueAttributes(Map value) { this.stringToInteger = value; } public AnnotatedMapKeyValueAttributes getAnnotatedMapKeyValueAttributes() { return this.annotatedMapKeyValueAttributes; } public void setAnnotatedMapKeyValueAttributes(AnnotatedMapKeyValueAttributes value) { this.annotatedMapKeyValueAttributes = value; } @JBossXmlMapEntry(name = "key-attr-value-entry-content") @JBossXmlMapKeyAttribute(name = "key") public Map getKeyAttributeValueEntryContent() { return this.stringToInteger; } public void setKeyAttributeValueEntryContent(Map value) { this.stringToInteger = value; } public AnnotatedMapKeyAttributeValueEntryContent getAnnotatedMapKeyAttributeValueEntryContent() { return this.annotatedMapKeyAttributeValueEntryContent; } public void setAnnotatedMapKeyAttributeValueEntryContent(AnnotatedMapKeyAttributeValueEntryContent value) { this.annotatedMapKeyAttributeValueEntryContent = value; } @JBossXmlMapEntry(name = "entry-type-key-attr-value-entry-content", type=EntryTypeKeyAttributeValueEntryContent.class) public Map getEntryTypeKeyAttributeValueEntryContent() { return this.stringToInteger; } public void setEntryTypeKeyAttributeValueEntryContent(Map value) { this.stringToInteger = value; } public AnnotatedMapWithEntryTypeKeyAttributeValueEntryContent getAnnotatedMapWithEntryTypeKeyAttributeValueEntryContent() { return this.annotatedMapWithEntryTypeKeyAttributeValueEntryContent; } public void setAnnotatedMapWithEntryTypeKeyAttributeValueEntryContent(AnnotatedMapWithEntryTypeKeyAttributeValueEntryContent value) { this.annotatedMapWithEntryTypeKeyAttributeValueEntryContent = value; } @JBossXmlMapEntry(name = "entry-type-key-attr-value-entry", type=EntryTypeKeyAttributeValueEntry.class) public Map getEntryTypeKeyAttributeValueEntry() { return this.entryTypeMap; } public void setEntryTypeKeyAttributeValueEntry(Map value) { this.entryTypeMap = value; } @XmlElement(type=AnnotatedMapWithEntryTypeKeyAttributeValueEntry.class) public Map getAnnotatedMapWithEntryTypeKeyAttributeValueEntry() { return this.annotatedMapWithEntryTypeKeyAttributeValueEntry; } public void setAnnotatedMapWithEntryTypeKeyAttributeValueEntry(Map value) { this.annotatedMapWithEntryTypeKeyAttributeValueEntry = value; } @XmlElementWrapper(name="map") @JBossXmlMapEntry(name = "entry") @JBossXmlMapKeyAttribute(name = "key") public Map getXmlElementWrapperMap() { return this.stringToInteger; } public void setXmlElementWrapperMap(Map value) { this.stringToInteger = value; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/anyattribute/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/anyattribute/0000755000175000017500000000000011620316756033237 5ustar twernertwerner././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/anyattribute/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/anyattribute/0000755000175000017500000000000011620316756033237 5ustar twernertwerner././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/anyattribute/test/AnyAttributeUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/anyattribute/0000755000175000017500000000412311075435045033241 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.anyattribute.test; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.anyattribute.support.AnyAttributes; /** * A AnyAttributeUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class AnyAttributeUnitTestCase extends AbstractBuilderTest { public AnyAttributeUnitTestCase(String name) { super(name); } public void testUnmarshal() throws Exception { AnyAttributes result = unmarshalObject(AnyAttributes.class); assertEquals("static", result.getStaticAttribute()); Map anyAttributes = result.getAnyAttributes(); assertNotNull(anyAttributes); assertEquals(2, anyAttributes.size()); Object value = anyAttributes.get(new QName("attr1")); assertEquals("value1", value); value = anyAttributes.get(new QName("attr2")); assertEquals("value2", value); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/anyattribute/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/anyattribute/0000755000175000017500000000000011620316756033237 5ustar twernertwerner././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/anyattribute/support/AnyAttributes.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/anyattribute/0000755000175000017500000000370211075435045033243 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.anyattribute.support; import java.util.Map; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.namespace.QName; /** * A AnyAttributes. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class AnyAttributes { private Map anyAttributes; private String staticAttribute; @XmlAnyAttribute public void setAnyAttributes(Map anyAttributes) { this.anyAttributes = anyAttributes; } public Map getAnyAttributes() { return this.anyAttributes; } @XmlAttribute public void setStaticAttribute(String staticAttribute) { this.staticAttribute = staticAttribute; } public String getStaticAttribute() { return this.staticAttribute; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/ObjectTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/ObjectTestSui0000644000175000017500000000427210625561630033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.attribute.ObjectAttributeTestSuite; import org.jboss.test.xb.builder.object.element.ObjectElementTestSuite; import org.jboss.test.xb.builder.object.javabean.ObjectJavaBeanTestSuite; import org.jboss.test.xb.builder.object.mc.ObjectMCTestSuite; import org.jboss.test.xb.builder.object.schema.ObjectSchemaTestSuite; import org.jboss.test.xb.builder.object.type.ObjectTypeTestSuite; /** * ObjectTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object Tests"); suite.addTest(ObjectSchemaTestSuite.suite()); suite.addTest(ObjectElementTestSuite.suite()); suite.addTest(ObjectTypeTestSuite.suite()); suite.addTest(ObjectAttributeTestSuite.suite()); suite.addTest(ObjectJavaBeanTestSuite.suite()); suite.addTest(ObjectMCTestSuite.suite()); return suite; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltransient/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltrans0000755000175000017500000000000011620316751033351 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltransient/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltrans0000755000175000017500000000000011620316751033351 5ustar twernertwerner././@LongLink0000000000000000000000000000024200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltransient/test/JBossXmlTransientTypeAndPropertiesUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltrans0000644000175000017500000000560611225465065033366 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmltransient.test; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.jbossxmltransient.support.ExtendedBase; import org.jboss.test.xb.builder.object.jbossxmltransient.support.ExtendedJBossObject; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A JBossXmlTransientTypeAndPropertiesUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class JBossXmlTransientTypeAndPropertiesUnitTestCase extends AbstractBuilderTest { public JBossXmlTransientTypeAndPropertiesUnitTestCase(String name) { super(name); } public void testExtendedJBossObject() throws Exception { SchemaBinding schema = JBossXBBuilder.build(ExtendedJBossObject.class, true); ElementBinding root = schema.getElement(new QName("root")); assertNotNull(root); ParticleBinding particle = root.getType().getParticle(); assertNotNull(particle); ModelGroupBinding group = (ModelGroupBinding) particle.getTerm(); assertTrue(group.getParticles().isEmpty()); } public void testAllProperties() throws Exception { SchemaBinding schema = JBossXBBuilder.build(ExtendedBase.class, true); ElementBinding root = schema.getElement(new QName("root")); assertNotNull(root); ParticleBinding particle = root.getType().getParticle(); assertNotNull(particle); ModelGroupBinding group = (ModelGroupBinding) particle.getTerm(); assertTrue(group.getParticles().isEmpty()); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltransient/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltrans0000755000175000017500000000000011620316751033351 5ustar twernertwerner././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltransient/support/package-info.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltrans0000644000175000017500000000274211225465065033364 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ @JBossXmlTransients({ // mark specific property in the type as transient @JBossXmlTransient(type = JBossObject.class, properties={"classShortName"}), // not specifying properties will make them all transient in the type @JBossXmlTransient(type = Base.class) }) package org.jboss.test.xb.builder.object.jbossxmltransient.support; import org.jboss.util.JBossObject; import org.jboss.xb.annotations.JBossXmlTransient;import org.jboss.xb.annotations.JBossXmlTransients; ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltransient/support/Base.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltrans0000644000175000017500000000276311225465065033367 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmltransient.support; /** * A Base. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class Base { private String a; private String b; public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltransient/support/ExtendedBase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltrans0000644000175000017500000000257411225465065033367 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmltransient.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A ExtendedB. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={}) public class ExtendedBase extends Base { } ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltransient/support/ExtendedJBossObject.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmltrans0000644000175000017500000000255011225465065033361 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmltransient.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.util.JBossObject; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") public class ExtendedJBossObject extends JBossObject { } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/0000755000175000017500000000000011620316751032150 5ustar twernertwerner././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javatypeadapter/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javat0000755000175000017500000000000011620316750033175 5ustar twernertwerner././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javatypeadapter/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javat0000755000175000017500000000000011620316750033175 5ustar twernertwerner././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javatypeadapter/test/JavaTypeAdapterUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javat0000644000175000017500000000461511273541450033206 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.javatypeadapter.test; import java.util.Map; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.element.javatypeadapter.support.MyHashMapTypeRoot; import org.jboss.test.xb.builder.object.element.javatypeadapter.support.Root; /** * A JavaTypeAdapterUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class JavaTypeAdapterUnitTestCase extends AbstractBuilderTest { public JavaTypeAdapterUnitTestCase(String name) { super(name); } @SuppressWarnings("unchecked") public void testMap() throws Exception { Root root = unmarshalObject(Root.class); Map map = root.getMap(); assertNotNull(map); assertEquals(3, map.size()); assertEquals("value1", map.get(1)); assertEquals("value22", map.get(22)); assertEquals("value333", map.get(333)); } public void testMyHashMapType() throws Exception { MyHashMapTypeRoot root = unmarshalObject(MyHashMapTypeRoot.class); Map map = root.getMap(); assertNotNull(map); assertEquals(3, map.size()); assertEquals("value1", map.get(1)); assertEquals("value22", map.get(22)); assertEquals("value333", map.get(333)); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javatypeadapter/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javat0000755000175000017500000000000011620316750033175 5ustar twernertwerner././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javatypeadapter/support/MyHashMapTypeRoot.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javat0000644000175000017500000000321711273541450033203 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.javatypeadapter.support; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") public class MyHashMapTypeRoot { private Map map; @XmlJavaTypeAdapter(MyHashMapTypeAdapter.class) public Map getMap() { return map; } public void setMap(Map map) { this.map = map; } } ././@LongLink0000000000000000000000000000022100000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javatypeadapter/support/MyHashMapTypeAdapter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javat0000644000175000017500000000365211273541450033206 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.javatypeadapter.support; import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.adapters.XmlAdapter; /** * A MyHashMapAdapter. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class MyHashMapTypeAdapter extends XmlAdapter> { @Override public MyHashMapType marshal(Map arg0) throws Exception { return null; } @Override public Map unmarshal(MyHashMapType list) throws Exception { if(list == null || list.getEntry() == null) return null; Map map = new HashMap(); for(MyHashMapEntryType entry: list.getEntry()) map.put(entry.getKey(), entry.getValue()); return map; } } ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javatypeadapter/support/MyHashMapAdapter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javat0000644000175000017500000000370610703170676033213 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.javatypeadapter.support; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.bind.annotation.adapters.XmlAdapter; /** * A MyHashMapAdapter. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class MyHashMapAdapter extends XmlAdapter, Map> { @Override public List marshal(Map arg0) throws Exception { // TODO Auto-generated method stub return null; } @Override public Map unmarshal(List list) throws Exception { Map map = new HashMap(); for(MyHashMapEntryType entry: list) { map.put(entry.getKey(), entry.getValue()); } return map; } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javatypeadapter/support/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javat0000644000175000017500000000314511061473704033204 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.javatypeadapter.support; import java.util.Map; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement public class Root { private Map map; @XmlJavaTypeAdapter(MyHashMapAdapter.class) public Map getMap() { return map; } public void setMap(Map map) { this.map = map; } } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javatypeadapter/support/MyHashMapEntryType.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javat0000644000175000017500000000335110703170676033207 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.javatypeadapter.support; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlValue; /** * A MyHashMapEntryType. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class MyHashMapEntryType { private Integer key; private String value; @XmlAttribute public Integer getKey() { return key; } public void setKey(Integer key) { this.key = key; } @XmlValue public String getValue() { return value; } public void setValue(String value) { this.value = value; } } ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javatypeadapter/support/MyHashMapType.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/javat0000644000175000017500000000274311273541450033206 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.javatypeadapter.support; import java.util.List; /** * A MyHashMapType. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class MyHashMapType { private List entry; public List getEntry() { return entry; } public void setEntry(List entry) { this.entry = entry; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapper/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapp0000755000175000017500000000000011620316750033221 5ustar twernertwerner././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapper/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapp0000755000175000017500000000000011620316750033221 5ustar twernertwerner././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapper/test/WrapperUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapp0000644000175000017500000000541611276564547033251 0ustar twernertwernerpackage org.jboss.test.xb.builder.object.element.wrapper.test; import java.util.List; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.element.wrapper.support.Bar; import org.jboss.test.xb.builder.object.element.wrapper.support.Foo; import org.jboss.test.xb.builder.object.element.wrapper.support.Foo2; import org.jboss.test.xb.builder.object.element.wrapper.support.Foo3; import org.jboss.test.xb.builder.object.element.wrapper.support.Foo4; import org.jboss.test.xb.builder.object.element.wrapper.support.MyNumber; public class WrapperUnitTestCase extends AbstractBuilderTest { public WrapperUnitTestCase(String name) { super(name); } public void testFooWrapper() throws Exception { //enableTrace("org.jboss.xb"); Foo foo = unmarshalObject(Foo.class); List items = foo.getItems(); assertEquals(4, items.size()); assertEquals(1, items.get(0)); assertEquals(2, items.get(1)); assertEquals(new Float(1.1), items.get(2)); assertEquals(new MyNumber("123456789"), items.get(3)); } public void testFoo2Wrapper() throws Exception { Foo2 foo = unmarshalObject(Foo2.class); List items = foo.getItems(); assertEquals(4, items.size()); assertEquals(4, items.size()); assertEquals(1, items.get(0)); assertEquals(2, items.get(1)); assertEquals(new Float(1.1), items.get(2)); assertEquals(new MyNumber("123456789"), items.get(3)); } public void testFoo3Wrapper() throws Exception { Foo3 foo = unmarshalObject(Foo3.class); List items = foo.getItems(); assertEquals(4, items.size()); Bar bar0 = items.get(0); assertEquals(bar0.getValue(), 1); Bar bar1 = items.get(1); assertEquals(bar1.getValue(), 2); Bar bar2 = items.get(2); assertEquals(bar2.getValue(), new Float(1.1)); Bar bar3 = items.get(3); assertEquals(bar3.getValue(), new MyNumber("123456789")); } public void testFoo4Wrapper() throws Exception { Foo4 foo = unmarshalObject(Foo4.class); Number[] items = foo.getItems(); assertEquals(4, items.length); assertEquals(1, items[0]); assertEquals(2, items[1]); assertEquals(new Float(1.1), items[2]); assertEquals(new MyNumber("123456789"), items[3]); } public void testFoo5Wrapper() throws Exception { Foo4 foo = unmarshalObject(Foo4.class); Number[] items = foo.getItems(); assertEquals(4, items.length); assertEquals(1, items[0]); assertEquals(2, items[1]); assertEquals(new Float(1.1), items[2]); assertEquals(new MyNumber("123456789"), items[3]); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapper/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapp0000755000175000017500000000000011620316750033221 5ustar twernertwerner././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapper/support/Foo.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapp0000644000175000017500000000143111061473704033224 0ustar twernertwernerpackage org.jboss.test.xb.builder.object.element.wrapper.support; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Foo { private List items; public List getItems() { return items; } @XmlElementWrapper(name="bar") @XmlElements({ @XmlElement(name="int", required=false, type=Integer.class), @XmlElement(name="float", required=false, type=Float.class), @XmlElement(name="x", required=false, type=MyNumber.class) }) public void setItems(List items) { this.items = items; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapper/support/Foo4.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapp0000644000175000017500000000135610763542743033242 0ustar twernertwernerpackage org.jboss.test.xb.builder.object.element.wrapper.support; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Foo4 { private Number[] items; public Number[] getItems() { return items; } @XmlElementWrapper(name="bar") @XmlElements({ @XmlElement(name="int", required=false, type=Integer.class), @XmlElement(name="float", required=false, type=Float.class), @XmlElement(name="x", required=false, type=MyNumber.class) }) public void setItems(Number[] items) { this.items = items; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapper/support/Foo2.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapp0000644000175000017500000000142210702666514033230 0ustar twernertwernerpackage org.jboss.test.xb.builder.object.element.wrapper.support; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Foo2 { private List items; public List getItems() { return items; } @XmlElementWrapper(name="bar") @XmlElements({ @XmlElement(name="int", required=false, type=Integer.class), @XmlElement(name="float", required=false, type=Float.class), @XmlElement(name="x", required=false, type=MyNumber.class) }) public void setItems(List items) { this.items = items; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapper/support/Bar.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapp0000644000175000017500000000140110702643330033214 0ustar twernertwernerpackage org.jboss.test.xb.builder.object.element.wrapper.support; import java.util.ArrayList; import java.util.LinkedHashSet; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlChild; import org.jboss.xb.annotations.JBossXmlChildren; /** * Wrapper for numbers used by Foo * @author Scott.Stark@jboss.org * @version $Revision:$ */ @XmlType @JBossXmlChildren ({ @JBossXmlChild(name="int", type=Integer.class), @JBossXmlChild(name="float", type=Float.class), @JBossXmlChild(name="x", type=MyNumber.class) }) public class Bar { private Number value; public Number getValue() { return value; } public void setValue(Number value) { this.value = value; } } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapper/support/MyNumber.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapp0000644000175000017500000000210210702647556033231 0ustar twernertwernerpackage org.jboss.test.xb.builder.object.element.wrapper.support; import javax.xml.bind.annotation.XmlValue; public class MyNumber extends Number { private String x; public MyNumber() { this(null); } public MyNumber(String x) { this.x = x; } @Override public double doubleValue() { return 0; } @Override public float floatValue() { return 0; } @Override public int intValue() { return 0; } @Override public long longValue() { return 0; } public String getX() { return x; } @XmlValue public void setX(String x) { this.x = x; } @Override public boolean equals(Object obj) { if (!(obj instanceof MyNumber)) return false; MyNumber n = (MyNumber) obj; return x.equals(n.x); } @Override public int hashCode() { return x.hashCode(); } @Override public String toString() { return "MyNumber("+x+")"; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapper/support/Foo3.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/wrapp0000644000175000017500000000067210701704266033232 0ustar twernertwernerpackage org.jboss.test.xb.builder.object.element.wrapper.support; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Foo3 { private List items; public List getItems() { return items; } @XmlElement(name="bar") public void setItems(List items) { this.items = items; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000755000175000017500000000000011620316751033232 5ustar twernertwerner././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000755000175000017500000000000011620316751033232 5ustar twernertwerner././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000755000175000017500000000000011620316751033232 5ustar twernertwerner././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/test/DefaultsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000644000175000017500000000303310562616254033240 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlrootelement.specified.test; import org.jboss.test.xb.builder.object.element.xmlrootelement.specified.support.defaults.Root; import junit.framework.Test; /** * DefaultsTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class DefaultsUnitTestCase extends AbstractDefaultsTest { public static Test suite() { return suite(DefaultsUnitTestCase.class); } public DefaultsUnitTestCase(String name) { super(name, Root.class); } } ././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/test/AbstractDefaultsTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000644000175000017500000000451610562616254033247 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlrootelement.specified.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * SimpleObjectWildcardUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractDefaultsTest extends AbstractBuilderTest { /** The root class */ private Class root; public AbstractDefaultsTest(String name, Class root) { super(name); this.root = root; } public void testDefaultsUnmarshal() throws Exception { unmarshalObject(root); } public void testDefaultsElementBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(root); testDefaults(schemaBinding); } protected void testDefaults(SchemaBinding schemaBinding) { assertNotNull(schemaBinding); // Check the element QName qName = new QName(XMLConstants.NULL_NS_URI, "root"); ElementBinding elementBinding = schemaBinding.getElement(qName); assertNotNull(elementBinding); assertEquals(qName, elementBinding.getQName()); } } ././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/test/NoneUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000644000175000017500000000301310562616254033236 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlrootelement.specified.test; import org.jboss.test.xb.builder.object.element.xmlrootelement.specified.support.none.Root; import junit.framework.Test; /** * NoneUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NoneUnitTestCase extends AbstractDefaultsTest { public static Test suite() { return suite(NoneUnitTestCase.class); } public NoneUnitTestCase(String name) { super(name, Root.class); } } ././@LongLink0000000000000000000000000000023200000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/test/NonDefaultsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000644000175000017500000000451010562616254033241 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlrootelement.specified.test; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.element.xmlrootelement.specified.support.nondefaults.Root; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * NonDefaultsUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NonDefaultsUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(NonDefaultsUnitTestCase.class); } public NonDefaultsUnitTestCase(String name) { super(name); } public void testNonDefaultsUnmarshal() throws Exception { unmarshalObject(Root.class); } public void testNonDefaultsElementBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(Root.class); assertNotNull(schemaBinding); // Check the element QName qName = new QName("testNamespace", "nondefaults"); ElementBinding elementBinding = schemaBinding.getElement(qName); assertNotNull(elementBinding); assertEquals(qName, elementBinding.getQName()); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000755000175000017500000000000011620316751033232 5ustar twernertwerner././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/support/defaults/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000755000175000017500000000000011620316751033232 5ustar twernertwerner././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/support/defaults/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000644000175000017500000000241110562616254033237 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlrootelement.specified.support.defaults; import javax.xml.bind.annotation.XmlRootElement; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlRootElement public class Root { } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/support/none/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000755000175000017500000000000011620316751033232 5ustar twernertwerner././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/support/none/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000644000175000017500000000230310562616254033237 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlrootelement.specified.support.none; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Root { } ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/support/nondefaults/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000755000175000017500000000000011620316751033232 5ustar twernertwerner././@LongLink0000000000000000000000000000022600000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/specified/support/nondefaults/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000644000175000017500000000247310562616254033247 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlrootelement.specified.support.nondefaults; import javax.xml.bind.annotation.XmlRootElement; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlRootElement(namespace="testNamespace", name="nondefaults") public class Root { } ././@LongLink0000000000000000000000000000022100000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlrootelement/ObjectXmlRootElementTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlro0000755000175000017500000000406010562616254033244 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlrootelement; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.element.xmlrootelement.specified.test.DefaultsUnitTestCase; import org.jboss.test.xb.builder.object.element.xmlrootelement.specified.test.NonDefaultsUnitTestCase; import org.jboss.test.xb.builder.object.element.xmlrootelement.specified.test.NoneUnitTestCase; /** * ObjectXmlElementTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectXmlRootElementTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object XMLRootElement Tests"); suite.addTest(NoneUnitTestCase.suite()); suite.addTest(DefaultsUnitTestCase.suite()); suite.addTest(NonDefaultsUnitTestCase.suite()); // TODO non specified xml root element // TODO test semantics return suite; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelements/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000755000175000017500000000000011620316751033212 5ustar twernertwerner././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelements/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000755000175000017500000000000011620316751033212 5ustar twernertwerner././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelements/test/XmlElementsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000644000175000017500000000121711276564547033234 0ustar twernertwernerpackage org.jboss.test.xb.builder.object.element.xmlelements.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.element.xmlelements.support.Foo4; public class XmlElementsUnitTestCase extends AbstractBuilderTest { public XmlElementsUnitTestCase(String name) { super(name); } public void testArray() throws Exception { Foo4 foo = unmarshalObject(Foo4.class); Number[] items = foo.getItems(); assertEquals(4, items.length); assertEquals(1, items[0]); assertEquals(2, items[1]); assertEquals(new Float(1.1), items[2]); } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelements/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000755000175000017500000000000011620316751033212 5ustar twernertwerner././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelements/support/Foo4.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000644000175000017500000000112711276564547033234 0ustar twernertwernerpackage org.jboss.test.xb.builder.object.element.xmlelements.support; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Foo4 { private Number[] items; public Number[] getItems() { return items; } @XmlElements({ @XmlElement(name="int", required=false, type=Integer.class), @XmlElement(name="float", required=false, type=Float.class) }) public void setItems(Number[] items) { this.items = items; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000755000175000017500000000000011620316751033212 5ustar twernertwerner././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000755000175000017500000000000011620316750033211 5ustar twernertwerner././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/test/DefaultsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000644000175000017500000000301610562616254033221 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlelement.test; import org.jboss.test.xb.builder.object.element.xmlelement.support.defaults.Root; import junit.framework.Test; /** * DefaultsTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class DefaultsUnitTestCase extends AbstractDefaultsTest { public static Test suite() { return suite(DefaultsUnitTestCase.class); } public DefaultsUnitTestCase(String name) { super(name, Root.class, "Hello"); } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/test/AbstractDefaultsTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000644000175000017500000000530610562616254033225 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlelement.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.element.xmlelement.support.SimpleElement; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * SimpleObjectWildcardUnitTestCase. * * @param the unmarshalled type * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractDefaultsTest extends AbstractBuilderTest { /** The root class */ private Class root; /** The expected element */ private Object expected; public AbstractDefaultsTest(String name, Class root, Object expected) { super(name); this.root = root; this.expected = expected; } public void testDefaultsUnmarshal() throws Exception { T result = unmarshalObject(root); Object actual = result.getElement(); assertEquals(expected, actual); } public void testDefaultsElementBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(root); testDefaults(schemaBinding); } protected void testDefaults(SchemaBinding schemaBinding) { assertNotNull(schemaBinding); // Check the element QName qName = new QName(XMLConstants.NULL_NS_URI, "root"); ElementBinding elementBinding = schemaBinding.getElement(qName); assertNotNull(elementBinding); assertEquals(qName, elementBinding.getQName()); // TODO check type's elements } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/test/NoneUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000644000175000017500000000277610562616254033235 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlelement.test; import org.jboss.test.xb.builder.object.element.xmlelement.support.none.Root; import junit.framework.Test; /** * NoneUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NoneUnitTestCase extends AbstractDefaultsTest { public static Test suite() { return suite(NoneUnitTestCase.class); } public NoneUnitTestCase(String name) { super(name, Root.class, "Hello"); } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/test/NonDefaultsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000644000175000017500000000472210562616254033226 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlelement.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.element.xmlelement.support.nondefaults.Root; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * NonDefaultsUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NonDefaultsUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(NonDefaultsUnitTestCase.class); } public NonDefaultsUnitTestCase(String name) { super(name); } public void testNonDefaultsUnmarshal() throws Exception { Root root = unmarshalObject(Root.class); String result = root.getElement(); assertEquals("Hello", result); } public void testNonDefaultsElementBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(Root.class); assertNotNull(schemaBinding); // Check the element QName qName = new QName(XMLConstants.NULL_NS_URI, "root"); ElementBinding elementBinding = schemaBinding.getElement(qName); assertNotNull(elementBinding); assertEquals(qName, elementBinding.getQName()); // TODO check type's elements } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/ObjectXmlElementTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000755000175000017500000000371510562616254033232 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlelement; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.element.xmlelement.test.DefaultsUnitTestCase; import org.jboss.test.xb.builder.object.element.xmlelement.test.NonDefaultsUnitTestCase; import org.jboss.test.xb.builder.object.element.xmlelement.test.NoneUnitTestCase; /** * ObjectXmlElementTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectXmlElementTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object XMLElement Tests"); suite.addTest(NoneUnitTestCase.suite()); suite.addTest(DefaultsUnitTestCase.suite()); suite.addTest(NonDefaultsUnitTestCase.suite()); // TODO test semantics return suite; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000755000175000017500000000000011620316751033212 5ustar twernertwerner././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/support/SimpleElement.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000644000175000017500000000232510562616254033223 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlelement.support; /** * SimpleElement. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface SimpleElement { Object getElement(); } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/support/defaults/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000755000175000017500000000000011620316751033212 5ustar twernertwerner././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/support/defaults/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000644000175000017500000000303410562616254033221 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlelement.support.defaults; import javax.xml.bind.annotation.XmlElement; import org.jboss.test.xb.builder.object.element.xmlelement.support.SimpleElement; /** * SimpleObjectWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Root implements SimpleElement { private String element; @XmlElement public String getElement() { return element; } public void setElement(String element) { this.element = element; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/support/none/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000755000175000017500000000000011620316751033212 5ustar twernertwerner././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/support/none/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000644000175000017500000000273310562616254033226 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlelement.support.none; import org.jboss.test.xb.builder.object.element.xmlelement.support.SimpleElement; /** * SimpleObjectWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Root implements SimpleElement { private String element; public String getElement() { return element; } public void setElement(String element) { this.element = element; } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/support/nondefaults/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000755000175000017500000000000011620316751033212 5ustar twernertwerner././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlelement/support/nondefaults/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/xmlel0000644000175000017500000000311010562616254033214 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.xmlelement.support.nondefaults; import javax.xml.bind.annotation.XmlElement; import org.jboss.test.xb.builder.object.element.xmlelement.support.SimpleElement; /** * SimpleObjectWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Root implements SimpleElement { private String element; @XmlElement(namespace="testNamespace", name="local") public String getElement() { return element; } public void setElement(String element) { this.element = element; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000755000175000017500000000000011620316750033210 5ustar twernertwerner././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000755000175000017500000000000011620316750033210 5ustar twernertwerner././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/test/JBossXmlNsPrefixUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000006146611205000705033214 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.test; import java.util.Collection; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameFalseComponentContentFalseGroup; import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameFalseComponentContentTrue; import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameFalseComponentContentTrueGroup; import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameTrueComponentContentFalse; import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameFalseComponentContentFalse; import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameTrueComponentContentFalseGroup; import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameTrueComponentContentTrueGroup; import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.MissingPrefixMappingException; import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.MissingPrefixMappingGoesTarget; import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.ComponentQNameTrueComponentContentTrue; import org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support.RootWithGroupWithJBossXmlNsPrefixProperty; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A JBossXmlNsPrefixUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class JBossXmlNsPrefixUnitTestCase extends AbstractBuilderTest { public JBossXmlNsPrefixUnitTestCase(String name) { super(name); } public void testMissingPrefixMappingException() throws Exception { try { JBossXBBuilder.build(MissingPrefixMappingException.class, true); fail("didn't throw an exception for the unmapped prefix"); } catch(RuntimeException e) { assertTrue(e.getMessage().startsWith("Prefix 'child' is not mapped to any namespace!")); } } public void testMissingPrefixGoesTarget() throws Exception { SchemaBinding schema = JBossXBBuilder.build(MissingPrefixMappingGoesTarget.class, true); Iterator elements = schema.getElements(); assertTrue(elements.hasNext()); //root ElementBinding e = elements.next(); assertFalse(elements.hasNext()); assertEquals(new QName("ns.root", "root"), e.getQName()); ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(1, particles.size()); ParticleBinding particle = particles.iterator().next(); // child e = (ElementBinding) particle.getTerm(); assertEquals(new QName("ns.root", "child"), e.getQName()); group = (ModelGroupBinding) e.getType().getParticle().getTerm(); particles = group.getParticles(); assertEquals(1, particles.size()); particle = particles.iterator().next(); // child/name e = (ElementBinding) particle.getTerm(); assertEquals(new QName("ns.root", "name"), e.getQName()); } public void testApplyToElementTrueApplyToTypeTrue() { SchemaBinding schema = JBossXBBuilder.build(ComponentQNameTrueComponentContentTrue.class, true); assertNotNull(schema); Iterator elements = schema.getElements(); assertTrue(elements.hasNext()); //root ElementBinding e = elements.next(); assertFalse(elements.hasNext()); assertEquals(new QName("ns.root", "root"), e.getQName()); ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(1, particles.size()); ParticleBinding particle = particles.iterator().next(); // child e = (ElementBinding) particle.getTerm(); assertEquals(new QName("ns.child", "child"), e.getQName()); group = (ModelGroupBinding) e.getType().getParticle().getTerm(); particles = group.getParticles(); assertEquals(1, particles.size()); particle = particles.iterator().next(); // child/name e = (ElementBinding) particle.getTerm(); assertEquals(new QName("ns.child", "name"), e.getQName()); } public void testApplyToElementTrueApplyToTypeFalse() { SchemaBinding schema = JBossXBBuilder.build(ComponentQNameTrueComponentContentFalse.class, true); assertNotNull(schema); Iterator elements = schema.getElements(); assertTrue(elements.hasNext()); //root ElementBinding e = elements.next(); assertFalse(elements.hasNext()); assertEquals(new QName("ns.root", "root"), e.getQName()); ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(2, particles.size()); Iterator particleIterator = particles.iterator(); ParticleBinding particle; ElementBinding childE = null; ElementBinding rootNameE = null; if(group instanceof UnorderedSequenceBinding) { while(particleIterator.hasNext()) { particle = particleIterator.next(); e = (ElementBinding) particle.getTerm(); if(e.getQName().equals(new QName("ns.child", "child"))) childE = e; else rootNameE = e; } } else { particle = particleIterator.next(); childE = (ElementBinding) particle.getTerm(); particle = particleIterator.next(); rootNameE = (ElementBinding) particle.getTerm(); } // child assertNotNull(childE); assertEquals(new QName("ns.child", "child"), childE.getQName()); group = (ModelGroupBinding) childE.getType().getParticle().getTerm(); particles = group.getParticles(); assertEquals(1, particles.size()); particle = particles.iterator().next(); // child/name e = (ElementBinding) particle.getTerm(); assertEquals(new QName("ns.root", "name"), e.getQName()); // rootName assertNotNull(rootNameE); assertEquals(new QName("ns.root", "root-name"), rootNameE.getQName()); } public void testApplyToElementFalseApplyToTypeFalse() { SchemaBinding schema = JBossXBBuilder.build(ComponentQNameFalseComponentContentFalse.class, true); assertNotNull(schema); Iterator elements = schema.getElements(); assertTrue(elements.hasNext()); //root ElementBinding e = elements.next(); assertFalse(elements.hasNext()); assertEquals(new QName("ns.root", "root"), e.getQName()); ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(2, particles.size()); Iterator particleIterator = particles.iterator(); ElementBinding child; ElementBinding rootName; if(group instanceof SequenceBinding) { child = (ElementBinding) particleIterator.next().getTerm(); rootName = (ElementBinding) particleIterator.next().getTerm(); } else { ParticleBinding particle = particleIterator.next(); ElementBinding el = (ElementBinding) particle.getTerm(); if(el.getQName().equals(new QName("ns.root", "child"))) { child = el; rootName = (ElementBinding) particleIterator.next().getTerm(); } else { child = (ElementBinding) particleIterator.next().getTerm(); rootName = el; } } // child assertEquals(new QName("ns.root", "child"), child.getQName()); group = (ModelGroupBinding) child.getType().getParticle().getTerm(); particles = group.getParticles(); assertEquals(1, particles.size()); ParticleBinding particle = particles.iterator().next(); // child/name e = (ElementBinding) particle.getTerm(); assertEquals(new QName("ns.root", "name"), e.getQName()); // rootName assertEquals(new QName("ns.root", "root-name"), rootName.getQName()); } public void testApplyToElementFalseApplyToTypeTrue() { SchemaBinding schema = JBossXBBuilder.build(ComponentQNameFalseComponentContentTrue.class, true); assertNotNull(schema); Iterator elements = schema.getElements(); assertTrue(elements.hasNext()); //root ElementBinding e = elements.next(); assertFalse(elements.hasNext()); assertEquals(new QName("ns.root", "root"), e.getQName()); ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(2, particles.size()); Iterator particleIterator = particles.iterator(); ElementBinding child; ElementBinding rootName; if(group instanceof SequenceBinding) { child = (ElementBinding) particleIterator.next().getTerm(); rootName = (ElementBinding) particleIterator.next().getTerm(); } else { ParticleBinding particle = particleIterator.next(); ElementBinding el = (ElementBinding) particle.getTerm(); if(el.getQName().equals(new QName("ns.root", "child"))) { child = el; rootName = (ElementBinding) particleIterator.next().getTerm(); } else { child = (ElementBinding) particleIterator.next().getTerm(); rootName = el; } } // child assertEquals(new QName("ns.root", "child"), child.getQName()); group = (ModelGroupBinding) child.getType().getParticle().getTerm(); particles = group.getParticles(); assertEquals(1, particles.size()); ParticleBinding particle = particles.iterator().next(); // child/name e = (ElementBinding) particle.getTerm(); assertEquals(new QName("ns.child", "name"), e.getQName()); // rootName assertEquals(new QName("ns.root", "root-name"), rootName.getQName()); } public void testApplyToElementTrueApplyToTypeTrueGroup() throws Exception { SchemaBinding schema = JBossXBBuilder.build(ComponentQNameTrueComponentContentTrueGroup.class, true); ElementBinding e = schema.getElement(new QName("ns", "root")); assertNotNull(e); ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(2, particles.size()); Iterator iterator = particles.iterator(); ElementBinding idElement; if(group instanceof SequenceBinding) { group = (ModelGroupBinding) iterator.next().getTerm(); idElement = (ElementBinding) iterator.next().getTerm(); } else { assertTrue(group instanceof UnorderedSequenceBinding); TermBinding t = iterator.next().getTerm(); if(t.isElement()) { idElement = (ElementBinding) t; group = (ModelGroupBinding) iterator.next().getTerm(); } else { group = (ModelGroupBinding) t; idElement = (ElementBinding) iterator.next().getTerm(); } } assertEquals(new QName("anotherNs", "group"), group.getQName()); particles = group.getParticles(); assertEquals(2, particles.size()); Iterator groupIterator = particles.iterator(); ElementBinding countElement = null; ElementBinding textElement = null; if(group instanceof UnorderedSequenceBinding) { while(groupIterator.hasNext()) { e = (ElementBinding) groupIterator.next().getTerm(); if(new QName("anotherNs", "count").equals(e.getQName())) countElement = e; else textElement = e; } } else { countElement = (ElementBinding) groupIterator.next().getTerm(); textElement = (ElementBinding) groupIterator.next().getTerm(); } assertNotNull(countElement); assertEquals(new QName("anotherNs", "count"), countElement.getQName()); assertNotNull(textElement); assertEquals(new QName("anotherNs", "text"), textElement.getQName()); assertEquals(new QName("ns", "id"), idElement.getQName()); } public void testApplyToElementFalseApplyToTypeTrueGroup() throws Exception { SchemaBinding schema = JBossXBBuilder.build(ComponentQNameFalseComponentContentTrueGroup.class, true); ElementBinding e = schema.getElement(new QName("ns", "root")); assertNotNull(e); ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(2, particles.size()); Iterator iterator = particles.iterator(); ElementBinding idElement; if(group instanceof SequenceBinding) { group = (ModelGroupBinding) iterator.next().getTerm(); idElement = (ElementBinding) iterator.next().getTerm(); } else { assertTrue(group instanceof UnorderedSequenceBinding); TermBinding t = iterator.next().getTerm(); if(t.isElement()) { idElement = (ElementBinding) t; group = (ModelGroupBinding) iterator.next().getTerm(); } else { group = (ModelGroupBinding) t; idElement = (ElementBinding) iterator.next().getTerm(); } } assertEquals(new QName("ns", "group"), group.getQName()); particles = group.getParticles(); assertEquals(2, particles.size()); Iterator groupIterator = particles.iterator(); ElementBinding countElement = null; ElementBinding textElement = null; if(group instanceof UnorderedSequenceBinding) { while(groupIterator.hasNext()) { e = (ElementBinding) groupIterator.next().getTerm(); if(new QName("anotherNs", "count").equals(e.getQName())) countElement = e; else textElement = e; } } else { countElement = (ElementBinding) groupIterator.next().getTerm(); textElement = (ElementBinding) groupIterator.next().getTerm(); } assertNotNull(countElement); assertEquals(new QName("anotherNs", "count"), countElement.getQName()); assertNotNull(textElement); assertEquals(new QName("anotherNs", "text"), textElement.getQName()); assertEquals(new QName("ns", "id"), idElement.getQName()); } public void testApplyToElementTrueApplyToTypeFalseGroup() throws Exception { SchemaBinding schema = JBossXBBuilder.build(ComponentQNameTrueComponentContentFalseGroup.class, true); ElementBinding e = schema.getElement(new QName("ns", "root")); assertNotNull(e); ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(2, particles.size()); Iterator iterator = particles.iterator(); ElementBinding idElement; if(group instanceof SequenceBinding) { group = (ModelGroupBinding) iterator.next().getTerm(); idElement = (ElementBinding) iterator.next().getTerm(); } else { assertTrue(group instanceof UnorderedSequenceBinding); TermBinding t = iterator.next().getTerm(); if(t.isElement()) { idElement = (ElementBinding) t; group = (ModelGroupBinding) iterator.next().getTerm(); } else { group = (ModelGroupBinding) t; idElement = (ElementBinding) iterator.next().getTerm(); } } assertEquals(new QName("anotherNs", "group"), group.getQName()); particles = group.getParticles(); assertEquals(2, particles.size()); Iterator groupIterator = particles.iterator(); ElementBinding countElement = null; ElementBinding textElement = null; if(group instanceof UnorderedSequenceBinding) { while(groupIterator.hasNext()) { e = (ElementBinding) groupIterator.next().getTerm(); if(new QName("ns", "count").equals(e.getQName())) countElement = e; else textElement = e; } } else { countElement = (ElementBinding) groupIterator.next().getTerm(); textElement = (ElementBinding) groupIterator.next().getTerm(); } assertNotNull(countElement); assertEquals(new QName("ns", "count"), countElement.getQName()); assertNotNull(textElement); assertEquals(new QName("ns", "text"), textElement.getQName()); assertEquals(new QName("ns", "id"), idElement.getQName()); } public void testApplyToElementFalseApplyToTypeFalseGroup() throws Exception { SchemaBinding schema = JBossXBBuilder.build(ComponentQNameFalseComponentContentFalseGroup.class, true); ElementBinding e = schema.getElement(new QName("ns", "root")); assertNotNull(e); ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(2, particles.size()); Iterator iterator = particles.iterator(); ElementBinding idElement; if(group instanceof SequenceBinding) { group = (ModelGroupBinding) iterator.next().getTerm(); idElement = (ElementBinding) iterator.next().getTerm(); } else { assertTrue(group instanceof UnorderedSequenceBinding); TermBinding t = iterator.next().getTerm(); if(t.isElement()) { idElement = (ElementBinding) t; group = (ModelGroupBinding) iterator.next().getTerm(); } else { group = (ModelGroupBinding) t; idElement = (ElementBinding) iterator.next().getTerm(); } } assertEquals(new QName("ns", "group"), group.getQName()); particles = group.getParticles(); assertEquals(2, particles.size()); Iterator groupIterator = particles.iterator(); ElementBinding countElement = null; ElementBinding textElement = null; if(group instanceof UnorderedSequenceBinding) { while(groupIterator.hasNext()) { e = (ElementBinding) groupIterator.next().getTerm(); if(new QName("ns", "count").equals(e.getQName())) countElement = e; else textElement = e; } } else { countElement = (ElementBinding) groupIterator.next().getTerm(); textElement = (ElementBinding) groupIterator.next().getTerm(); } assertNotNull(countElement); assertEquals(new QName("ns", "count"), countElement.getQName()); assertNotNull(textElement); assertEquals(new QName("ns", "text"), textElement.getQName()); assertEquals(new QName("ns", "id"), idElement.getQName()); } public void testGroupWithJBossXmlNsProperty() throws Exception { SchemaBinding schema = JBossXBBuilder.build(RootWithGroupWithJBossXmlNsPrefixProperty.class, true); ElementBinding e = schema.getElement(new QName("ns", "root")); ModelGroupBinding group = (ModelGroupBinding) e.getType().getParticle().getTerm(); Collection particles = group.getParticles(); assertEquals(1, particles.size()); group = (ModelGroupBinding) particles.iterator().next().getTerm(); particles = group.getParticles(); assertEquals(4, particles.size()); Iterator iterator = particles.iterator(); ElementBinding gtcf = null; ElementBinding gfcf = null; ElementBinding gtct = null; ElementBinding gfct = null; if(group instanceof SequenceBinding) { gtcf = (ElementBinding) iterator.next().getTerm(); gfcf = (ElementBinding) iterator.next().getTerm(); gtct = (ElementBinding) iterator.next().getTerm(); gfct = (ElementBinding) iterator.next().getTerm(); } else { assertTrue(group instanceof UnorderedSequenceBinding); while(iterator.hasNext()) { ElementBinding el = (ElementBinding) iterator.next().getTerm(); if(el.getQName().getLocalPart().equals("group-true-content-false")) gtcf = el; else if(el.getQName().getLocalPart().equals("group-false-content-false")) gfcf = el; else if(el.getQName().getLocalPart().equals("group-true-content-true")) gtct = el; else if(el.getQName().getLocalPart().equals("group-false-content-true")) gfct = el; } } assertEquals(new QName("childNs", "group-true-content-false"), gtcf.getQName()); group = (ModelGroupBinding) gtcf.getType().getParticle().getTerm(); particles = group.getParticles(); assertEquals(1, particles.size()); e = (ElementBinding) particles.iterator().next().getTerm(); assertEquals(new QName("ns", "name"), e.getQName()); assertEquals(new QName("ns", "group-false-content-false"), gfcf.getQName()); group = (ModelGroupBinding) gfcf.getType().getParticle().getTerm(); particles = group.getParticles(); assertEquals(1, particles.size()); e = (ElementBinding) particles.iterator().next().getTerm(); assertEquals(new QName("ns", "name"), e.getQName()); assertEquals(new QName("childNs", "group-true-content-true"), gtct.getQName()); group = (ModelGroupBinding) gtct.getType().getParticle().getTerm(); particles = group.getParticles(); assertEquals(1, particles.size()); e = (ElementBinding) particles.iterator().next().getTerm(); assertEquals(new QName("childNs", "name"), e.getQName()); assertEquals(new QName("ns", "group-false-content-true"), gfct.getQName()); group = (ModelGroupBinding) gfct.getType().getParticle().getTerm(); particles = group.getParticles(); assertEquals(1, particles.size()); e = (ElementBinding) particles.iterator().next().getTerm(); assertEquals(new QName("childNs", "name"), e.getQName()); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000755000175000017500000000000011620316750033210 5ustar twernertwerner././@LongLink0000000000000000000000000000024600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentFalse.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000433711134036000033204 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import javax.xml.bind.annotation.XmlNs; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlNsPrefix; import org.jboss.xb.annotations.JBossXmlSchema; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @JBossXmlSchema(namespace = "ns.root", xmlns={@XmlNs(namespaceURI = "ns.child", prefix = "child")}, elementFormDefault=XmlNsForm.QUALIFIED) @XmlType(propOrder={"child", "rootName"}) public class ComponentQNameFalseComponentContentFalse { private String rootName; private Child child; public String getRootName() { return rootName; } public void setRootName(String rootName) { this.rootName = rootName; } @JBossXmlNsPrefix(prefix = "child", applyToComponentQName=false, applyToComponentContent=false) public Child getChild() { return child; } public void setChild(Child child) { this.child = child; } } ././@LongLink0000000000000000000000000000025200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentFalseGroup.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000431211134036000033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlNsPrefix; import org.jboss.xb.annotations.JBossXmlSchema; import javax.xml.bind.annotation.XmlNs; /** * A ApplyToElementTrueApplyToTypeTrueGroup. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root", namespace="ns") @JBossXmlSchema(namespace="ns", xmlns={@XmlNs(prefix="ns2", namespaceURI = "anotherNs")}, elementFormDefault=XmlNsForm.QUALIFIED) @XmlType(propOrder={"group", "id"}) public class ComponentQNameTrueComponentContentFalseGroup { private int id; private GroupType group; public int getId() { return id; } public void setId(int id) { this.id = id; } @JBossXmlNsPrefix(prefix = "ns2", applyToComponentQName=true, applyToComponentContent=false) public GroupType getGroup() { return group; } public void setGroup(GroupType group) { this.group = group; } } ././@LongLink0000000000000000000000000000024700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/RootWithGroupWithJBossXmlNsPrefixProperty.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000363111134036000033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import javax.xml.bind.annotation.XmlNs; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlSchema; /** * A RootWithGroupWithJBossXmlNsPrefixProperty. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root", namespace="ns") @JBossXmlSchema(namespace="ns", xmlns={@XmlNs(prefix="child", namespaceURI = "childNs")}, elementFormDefault=XmlNsForm.QUALIFIED) public class RootWithGroupWithJBossXmlNsPrefixProperty { private GroupWithJBossXmlNsPrefixProperty group; public GroupWithJBossXmlNsPrefixProperty getGroup() { return group; } public void setGroup(GroupWithJBossXmlNsPrefixProperty group) { this.group = group; } } ././@LongLink0000000000000000000000000000024500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentTrue.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000433511134036000033202 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import javax.xml.bind.annotation.XmlNs; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlNsPrefix; import org.jboss.xb.annotations.JBossXmlSchema; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @JBossXmlSchema(namespace = "ns.root", xmlns={@XmlNs(namespaceURI = "ns.child", prefix = "child")}, elementFormDefault=XmlNsForm.QUALIFIED) @XmlType(propOrder={"child", "rootName"}) public class ComponentQNameFalseComponentContentTrue { private String rootName; private Child child; public String getRootName() { return rootName; } public void setRootName(String rootName) { this.rootName = rootName; } @JBossXmlNsPrefix(prefix = "child", applyToComponentQName=false, applyToComponentContent=true) public Child getChild() { return child; } public void setChild(Child child) { this.child = child; } } ././@LongLink0000000000000000000000000000024500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentFalse.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000433511134036000033202 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import javax.xml.bind.annotation.XmlNs; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlNsPrefix; import org.jboss.xb.annotations.JBossXmlSchema; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @JBossXmlSchema(namespace = "ns.root", xmlns={@XmlNs(namespaceURI = "ns.child", prefix = "child")}, elementFormDefault=XmlNsForm.QUALIFIED) @XmlType(propOrder={"child", "rootName"}) public class ComponentQNameTrueComponentContentFalse { private String rootName; private Child child; public String getRootName() { return rootName; } public void setRootName(String rootName) { this.rootName = rootName; } @JBossXmlNsPrefix(prefix = "child", applyToComponentQName=true, applyToComponentContent=false) public Child getChild() { return child; } public void setChild(Child child) { this.child = child; } } ././@LongLink0000000000000000000000000000023400000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/MissingPrefixMappingGoesTarget.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000350411133065375033217 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlNsPrefix; import org.jboss.xb.annotations.JBossXmlSchema; /** * A MissingPrefixMappingGoesTarget. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @JBossXmlSchema(namespace = "ns.root", elementFormDefault=XmlNsForm.QUALIFIED) public class MissingPrefixMappingGoesTarget { private Child child; @JBossXmlNsPrefix(prefix = "child", schemaTargetIfNotMapped = true) public Child getChild() { return child; } public void setChild(Child child) { this.child = child; } } ././@LongLink0000000000000000000000000000025300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentFalseGroup.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000431711134036000033202 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlNsPrefix; import org.jboss.xb.annotations.JBossXmlSchema; import javax.xml.bind.annotation.XmlNs; /** * A ApplyToElementTrueApplyToTypeTrueGroup. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root", namespace="ns") @JBossXmlSchema(namespace="ns", xmlns={@XmlNs(prefix="ns2", namespaceURI = "anotherNs")}, elementFormDefault=XmlNsForm.QUALIFIED) @XmlType(propOrder={"group", "id"}) public class ComponentQNameFalseComponentContentFalseGroup { private int id; private GroupType group; public int getId() { return id; } public void setId(int id) { this.id = id; } @JBossXmlNsPrefix(prefix = "ns2", applyToComponentQName=false, applyToComponentContent=false) public GroupType getGroup() { return group; } public void setGroup(GroupType group) { this.group = group; } } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/GroupType.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000326711134036000033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import org.jboss.xb.annotations.JBossXmlModelGroup; /** * A GroupType. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlModelGroup(name="group", propOrder={"count", "text"}) public class GroupType { private String text; private int count; public String getText() { return text; } public void setText(String text) { this.text = text; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } } ././@LongLink0000000000000000000000000000025200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameFalseComponentContentTrueGroup.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000431211134036000033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlNsPrefix; import org.jboss.xb.annotations.JBossXmlSchema; import javax.xml.bind.annotation.XmlNs; /** * A ApplyToElementTrueApplyToTypeTrueGroup. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root", namespace="ns") @JBossXmlSchema(namespace="ns", xmlns={@XmlNs(prefix="ns2", namespaceURI = "anotherNs")}, elementFormDefault=XmlNsForm.QUALIFIED) @XmlType(propOrder={"group", "id"}) public class ComponentQNameFalseComponentContentTrueGroup { private int id; private GroupType group; public int getId() { return id; } public void setId(int id) { this.id = id; } @JBossXmlNsPrefix(prefix = "ns2", applyToComponentQName=false, applyToComponentContent=true) public GroupType getGroup() { return group; } public void setGroup(GroupType group) { this.group = group; } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/Child.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000271011133065375033215 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import javax.xml.bind.annotation.XmlType; /** * A Child. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlType public class Child { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } ././@LongLink0000000000000000000000000000023300000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/MissingPrefixMappingException.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000342711133065375033223 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlNsPrefix; import org.jboss.xb.annotations.JBossXmlSchema; /** * A MissingPrefixMappingException. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement @JBossXmlSchema(namespace = "ns.root", elementFormDefault=XmlNsForm.QUALIFIED) public class MissingPrefixMappingException { private Child child; @JBossXmlNsPrefix(prefix = "child") public Child getChild() { return child; } public void setChild(Child child) { this.child = child; } } ././@LongLink0000000000000000000000000000025100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentTrueGroup.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000431311134036000033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlNsPrefix; import org.jboss.xb.annotations.JBossXmlSchema; import javax.xml.bind.annotation.XmlNs; /** * A ApplyToElementTrueApplyToTypeTrueGroup. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root", namespace="ns") @JBossXmlSchema(namespace="ns", xmlns={@XmlNs(prefix="ns2", namespaceURI = "anotherNs")}, elementFormDefault=XmlNsForm.QUALIFIED) @XmlType(propOrder={"group", "id"}) public class ComponentQNameTrueComponentContentTrueGroup { private int id; private GroupType group; public int getId() { return id; } public void setId(int id) { this.id = id; } @JBossXmlNsPrefix(prefix = "ns2", applyToComponentQName=true, applyToComponentContent=true) public GroupType getGroup() { return group; } public void setGroup(GroupType group) { this.group = group; } } ././@LongLink0000000000000000000000000000024400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/ComponentQNameTrueComponentContentTrue.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000364411134036000033204 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import javax.xml.bind.annotation.XmlNs; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlNsPrefix; import org.jboss.xb.annotations.JBossXmlSchema; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @JBossXmlSchema(namespace = "ns.root", xmlns={@XmlNs(namespaceURI = "ns.child", prefix = "child")}, elementFormDefault=XmlNsForm.QUALIFIED) public class ComponentQNameTrueComponentContentTrue { private Child child; @JBossXmlNsPrefix(prefix = "child", applyToComponentContent=true) public Child getChild() { return child; } public void setChild(Child child) { this.child = child; } } ././@LongLink0000000000000000000000000000023700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jbossxmlnsprefix/support/GroupWithJBossXmlNsPrefixProperty.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/jboss0000644000175000017500000000765411134036000033211 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element.jbossxmlnsprefix.support; import javax.xml.bind.annotation.XmlElement; import org.jboss.xb.annotations.JBossXmlModelGroup; import org.jboss.xb.annotations.JBossXmlNsPrefix; /** * A GroupWithJBossXmlNsPrefixProperty. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlModelGroup(name="group", propOrder={"applyToGroupTrueApplyToContentFalse", "applyToGroupFalseApplyToContentFalse", "applyToGroupTrueApplyToContentTrue", "applyToGroupFalseApplyToContentTrue"}) public class GroupWithJBossXmlNsPrefixProperty { private Child1 applyToGroupTrueApplyToContentFalse; private Child2 applyToGroupFalseApplyToContentFalse; private Child3 applyToGroupTrueApplyToContentTrue; private Child4 applyToGroupFalseApplyToContentTrue; @XmlElement(name="group-true-content-false") @JBossXmlNsPrefix(prefix="child", applyToComponentQName=true, applyToComponentContent=false) public Child1 getApplyToGroupTrueApplyToContentFalse() { return applyToGroupTrueApplyToContentFalse; } public void setApplyToGroupTrueApplyToContentFalse(Child1 ApplyToGroupTrueApplyToContentFalse) { this.applyToGroupTrueApplyToContentFalse = ApplyToGroupTrueApplyToContentFalse; } @XmlElement(name="group-false-content-false") @JBossXmlNsPrefix(prefix="child", applyToComponentQName=false, applyToComponentContent=false) public Child2 getApplyToGroupFalseApplyToContentFalse() { return applyToGroupFalseApplyToContentFalse; } public void setApplyToGroupFalseApplyToContentFalse(Child2 applyToElementFalseApplyToTypeFalse) { this.applyToGroupFalseApplyToContentFalse = applyToElementFalseApplyToTypeFalse; } @XmlElement(name="group-true-content-true") @JBossXmlNsPrefix(prefix="child", applyToComponentQName=true, applyToComponentContent=true) public Child3 getApplyToGroupTrueApplyToContentTrue() { return applyToGroupTrueApplyToContentTrue; } public void setApplyToGroupTrueApplyToContentTrue(Child3 ApplyToGroupTrueApplyToContentTrue) { this.applyToGroupTrueApplyToContentTrue = ApplyToGroupTrueApplyToContentTrue; } @XmlElement(name="group-false-content-true") @JBossXmlNsPrefix(prefix="child", applyToComponentQName=false, applyToComponentContent=true) public Child4 getApplyToGroupFalseApplyToContentTrue() { return applyToGroupFalseApplyToContentTrue; } public void setApplyToGroupFalseApplyToContentTrue(Child4 ApplyToGroupFalseApplyToContentTrue) { this.applyToGroupFalseApplyToContentTrue = ApplyToGroupFalseApplyToContentTrue; } public static final class Child1 extends Child {} public static final class Child2 extends Child {} public static final class Child3 extends Child {} public static final class Child4 extends Child {} } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/ObjectElementTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/element/Objec0000755000175000017500000000345210562616254033131 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.element; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.element.xmlelement.ObjectXmlElementTestSuite; import org.jboss.test.xb.builder.object.element.xmlrootelement.ObjectXmlRootElementTestSuite; /** * ObjectElementTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectElementTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object Element Tests"); suite.addTest(ObjectXmlRootElementTestSuite.suite()); suite.addTest(ObjectXmlElementTestSuite.suite()); return suite; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/0000755000175000017500000000000011620316747031505 5ustar twernertwerner././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltransient/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltrans0000755000175000017500000000000011620316747033276 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltransient/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltrans0000755000175000017500000000000011620316747033276 5ustar twernertwerner././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltransient/test/XmlTransientInheritanceUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltrans0000644000175000017500000000432610562616254033305 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltransient.test; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmltransient.support.Factory; import org.jboss.test.xb.builder.object.type.xmltransient.support.FactoryBean; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * AllUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class XmlTransientInheritanceUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(XmlTransientInheritanceUnitTestCase.class); } public XmlTransientInheritanceUnitTestCase(String name) { super(name); } public void testUnmarshal() throws Exception { Factory factory = unmarshalObject(Factory.class); assertEquals(FactoryBean.class.getName(), factory.getClassName()); assertEquals(Object.class.getName(), factory.getBeanClassName()); } public void testBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(Factory.class); assertNotNull(schemaBinding); // TODO check the model } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltransient/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltrans0000755000175000017500000000000011620316747033276 5ustar twernertwerner././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltransient/support/FactoryBean.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltrans0000644000175000017500000000300110562616254033272 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltransient.support; /** * FactoryBean. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class FactoryBean { private String className; public String getClassName() { return className; } public void setClassName(String className) { this.className = className; } public Object create() throws Exception { Class clazz = Class.forName(className); return clazz.newInstance(); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltransient/support/Factory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltrans0000644000175000017500000000446110562616254033305 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltransient.support; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlTransient; /** * Factory. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Factory extends Bean { private String beanClassName; public Factory() { super.setClassName(FactoryBean.class.getName()); } /* Uncommenting this makes no difference public String getClassName() { return super.getClassName(); } */ @XmlTransient @Override public void setClassName(String className) { throw new RuntimeException("This method is marked @XmlTransient why is it being invoked by JAXB?"); } public String getBeanClassName() { return beanClassName; } @XmlAttribute(name="className") public void setBeanClassName(String beanClassName) { this.beanClassName = beanClassName; } @Override public Object getBean() throws Exception { FactoryBean factoryBean = (FactoryBean) super.getBean(); return factoryBean.create(); } @Override protected Object initialize() throws Exception { FactoryBean factoryBean = (FactoryBean) super.initialize(); factoryBean.setClassName(beanClassName); return factoryBean; } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltransient/support/Bean.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltrans0000644000175000017500000000335210562616254033303 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltransient.support; import javax.xml.bind.annotation.XmlAttribute; /** * Bean. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Bean { private String className; private Object instance; public String getClassName() { return className; } @XmlAttribute public void setClassName(String className) { this.className = className; } public Object getBean() throws Exception { if (instance == null) instance = initialize(); return instance; } protected Object initialize() throws Exception { Class clazz = Class.forName(className); return clazz.newInstance(); } } ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltransient/ObjectTypeXmlTransientTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltrans0000755000175000017500000000334710562616254033312 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltransient; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.type.xmltransient.test.XmlTransientInheritanceUnitTestCase; /** * ObjectTypeXmlTransientTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectTypeXmlTransientTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object Type XmlTransient Tests"); suite.addTest(XmlTransientInheritanceUnitTestCase.suite()); // TODO more tests return suite; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor0000755000175000017500000000000011620316746033227 5ustar twernertwerner././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor0000755000175000017500000000000011620316745033226 5ustar twernertwerner././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor/test/SequenceUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor0000644000175000017500000000771311153522526033235 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.accessor.test; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.accessor.support.Sequence; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * SequenceUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class SequenceUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(SequenceUnitTestCase.class); } public SequenceUnitTestCase(String name) { super(name); } public void testUnmarshal() throws Exception { Sequence sequence = unmarshalObject(Sequence.class); assertEquals("one", sequence.getOne()); assertEquals("two", sequence.getTwo()); assertEquals("three", sequence.getThree()); } @SuppressWarnings("unchecked") public void testBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(Sequence.class); assertNotNull(schemaBinding); QName qName = new QName(XMLConstants.NULL_NS_URI, "sequence"); TypeBinding typeBinding = schemaBinding.getType(qName); assertNotNull(typeBinding); ParticleBinding particle = typeBinding.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); assertTrue(term instanceof SequenceBinding || term instanceof UnorderedSequenceBinding); ModelGroupBinding sequence = (ModelGroupBinding) term; List elements = new ArrayList(); Collection particles = sequence.getParticles(); for (ParticleBinding p : particles) { term = p.getTerm(); assertTrue(term instanceof ElementBinding); elements.add(((ElementBinding) term).getQName()); } ArrayList expected = new ArrayList(); expected.add(new QName(XMLConstants.NULL_NS_URI, "three")); expected.add(new QName(XMLConstants.NULL_NS_URI, "two")); expected.add(new QName(XMLConstants.NULL_NS_URI, "one")); if(sequence instanceof SequenceBinding) assertEquals(expected, elements); else { assertEquals(expected.size(), elements.size()); assertTrue(expected.containsAll(elements)); } } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor/test/AllUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor0000644000175000017500000000674211061473704033237 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.accessor.test; import java.util.Collection; import java.util.HashSet; import java.util.Set; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.accessor.support.All; import org.jboss.xb.binding.sunday.unmarshalling.AllBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * AllUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class AllUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(AllUnitTestCase.class); } public AllUnitTestCase(String name) { super(name); } public void testUnmarshal() throws Exception { All all = unmarshalObject(All.class); assertEquals("one", all.getOne()); assertEquals("two", all.getTwo()); assertEquals("three", all.getThree()); } @SuppressWarnings("unchecked") public void testBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(All.class); assertNotNull(schemaBinding); QName qName = new QName(XMLConstants.NULL_NS_URI, "all"); TypeBinding typeBinding = schemaBinding.getType(qName); assertNotNull(typeBinding); ParticleBinding particle = typeBinding.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); assertTrue(term instanceof AllBinding); AllBinding all = (AllBinding) term; Set elements = new HashSet(); Collection particles = all.getParticles(); for (ParticleBinding p : particles) { term = p.getTerm(); assertTrue(term instanceof ElementBinding); elements.add(((ElementBinding) term).getQName()); } HashSet expected = new HashSet(); expected.add(new QName(XMLConstants.NULL_NS_URI, "one")); expected.add(new QName(XMLConstants.NULL_NS_URI, "two")); expected.add(new QName(XMLConstants.NULL_NS_URI, "three")); assertEquals(expected, elements); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor/test/AlphaUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor0000644000175000017500000000774711153522526033244 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.accessor.test; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.accessor.support.Alpha; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * AlphaUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class AlphaUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(AlphaUnitTestCase.class); } public AlphaUnitTestCase(String name) { super(name); } public void testUnmarshal() throws Exception { Alpha alpha = unmarshalObject(Alpha.class); assertEquals("one", alpha.getOne()); assertEquals("two", alpha.getTwo()); assertEquals("three", alpha.getThree()); } @SuppressWarnings("unchecked") public void testBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(Alpha.class); assertNotNull(schemaBinding); QName qName = new QName(XMLConstants.NULL_NS_URI, "alpha"); TypeBinding typeBinding = schemaBinding.getType(qName); assertNotNull(typeBinding); ParticleBinding particle = typeBinding.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); assertTrue(term instanceof SequenceBinding || term instanceof UnorderedSequenceBinding); ModelGroupBinding sequence = (ModelGroupBinding) term; List elements = new ArrayList(); Collection particles = sequence.getParticles(); for (ParticleBinding p : particles) { term = p.getTerm(); assertTrue(term instanceof ElementBinding); elements.add(((ElementBinding) term).getQName()); } ArrayList expected = new ArrayList(); expected.add(new QName(XMLConstants.NULL_NS_URI, "one")); expected.add(new QName(XMLConstants.NULL_NS_URI, "three")); expected.add(new QName(XMLConstants.NULL_NS_URI, "two")); if(sequence instanceof SequenceBinding) assertEquals(expected, elements); else { assertTrue(sequence instanceof UnorderedSequenceBinding); assertEquals(expected.size(), elements.size()); assertTrue(expected.containsAll(elements)); } } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor/ObjectTypeAccessorTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor0000755000175000017500000000362410562616254033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.accessor; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.type.accessor.test.AllUnitTestCase; import org.jboss.test.xb.builder.object.type.accessor.test.AlphaUnitTestCase; import org.jboss.test.xb.builder.object.type.accessor.test.SequenceUnitTestCase; /** * ObjectTypeAccessorTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectTypeAccessorTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object Type Accessor Tests"); suite.addTest(AllUnitTestCase.suite()); suite.addTest(SequenceUnitTestCase.suite()); suite.addTest(AlphaUnitTestCase.suite()); return suite; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor0000755000175000017500000000000011620316746033227 5ustar twernertwerner././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor/support/Alpha.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor0000644000175000017500000000257010562616254033236 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.accessor.support; import javax.xml.bind.annotation.XmlAccessOrder; import javax.xml.bind.annotation.XmlAccessorOrder; import javax.xml.bind.annotation.XmlType; /** * Alpha. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlAccessorOrder(XmlAccessOrder.ALPHABETICAL) @XmlType public class Alpha extends Bean { } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor/support/All.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor0000644000175000017500000000235710562616254033241 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.accessor.support; import javax.xml.bind.annotation.XmlType; /** * All. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlType(propOrder={}) public class All extends Bean { } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor/support/Sequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor0000644000175000017500000000242010562616254033230 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.accessor.support; import javax.xml.bind.annotation.XmlType; /** * Sequence. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlType(propOrder={ "three", "two", "one" }) public class Sequence extends Bean { } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor/support/Bean.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/accessor0000644000175000017500000000315310562616254033234 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.accessor.support; /** * Bean. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Bean { private String one; private String two; private String three; public String getOne() { return one; } public void setOne(String one) { this.one = one; } public String getThree() { return three; } public void setThree(String three) { this.three = three; } public String getTwo() { return two; } public void setTwo(String two) { this.two = two; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/0000755000175000017500000000000011620316747032621 5ustar twernertwerner././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/te0000755000175000017500000000000011620316747033152 5ustar twernertwerner././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/test/AbstractValueTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/te0000644000175000017500000000472510721043730033152 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.value.test; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.value.support.SimpleValue; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * AllUnitTestCase. * * @param the simple value type * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractValueTest extends AbstractBuilderTest { /** The root class */ private Class root; /** The expected value */ private Object expected; private String valueElement; public AbstractValueTest(String name, Class root, Object expected, String valueElement) { super(name); this.root = root; this.expected = expected; this.valueElement = valueElement; } public void testUnmarshal() throws Exception { T result = unmarshalObject(root); Object actual = result.getValue(); assertEquals(expected, actual); } public void testValueBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(root); assertNotNull(schemaBinding); ElementBinding element = schemaBinding.getElement(new QName(valueElement)); assertNotNull(element); assertNotNull(element.getType().getSimpleType()); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/test/StringUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/te0000644000175000017500000000302310721043730033140 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.value.test; import org.jboss.test.xb.builder.object.type.value.support.StringValue; import junit.framework.Test; /** * StringUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class StringUnitTestCase extends AbstractValueTest { public static Test suite() { return suite(StringUnitTestCase.class); } public StringUnitTestCase(String name) { super(name, StringValue.class, "Hello", "string-value"); } } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/test/SpecifiedValueUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/te0000644000175000017500000000410510562616254033154 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.value.test; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.value.support.SpecifiedValue; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * SpecifiedValueUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class SpecifiedValueUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(SpecifiedValueUnitTestCase.class); } public SpecifiedValueUnitTestCase(String name) { super(name); } public void testUnmarshal() throws Exception { SpecifiedValue result = unmarshalObject(SpecifiedValue.class); Object actual = result.getNotValue(); assertEquals("Hello", actual); } public void testValueBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(SpecifiedValue.class); assertNotNull(schemaBinding); // TODO check the model } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/test/IntegerUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/te0000644000175000017500000000304210721043730033141 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.value.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.type.value.support.IntegerValue; /** * IntegerUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class IntegerUnitTestCase extends AbstractValueTest { public static Test suite() { return suite(IntegerUnitTestCase.class); } public IntegerUnitTestCase(String name) { super(name, IntegerValue.class, new Integer(4), "integer-value"); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/ObjectTypeValueTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/Ob0000755000175000017500000000370010625561630033104 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.value; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.type.value.test.IntegerUnitTestCase; import org.jboss.test.xb.builder.object.type.value.test.SpecifiedValueUnitTestCase; import org.jboss.test.xb.builder.object.type.value.test.StringUnitTestCase; /** * ObjectTypeXmlTransientTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectTypeValueTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object Type Value Tests"); suite.addTest(SpecifiedValueUnitTestCase.suite()); suite.addTest(StringUnitTestCase.suite()); suite.addTest(IntegerUnitTestCase.suite()); // TODO test all simple types return suite; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/su0000755000175000017500000000000011620316750033163 5ustar twernertwerner././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/support/IntegerValue.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/su0000644000175000017500000000264510625561630033177 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.value.support; import javax.xml.bind.annotation.XmlValue; /** * IntegerValue. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class IntegerValue implements SimpleValue { private Integer value; public Integer getValue() { return value; } @XmlValue public void setValue(Integer value) { this.value = value; } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/support/SimpleValue.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/su0000644000175000017500000000230710562616254033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.value.support; /** * SimpleValue. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface SimpleValue { Object getValue(); } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/support/SpecifiedValue.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/su0000644000175000017500000000315110562616254033173 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.value.support; import javax.xml.bind.annotation.XmlValue; /** * SpecifiedValue. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class SpecifiedValue { private String value; public String getValue() { throw new UnsupportedOperationException("Not the value"); } public void setValue(String value) { throw new UnsupportedOperationException("Not the value"); } @XmlValue public String getNotValue() { return value; } public void setNotValue(String value) { this.value = value; } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/support/StringValue.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/value/su0000644000175000017500000000263410625561630033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.value.support; import javax.xml.bind.annotation.XmlValue; /** * StringValue. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class StringValue implements SimpleValue { private String value; public String getValue() { return value; } @XmlValue public void setValue(String value) { this.value = value; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmltype/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000755000175000017500000000000011620316746033266 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmltype/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000755000175000017500000000000011620316746033266 5ustar twernertwerner././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmltype/test/JBossXmlTypeUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000001572711171577572033313 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmltype.test; import java.util.Collection; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.jbossxmltype.support.RootWithDefaults; import org.jboss.test.xb.builder.object.type.jbossxmltype.support.RootWithModelGroupAll; import org.jboss.test.xb.builder.object.type.jbossxmltype.support.RootWithModelGroupChoice; import org.jboss.test.xb.builder.object.type.jbossxmltype.support.RootWithXmlTypePropOrder; import org.jboss.test.xb.builder.object.type.jbossxmltype.support.RootWithModelGroupSequence; import org.jboss.test.xb.builder.object.type.jbossxmltype.support.RootWithModelGroupUnorderedSequence; import org.jboss.xb.binding.sunday.unmarshalling.AllBinding; import org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A JBossXmlTypeUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class JBossXmlTypeUnitTestCase extends AbstractBuilderTest { public JBossXmlTypeUnitTestCase(String name) { super(name); } private boolean defaultSequence; private boolean sequencesRequirePropOrder; protected void setUp() throws Exception { super.setUp(); defaultSequence = JBossXBBuilder.isUseUnorderedSequence(); JBossXBBuilder.setUseUnorderedSequence(false); sequencesRequirePropOrder = JBossXBBuilder.isSequencesRequirePropOrder(); JBossXBBuilder.setSequencesRequirePropOrder(false); } protected void tearDown() throws Exception { super.tearDown(); JBossXBBuilder.setUseUnorderedSequence(defaultSequence); JBossXBBuilder.setSequencesRequirePropOrder(sequencesRequirePropOrder); } public void testModelGroupWithDefaults() throws Exception { ModelGroupBinding group = getTypeModelGroup(RootWithDefaults.class); assertTrue(group instanceof SequenceBinding); // but it's unpredictable assertUnorderedGroup(group); } public void testModelGroupWithXmlTypePropOrder() throws Exception { ModelGroupBinding group = getTypeModelGroup(RootWithXmlTypePropOrder.class); assertTrue(group instanceof SequenceBinding); assertOrderedGroup(group); } public void testModelGroupSequence() throws Exception { ModelGroupBinding group = getTypeModelGroup(RootWithModelGroupSequence.class); assertTrue(group instanceof SequenceBinding); assertOrderedGroup(group); } public void testModelGroupChoice() throws Exception { ModelGroupBinding group = getTypeModelGroup(RootWithModelGroupChoice.class); assertTrue(group instanceof ChoiceBinding); assertUnorderedGroup(group); } public void testModelGroupAll() throws Exception { ModelGroupBinding group = getTypeModelGroup(RootWithModelGroupAll.class); assertTrue(group instanceof AllBinding); assertUnorderedGroup(group); } public void testModelGroupUnorderedSequence() throws Exception { ModelGroupBinding group = getTypeModelGroup(RootWithModelGroupUnorderedSequence.class); assertTrue(group instanceof UnorderedSequenceBinding); assertUnorderedGroup(group); } private void assertOrderedGroup(ModelGroupBinding group) { Collection particles = group.getParticles(); assertEquals(2, particles.size()); Iterator i = particles.iterator(); ParticleBinding p = i.next(); assertEquals(0, p.getMinOccurs()); assertEquals(1, p.getMaxOccurs()); assertFalse(p.getMaxOccursUnbounded()); TermBinding t = p.getTerm(); assertTrue(t.isElement()); assertEquals(new QName("a"), ((ElementBinding)t).getQName()); p = i.next(); assertEquals(0, p.getMinOccurs()); assertEquals(1, p.getMaxOccurs()); assertFalse(p.getMaxOccursUnbounded()); t = p.getTerm(); assertTrue(t.isElement()); assertEquals(new QName("b"), ((ElementBinding)t).getQName()); } private void assertUnorderedGroup(ModelGroupBinding group) { Collection particles = group.getParticles(); assertEquals(2, particles.size()); Iterator i = particles.iterator(); ParticleBinding p = i.next(); assertEquals(0, p.getMinOccurs()); assertEquals(1, p.getMaxOccurs()); assertFalse(p.getMaxOccursUnbounded()); TermBinding t = p.getTerm(); assertTrue(t.isElement()); QName eName = ((ElementBinding)t).getQName(); if(!new QName("a").equals(eName)) assertEquals(new QName("b"), eName); p = i.next(); assertEquals(0, p.getMinOccurs()); assertEquals(1, p.getMaxOccurs()); assertFalse(p.getMaxOccursUnbounded()); t = p.getTerm(); assertTrue(t.isElement()); eName = ((ElementBinding)t).getQName(); if(!new QName("a").equals(eName)) assertEquals(new QName("b"), eName); } private ModelGroupBinding getTypeModelGroup(Class root) { SchemaBinding schema = JBossXBBuilder.build(root); ElementBinding e = schema.getElement(new QName("root")); assertNotNull(e); TermBinding t = e.getType().getParticle().getTerm(); assertTrue(t.isModelGroup()); return (ModelGroupBinding) t; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmltype/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000755000175000017500000000000011620316747033267 5ustar twernertwerner././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmltype/support/AbstractRoot.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000304211151307541033257 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmltype.support; /** * A AbstractRoot. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public abstract class AbstractRoot { private String a; private String b; public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmltype/support/RootWithDefaults.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000273111151307541033263 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmltype.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlType; /** * A RootWithDefaults. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType() @JBossXmlType() public class RootWithDefaults extends AbstractRoot { } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmltype/support/RootWithXmlTypePropOrder.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000276511151307541033272 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmltype.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlType; /** * A RootWithDefaults. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"a", "b"}) @JBossXmlType() public class RootWithXmlTypePropOrder extends AbstractRoot { } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmltype/support/RootWithModelGroupAll.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000312211151307541033256 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmltype.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlType; /** * A RootWithDefaults. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"a", "b"}) @JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_ALL) public class RootWithModelGroupAll extends AbstractRoot { } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmltype/support/RootWithModelGroupChoice.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000313011151307541033255 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmltype.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlType; /** * A RootWithDefaults. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"a", "b"}) @JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_CHOICE) public class RootWithModelGroupChoice extends AbstractRoot { } ././@LongLink0000000000000000000000000000022100000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmltype/support/RootWithModelGroupSequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000313411151307541033261 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmltype.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlType; /** * A RootWithDefaults. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"a", "b"}) @JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_SEQUENCE) public class RootWithModelGroupSequence extends AbstractRoot { } ././@LongLink0000000000000000000000000000023200000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmltype/support/RootWithModelGroupUnorderedSequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000315711151307541033266 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmltype.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlType; /** * A RootWithDefaults. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"a", "b"}) @JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE) public class RootWithModelGroupUnorderedSequence extends AbstractRoot { } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000755000175000017500000000000011620316747033172 5ustar twernertwerner././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000755000175000017500000000000011620316747033172 5ustar twernertwerner././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/EnumConstantUnconvertableUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000340111171577572033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.AbstractErrorTest; import org.jboss.test.xb.builder.object.type.xmlenum.support.EnumConstantUnconvertable; import org.jboss.xb.binding.JBossXBRuntimeException; /** * EnumConstantUnconvertableUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class EnumConstantUnconvertableUnitTestCase extends AbstractErrorTest { public static Test suite() { return suite(EnumConstantUnconvertableUnitTestCase.class); } public EnumConstantUnconvertableUnitTestCase(String name) { super(name, EnumConstantUnconvertable.class, JBossXBRuntimeException.class); } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/FailIgnoreCaseTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000332011171577572033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.AbstractErrorTest; import org.jboss.test.xb.builder.object.type.xmlenum.support.ignorecase.WrongKeyEnum; import org.jboss.xb.binding.JBossXBRuntimeException; /** * Fail ignore test case enum. * * @author Ales Justin */ public class FailIgnoreCaseTestCase extends AbstractErrorTest { public FailIgnoreCaseTestCase(String name) { super(name, WrongKeyEnum.class, JBossXBRuntimeException.class); } public static Test suite() { return suite(FailIgnoreCaseTestCase.class); } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/IgnoreCaseUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000461010770206227033171 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.type.xmlenum.support.ignorecase.Root; import org.jboss.xb.builder.runtime.EnumValueAdapter; /** * Ignore test case enum. * * @author Ales Justin */ public class IgnoreCaseUnitTestCase extends AbstractDefaultsTest { public IgnoreCaseUnitTestCase(String name) { super(name, Root.class); } public static Test suite() { return suite(IgnoreCaseUnitTestCase.class); } protected void testEnumValueAdapter(EnumValueAdapter enumValueAdapter) { super.testEnumValueAdapter(enumValueAdapter); assertEquals(Root.ONE, enumValueAdapter.cast("one", Root.class)); assertEquals(Root.ONE, enumValueAdapter.cast("One", Root.class)); assertEquals(Root.ONE, enumValueAdapter.cast("ONE", Root.class)); assertEquals(Root.TWO, enumValueAdapter.cast("two", Root.class)); assertEquals(Root.TWO, enumValueAdapter.cast("Two", Root.class)); assertEquals(Root.TWO, enumValueAdapter.cast("TWO", Root.class)); assertEquals(Root.THREE, enumValueAdapter.cast("three", Root.class)); assertEquals(Root.THREE, enumValueAdapter.cast("Three", Root.class)); assertEquals(Root.THREE, enumValueAdapter.cast("THREE", Root.class)); } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/EnumGlobalTypeUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000542610713160561033174 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlenum.support.EnumGlobalType; import org.jboss.util.Strings; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * EnumGlobalTypeUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class EnumGlobalTypeUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(EnumGlobalTypeUnitTestCase.class); } public EnumGlobalTypeUnitTestCase(String name) { super(name); } public void testGlobalEnumUnmarshal() throws Exception { unmarshalObject(EnumGlobalType.class); } public void testGlobalEnumTypeBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(EnumGlobalType.class); assertNotNull(schemaBinding); // Check the global type QName qName = new QName(XMLConstants.NULL_NS_URI, "enum-global-type"); TypeBinding type = schemaBinding.getType(qName); assertNotNull(type); assertEquals(qName, type.getQName()); ElementBinding elementBinding = schemaBinding.getElement(qName); assertNotNull(elementBinding); TypeBinding typeBinding = elementBinding.getType(); assertNotNull(typeBinding); //System.out.println(Strings.defaultToString(type)); //System.out.println(Strings.defaultToString(typeBinding)); assertTrue(type == typeBinding); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/DefaultsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000277110562616254033203 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.type.xmlenum.support.defaults.Root; /** * DefaultsTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class DefaultsUnitTestCase extends AbstractDefaultsTest { public static Test suite() { return suite(DefaultsUnitTestCase.class); } public DefaultsUnitTestCase(String name) { super(name, Root.class); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/AbstractDefaultsTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000665310770206227033202 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.test; import java.util.HashMap; import java.util.Map; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.EnumValueAdapter; /** * AbstractDefaultsTest. * * @param the enumeration type * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractDefaultsTest> extends AbstractBuilderTest { /** The root class */ private Class root; /** The expected mapping */ private Map expected = new HashMap(); public AbstractDefaultsTest(String name, Class root) { super(name); this.root = root; T[] constants = root.getEnumConstants(); for (int i = 0; i < constants.length; ++i) expected.put(constants[i].name(), constants[i]); } public void testDefaultsUnmarshal() throws Exception { T result = unmarshalObject(root); assertTrue(expected.get("ONE") == result); } public void testDefaultsEnumBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(root); testDefaults(schemaBinding); } protected void testDefaults(SchemaBinding schemaBinding) { assertNotNull(schemaBinding); // Check the type QName qName = new QName(XMLConstants.NULL_NS_URI, "root"); QName elementName = qName; TypeBinding type = schemaBinding.getType(qName); assertNull(type); ElementBinding elementBinding = schemaBinding.getElement(elementName); assertNotNull(elementBinding); TypeBinding typeBinding = elementBinding.getType(); ValueAdapter valueAdapter = typeBinding.getValueAdapter(); assertNotNull(valueAdapter); assertTrue(valueAdapter instanceof EnumValueAdapter); testEnumValueAdapter((EnumValueAdapter)valueAdapter); } protected void testEnumValueAdapter(EnumValueAdapter enumValueAdapter) { Map actual = enumValueAdapter.getMapping(); assertEquals(expected, actual); } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/MatchCaseUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000473210770206227033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.test; import org.jboss.test.xb.builder.object.type.xmlenum.support.matchcase.Root; import org.jboss.xb.builder.runtime.EnumValueAdapter; import junit.framework.Test; /** * Match case test case enum. * * @author Ales Justin */ public class MatchCaseUnitTestCase extends AbstractDefaultsTest { public MatchCaseUnitTestCase(String name) { super(name, Root.class); } public static Test suite() { return suite(MatchCaseUnitTestCase.class); } protected void fail(EnumValueAdapter enumValueAdapter, String key) { try { enumValueAdapter.cast(key, Root.class); fail("Should not be here."); } catch(Exception e) { assertInstanceOf(e, RuntimeException.class); } } protected void testEnumValueAdapter(EnumValueAdapter enumValueAdapter) { super.testEnumValueAdapter(enumValueAdapter); fail(enumValueAdapter, "one"); fail(enumValueAdapter, "One"); assertEquals(Root.ONE, enumValueAdapter.cast("ONE", Root.class)); fail(enumValueAdapter, "two"); fail(enumValueAdapter, "Two"); assertEquals(Root.TWO, enumValueAdapter.cast("TWO", Root.class)); fail(enumValueAdapter, "three"); fail(enumValueAdapter, "Three"); assertEquals(Root.THREE, enumValueAdapter.cast("THREE", Root.class)); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/NoneUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000275110562616254033201 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.type.xmlenum.support.none.Root; /** * NoneUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NoneUnitTestCase extends AbstractDefaultsTest { public static Test suite() { return suite(NoneUnitTestCase.class); } public NoneUnitTestCase(String name) { super(name, Root.class); } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/CollectionOfEnumUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000432410713160561033170 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.test; import java.util.List; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlenum.support.CollectionOfEnum; import org.jboss.test.xb.builder.object.type.xmlenum.support.EnumGlobalType; /** * A CollectionOfEnumUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class CollectionOfEnumUnitTestCase extends AbstractBuilderTest { public CollectionOfEnumUnitTestCase(String name) { super(name); } public void testMain() throws Exception { CollectionOfEnum colOfEnum = unmarshalObject(CollectionOfEnum.class); List enums = colOfEnum.getEnums(); assertNotNull(enums); assertEquals(6, enums.size()); assertEquals(EnumGlobalType.ONE, enums.get(0)); assertEquals(EnumGlobalType.TWO, enums.get(1)); assertEquals(EnumGlobalType.TWO, enums.get(2)); assertEquals(EnumGlobalType.THREE, enums.get(3)); assertEquals(EnumGlobalType.THREE, enums.get(4)); assertEquals(EnumGlobalType.THREE, enums.get(5)); } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/NonDefaultsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000636410562616254033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.test; import java.util.HashMap; import java.util.Map; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlenum.support.nondefaults.Root; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.EnumValueAdapter; /** * NonDefaultsUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NonDefaultsUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(NonDefaultsUnitTestCase.class); } public NonDefaultsUnitTestCase(String name) { super(name); } public void testNonDefaultsUnmarshal() throws Exception { unmarshalObject(Root.class); } public void testNonDefaultsTypeBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(Root.class); assertNotNull(schemaBinding); // Check the type QName qName = new QName("testNamespace", "nondefaults"); TypeBinding type = schemaBinding.getType(qName); assertNull(type); QName elementName = new QName(XMLConstants.NULL_NS_URI, "root"); ElementBinding elementBinding = schemaBinding.getElement(elementName); assertNotNull(elementBinding); TypeBinding typeBinding = elementBinding.getType(); ValueAdapter valueAdapter = typeBinding.getValueAdapter(); assertNotNull(valueAdapter); assertTrue(valueAdapter instanceof EnumValueAdapter); EnumValueAdapter enumValueAdapter = (EnumValueAdapter) valueAdapter; HashMap expected = new HashMap(); expected.put(new Integer(1), Root.ONE); expected.put(new Integer(2), Root.TWO); expected.put(new Integer(3), Root.THREE); Map actual = enumValueAdapter.getMapping(); assertEquals(expected, actual); } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/test/EnumNotSimpleUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000327111171577572033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.AbstractErrorTest; import org.jboss.test.xb.builder.object.type.xmlenum.support.EnumNotSimple; import org.jboss.xb.binding.JBossXBRuntimeException; /** * EnumNotSimpleUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class EnumNotSimpleUnitTestCase extends AbstractErrorTest { public static Test suite() { return suite(EnumNotSimpleUnitTestCase.class); } public EnumNotSimpleUnitTestCase(String name) { super(name, EnumNotSimple.class, JBossXBRuntimeException.class); } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/ObjectTypeXmlEnumTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000755000175000017500000000535710770206227033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.type.xmlenum.test.DefaultsUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlenum.test.EnumConstantUnconvertableUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlenum.test.EnumGlobalTypeUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlenum.test.EnumNotSimpleUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlenum.test.NonDefaultsUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlenum.test.NoneUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlenum.test.IgnoreCaseUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlenum.test.FailIgnoreCaseTestCase; import org.jboss.test.xb.builder.object.type.xmlenum.test.MatchCaseUnitTestCase; /** * ObjectTypeXmlAnyElementTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectTypeXmlEnumTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object Type XmlEnum Tests"); suite.addTest(NoneUnitTestCase.suite()); suite.addTest(DefaultsUnitTestCase.suite()); suite.addTest(NonDefaultsUnitTestCase.suite()); suite.addTest(EnumGlobalTypeUnitTestCase.suite()); suite.addTest(EnumNotSimpleUnitTestCase.suite()); suite.addTest(EnumConstantUnconvertableUnitTestCase.suite()); suite.addTest(IgnoreCaseUnitTestCase.suite()); suite.addTest(FailIgnoreCaseTestCase.suite()); suite.addTest(MatchCaseUnitTestCase.suite()); return suite; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000755000175000017500000000000011620316747033172 5ustar twernertwerner././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/defaults/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000755000175000017500000000000011620316747033172 5ustar twernertwerner././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/defaults/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000240010562616254033170 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.support.defaults; import javax.xml.bind.annotation.XmlEnum; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlEnum public enum Root { ONE, TWO, THREE, } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/CollectionOfEnum.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000276010713160561033172 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.support; import java.util.List; /** * A CollectionOfEnum. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class CollectionOfEnum { private List col; public List getEnums() { return col; } public void setEnums(List col) { this.col = col; } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/EnumGlobalType.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000240110562616254033171 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.support; import javax.xml.bind.annotation.XmlType; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlType public enum EnumGlobalType { ONE, TWO, THREE, } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/ignorecase/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000755000175000017500000000000011620316747033172 5ustar twernertwerner././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/ignorecase/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000242610770206227033174 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.support.ignorecase; import org.jboss.xb.annotations.JBossXmlEnum; /** * @author Ales Justin */ @JBossXmlEnum(ignoreCase=true) public enum Root { ONE, TWO, THREE } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/ignorecase/WrongKeyEnum.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000320410770206227033167 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.support.ignorecase; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import org.jboss.xb.annotations.JBossXmlEnum; /** * @author Ales Justin */ @JBossXmlEnum(ignoreCase=true) @XmlEnum(Integer.class) public enum WrongKeyEnum { @XmlEnumValue("1") ONE(1), @XmlEnumValue("2") TWO(2), @XmlEnumValue("3") THREE(3); private int number; WrongKeyEnum(int number) { this.number = number; } public int getNumber() { return number; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/none/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000755000175000017500000000000011620316747033172 5ustar twernertwerner././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/none/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000231010562616254033170 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.support.none; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ public enum Root { ONE, TWO, THREE, } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/nondefaults/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000755000175000017500000000000011620316747033172 5ustar twernertwerner././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/nondefaults/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000260310562616254033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.support.nondefaults; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlEnum(Integer.class) public enum Root { @XmlEnumValue("1") ONE, @XmlEnumValue("2") TWO, @XmlEnumValue("3") THREE, } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/EnumConstantUnconvertable.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000243310562616254033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.support; import javax.xml.bind.annotation.XmlEnum; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlEnum(Integer.class) public enum EnumConstantUnconvertable { ONE, TWO, THREE, } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/matchcase/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000755000175000017500000000000011620316747033172 5ustar twernertwerner././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/matchcase/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000242610770206227033174 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.support.matchcase; import org.jboss.xb.annotations.JBossXmlEnum; /** * @author Ales Justin */ @JBossXmlEnum(ignoreCase=false) public enum Root { ONE, TWO, THREE } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/support/EnumNotSimple.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlenum/0000644000175000017500000000242310562616254033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlenum.support; import javax.xml.bind.annotation.XmlEnum; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlEnum(value=Class.class) public enum EnumNotSimple { ONE, TWO, THREE, } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000755000175000017500000000000011620316745033265 5ustar twernertwerner././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000755000175000017500000000000011620316745033265 5ustar twernertwerner././@LongLink0000000000000000000000000000024000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/XmlTypeChoiceCollectionBindingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000001237511156144134033272 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import java.util.Collection; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithChoiceCollectionXmlType; import org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A XmlTypeChoiceCollectionBindingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class XmlTypeChoiceCollectionBindingTestCase extends AbstractJBossXmlModelGroupTest { /** * Create a new XmlTypeChoiceCollectionBindingTestCase. * * @param name */ public XmlTypeChoiceCollectionBindingTestCase(String name) { super(name); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(RootWithChoiceCollectionXmlType.class); ElementBinding e = schema.getElement(new QName("root")); assertNotNull(e); TypeBinding type = e.getType(); TermBinding t = type.getParticle().getTerm(); assertNull(type.getSimpleType()); assertTrue(t instanceof SequenceBinding || t instanceof UnorderedSequenceBinding); ModelGroupBinding s = (ModelGroupBinding) t; Collection particles = s.getParticles(); assertEquals(1, particles.size()); ParticleBinding p = particles.iterator().next(); t = p.getTerm(); assertTrue(t.isElement()); assertEquals(0, p.getMinOccurs()); assertEquals(1, p.getMaxOccurs()); assertFalse(p.getMaxOccursUnbounded()); e = (ElementBinding)t; assertEquals(new QName("choices"), e.getQName()); type = e.getType(); assertEquals(1, type.getAttributes().size()); assertNotNull(type.getAttribute(new QName("a"))); assertNotNull(type.getSimpleType()); t = type.getParticle().getTerm(); assertTrue(t instanceof SequenceBinding || t instanceof UnorderedSequenceBinding); particles = ((ModelGroupBinding)t).getParticles(); assertEquals(2, particles.size()); Iterator i = particles.iterator(); ParticleBinding choiceParticle; ParticleBinding elementParticle; if(t instanceof SequenceBinding) { elementParticle = i.next(); choiceParticle = i.next(); } else { p = i.next(); if (p.getTerm().isElement()) { elementParticle = p; choiceParticle = i.next(); } else { choiceParticle = p; elementParticle = i.next(); } } t = elementParticle.getTerm(); assertTrue(t.isElement()); assertEquals(0, elementParticle.getMinOccurs()); assertEquals(1, elementParticle.getMaxOccurs()); assertFalse(elementParticle.getMaxOccursUnbounded()); assertEquals(new QName("e"), ((ElementBinding)t).getQName()); t = choiceParticle.getTerm(); assertTrue(t instanceof ChoiceBinding); assertEquals(1, choiceParticle.getMaxOccurs()); assertTrue(choiceParticle.getMaxOccursUnbounded()); ChoiceBinding c = (ChoiceBinding) t; particles = c.getParticles(); assertEquals(2, particles.size()); Iterator choiceIter = particles.iterator(); t = choiceIter.next().getTerm(); assertTrue(t.isElement()); assertEquals(new QName("a"), ((ElementBinding)t).getQName()); t = choiceIter.next().getTerm(); assertTrue(t.isElement()); assertEquals(new QName("b"), ((ElementBinding)t).getQName()); } } ././@LongLink0000000000000000000000000000023700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/PropertySequenceUnmarshallingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000373511156144134033272 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.PropertiesSequence; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithPropertiesSequence; /** * A PropertySequenceUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class PropertySequenceUnmarshallingTestCase extends AbstractBuilderTest { public PropertySequenceUnmarshallingTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { RootWithPropertiesSequence o = unmarshalObject(RootWithPropertiesSequence.class); PropertiesSequence g = o.getGroup(); assertNotNull(g); assertEquals("a", g.getA()); assertEquals("b", g.getB()); assertEquals("c", g.getC()); } } ././@LongLink0000000000000000000000000000024700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatableParticleChoiceUnmarshallingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000477611156144134033300 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import java.util.List; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.AbstractChoice; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.ChoiceA; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.ChoiceB; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithParticlesChoiceCollection; /** * A RepeatableParticleChoiceUnmarshalling. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RepeatableParticleChoiceUnmarshallingTestCase extends AbstractBuilderTest { /** * Create a new RepeatableParticleChoiceUnmarshalling. * * @param name */ public RepeatableParticleChoiceUnmarshallingTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { RootWithParticlesChoiceCollection o = unmarshalObject(RootWithParticlesChoiceCollection.class); List choices = o.getChoices(); assertNotNull(choices); assertEquals(2, choices.size()); AbstractChoice choice = choices.get(0); assertTrue(choice instanceof ChoiceA); assertEquals("a", choice.getValue()); choice = choices.get(1); assertTrue(choice instanceof ChoiceB); assertEquals("b", choice.getValue()); } } ././@LongLink0000000000000000000000000000025000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RootWithTwoPropertyGroupsUnmarshallingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000501711156144134033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.PropertiesSequence; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithTwoPropertyGroups; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithTwoPropertyGroups.GroupWrapper1; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithTwoPropertyGroups.GroupWrapper2; /** * A RootWithTwoPropertyGroupsUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RootWithTwoPropertyGroupsUnmarshallingTestCase extends AbstractBuilderTest { public RootWithTwoPropertyGroupsUnmarshallingTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { RootWithTwoPropertyGroups o = unmarshalObject(RootWithTwoPropertyGroups.class); GroupWrapper1 gw1 = o.getGroup1(); assertNotNull(gw1); PropertiesSequence g = gw1.getGroup(); assertNotNull(g); assertEquals("a", g.getA()); assertEquals("b", g.getB()); assertEquals("c", g.getC()); GroupWrapper2 gw2 = o.getGroup2(); assertNotNull(gw2); g = gw2.getGroup(); assertNotNull(g); assertEquals("a", g.getA()); assertEquals("b", g.getB()); assertEquals("c", g.getC()); } } ././@LongLink0000000000000000000000000000024700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatablePropertyChoiceUnmarshallingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000471111156144134033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import java.util.List; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.PropertiesChoice; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithPropertiesChoiceCollection; /** * A RepeatablePropertyChoiceUnmarshallingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RepeatablePropertyChoiceUnmarshallingTestCase extends AbstractBuilderTest { /** * Create a new RepeatablePropertyChoiceUnmarshallingTestCase. * * @param name */ public RepeatablePropertyChoiceUnmarshallingTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { RootWithPropertiesChoiceCollection o = unmarshalObject(RootWithPropertiesChoiceCollection.class); List gs = o.getGroups(); assertNotNull(gs); assertEquals(3, gs.size()); PropertiesChoice g = gs.get(0); assertEquals("c", g.getC()); assertNull(g.getA()); assertNull(g.getB()); g = gs.get(1); assertNull(g.getC()); assertNull(g.getA()); assertEquals("b", g.getB()); g = gs.get(2); assertEquals("a", g.getA()); assertNull(g.getC()); assertNull(g.getB()); } } ././@LongLink0000000000000000000000000000023100000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/PropertySequenceBindingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000321411156144134033262 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithPropertiesSequence; /** * A PropertySequenceBindingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class PropertySequenceBindingTestCase extends AbstractJBossXmlModelGroupTest { public PropertySequenceBindingTestCase(String name) { super(name); } public void testBinding() throws Exception { assertPropertiesSequenceBinding(RootWithPropertiesSequence.class, false); } } ././@LongLink0000000000000000000000000000024100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatablePropertyChoiceBindingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000343311156144134033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithPropertiesChoiceCollection; /** * A RepeatablePropertyChoiceBindingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RepeatablePropertyChoiceBindingTestCase extends AbstractJBossXmlModelGroupTest { /** * Create a new RepeatablePropertyChoiceBindingTestCase. * * @param name */ public RepeatablePropertyChoiceBindingTestCase(String name) { super(name); } public void testBinding() throws Exception { assertPropertiesChoiceBinding(RootWithPropertiesChoiceCollection.class, true); } } ././@LongLink0000000000000000000000000000025000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RootWithTwoParticleGroupsUnmarshallingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000516711156144134033273 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.AbstractChoice; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.ChoiceA; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.ChoiceB; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithTwoParticleGroups; /** * A RootWithTwoParticleGroupsUnmarshallingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RootWithTwoParticleGroupsUnmarshallingTestCase extends AbstractBuilderTest { /** * Create a new RootWithTwoParticleGroupsUnmarshallingTestCase. * * @param name */ public RootWithTwoParticleGroupsUnmarshallingTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { RootWithTwoParticleGroups o = unmarshalObject(RootWithTwoParticleGroups.class); RootWithTwoParticleGroups.GroupWrapper1 group1 = o.getGroup1(); assertNotNull(group1); AbstractChoice choice = group1.getGroup(); assertNotNull(choice); assertTrue(choice instanceof ChoiceB); assertEquals("b", choice.getValue()); RootWithTwoParticleGroups.GroupWrapper2 group2 = o.getGroup2(); assertNotNull(group2); choice = group2.getGroup(); assertNotNull(choice); assertTrue(choice instanceof ChoiceA); assertEquals("a", choice.getValue()); } } ././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/PropertyAllBindingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000331311156144134033262 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithPropertiesAll; /** * A PropertyAllBindingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class PropertyAllBindingTestCase extends AbstractJBossXmlModelGroupTest { /** * Create a new PropertyAllBindingTestCase. * * @param name */ public PropertyAllBindingTestCase(String name) { super(name); } public void testBinding() throws Exception { assertPropertiesAllBinding(RootWithPropertiesAll.class, false); } } ././@LongLink0000000000000000000000000000024400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatablePropertyAllUnmarshallingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000460311156144134033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import java.util.List; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.PropertiesAll; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithPropertiesAllCollection; /** * A RepeatablePropertyAllUnmarshallingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RepeatablePropertyAllUnmarshallingTestCase extends AbstractBuilderTest { /** * Create a new RepeatablePropertyAllUnmarshallingTestCase. * * @param name */ public RepeatablePropertyAllUnmarshallingTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { RootWithPropertiesAllCollection o = unmarshalObject(RootWithPropertiesAllCollection.class); List gs = o.getGroups(); assertNotNull(gs); assertEquals("this is a known issue with repeatable all", 2, gs.size()); PropertiesAll g = gs.get(0); assertEquals("c", g.getC()); assertEquals("a", g.getA()); assertEquals("b", g.getB()); g = gs.get(1); assertEquals("cc", g.getC()); assertEquals("aa", g.getA()); assertEquals("bb", g.getB()); } } ././@LongLink0000000000000000000000000000023500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/ParticleChoiceUnmarshallingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000420111156144134033257 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.AbstractChoice; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.ChoiceB; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithParticlesChoice; /** * A ParticleChoiceUnmarshallingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ParticleChoiceUnmarshallingTestCase extends AbstractBuilderTest { /** * Create a new ParticleChoiceUnmarshallingTestCase. * * @param name */ public ParticleChoiceUnmarshallingTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { RootWithParticlesChoice o = unmarshalObject(RootWithParticlesChoice.class); AbstractChoice choice = o.getChoice(); assertNotNull(choice); assertTrue(choice instanceof ChoiceB); assertEquals("b", choice.getValue()); } } ././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/ParticleChoiceBindingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000502711156144134033266 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithParticlesChoice; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A ParticleChoiceBindingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ParticleChoiceBindingTestCase extends AbstractJBossXmlModelGroupTest { /** * Create a new ParticleChoiceBindingTestCase. * * @param name */ public ParticleChoiceBindingTestCase(String name) { super(name); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(RootWithParticlesChoice.class); ElementBinding e = schema.getElement(new QName("root")); assertNotNull(e); TermBinding t = e.getType().getParticle().getTerm(); assertTrue(t instanceof SequenceBinding || t instanceof UnorderedSequenceBinding); ModelGroupBinding s = (ModelGroupBinding) t; assertParticleChoiceBinding(s); } } ././@LongLink0000000000000000000000000000024200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RootWithTwoPropertyGroupsBindingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000001020711156144134033262 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import java.util.Collection; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithTwoPropertyGroups; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A RootWithTwoPropertyGroupsBindingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RootWithTwoPropertyGroupsBindingTestCase extends AbstractJBossXmlModelGroupTest { public RootWithTwoPropertyGroupsBindingTestCase(String name) { super(name); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(RootWithTwoPropertyGroups.class); ElementBinding e = schema.getElement(new QName("main-root")); assertNotNull(e); TermBinding t = e.getType().getParticle().getTerm(); assertTrue(t instanceof SequenceBinding || t instanceof UnorderedSequenceBinding); Collection particles = ((ModelGroupBinding)t).getParticles(); assertEquals(2, particles.size()); Iterator i = particles.iterator(); ParticleBinding group1Particle; ParticleBinding group2Particle; if(t instanceof SequenceBinding) { group1Particle = i.next(); group2Particle = i.next(); } else { ParticleBinding p = i.next(); if(((ElementBinding)p.getTerm()).getQName().equals(new QName("group1"))) { group1Particle = p; group2Particle = i.next(); } else { group2Particle = p; group1Particle = i.next(); } } t = group1Particle.getTerm(); assertTrue(t.isElement()); assertEquals(0, group1Particle.getMinOccurs()); assertEquals(1, group1Particle.getMaxOccurs()); assertFalse(group1Particle.getMaxOccursUnbounded()); ElementBinding e1 = (ElementBinding) t; assertEquals(new QName("group1"), e1.getQName()); assertPropertiesSequenceBinding((ModelGroupBinding)e1.getType().getParticle().getTerm(), false); t = group2Particle.getTerm(); assertTrue(t.isElement()); assertEquals(0, group2Particle.getMinOccurs()); assertEquals(1, group2Particle.getMaxOccurs()); assertFalse(group2Particle.getMaxOccursUnbounded()); e1 = (ElementBinding) t; assertEquals(new QName("group2"), e1.getQName()); assertPropertiesSequenceBinding((ModelGroupBinding)e1.getType().getParticle().getTerm(), false); } } ././@LongLink0000000000000000000000000000024600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/XmlTypeChoiceCollectionUnmarshallingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000532511156144134033267 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.AbstractChoice; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.ChoiceA; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.ChoiceB; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.ChoiceCollectionXmlType; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithChoiceCollectionXmlType; /** * A XmlTypeChoiceCollectionUnmarshallingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class XmlTypeChoiceCollectionUnmarshallingTestCase extends AbstractBuilderTest { /** * Create a new XmlTypeChoiceCollectionUnmarshallingTestCase. * * @param name */ public XmlTypeChoiceCollectionUnmarshallingTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { RootWithChoiceCollectionXmlType o = unmarshalObject(RootWithChoiceCollectionXmlType.class); ChoiceCollectionXmlType choices = o.getChoices(); assertEquals("a", choices.getA()); assertEquals("e", choices.getE()); assertEquals("value", choices.getValue()); assertNotNull(choices); assertEquals(2, choices.size()); AbstractChoice choice = choices.get(0); assertTrue(choice instanceof ChoiceA); assertEquals("a", choice.getValue()); choice = choices.get(1); assertTrue(choice instanceof ChoiceB); assertEquals("b", choice.getValue()); } } ././@LongLink0000000000000000000000000000025100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatablePropertySequenceUnmarshallingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000436211156144134033267 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import java.util.List; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.PropertiesSequence; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithPropertiesSequenceCollection; /** * A RepeatablePropertySequenceUnmarshallingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RepeatablePropertySequenceUnmarshallingTestCase extends AbstractBuilderTest { public RepeatablePropertySequenceUnmarshallingTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { RootWithPropertiesSequenceCollection o = unmarshalObject(RootWithPropertiesSequenceCollection.class); List gs = o.getGroups(); assertNotNull(gs); assertEquals(2, gs.size()); int i = 0; for(PropertiesSequence g : gs) { assertNotNull(g); ++i; assertEquals("a" + i, g.getA()); assertEquals("b" + i, g.getB()); assertEquals("c" + i, g.getC()); } } } ././@LongLink0000000000000000000000000000023200000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/PropertyAllUnmarshallingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000411011156144134033256 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.PropertiesAll; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithPropertiesAll; /** * A PropertyAllUnmarshallingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class PropertyAllUnmarshallingTestCase extends AbstractBuilderTest { /** * Create a new PropertyAllUnmarshallingTestCase. * * @param name */ public PropertyAllUnmarshallingTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { RootWithPropertiesAll o = unmarshalObject(RootWithPropertiesAll.class); PropertiesAll g = o.getGroup(); assertNotNull(g); assertEquals("a", g.getA()); assertEquals("b", g.getB()); assertEquals("c", g.getC()); assertEquals("p", o.getProp()); } } ././@LongLink0000000000000000000000000000024200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RootWithTwoParticleGroupsBindingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000001031311156144134033260 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import java.util.Collection; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithTwoParticleGroups; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A RootWithTwoParticleGroupsBindingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RootWithTwoParticleGroupsBindingTestCase extends AbstractJBossXmlModelGroupTest { /** * Create a new RootWithTwoParticleGroupsBindingTestCase. * * @param name */ public RootWithTwoParticleGroupsBindingTestCase(String name) { super(name); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(RootWithTwoParticleGroups.class); ElementBinding e = schema.getElement(new QName("main-root")); assertNotNull(e); TermBinding t = e.getType().getParticle().getTerm(); assertTrue(t instanceof SequenceBinding || t instanceof UnorderedSequenceBinding); Collection particles = ((ModelGroupBinding)t).getParticles(); assertEquals(2, particles.size()); Iterator i = particles.iterator(); ParticleBinding group1Particle; ParticleBinding group2Particle; if(t instanceof SequenceBinding) { group1Particle = i.next(); group2Particle = i.next(); } else { ParticleBinding p = i.next(); if(((ElementBinding)p.getTerm()).getQName().equals(new QName("group1"))) { group1Particle = p; group2Particle = i.next(); } else { group2Particle = p; group1Particle = i.next(); } } t = group1Particle.getTerm(); assertTrue(t.isElement()); assertEquals(0, group1Particle.getMinOccurs()); assertEquals(1, group1Particle.getMaxOccurs()); assertFalse(group1Particle.getMaxOccursUnbounded()); e = (ElementBinding) t; assertEquals(new QName("group1"), e.getQName()); assertParticleChoiceBinding((ModelGroupBinding) e.getType().getParticle().getTerm()); t = group2Particle.getTerm(); assertTrue(t.isElement()); assertEquals(0, group2Particle.getMinOccurs()); assertEquals(1, group2Particle.getMaxOccurs()); assertFalse(group2Particle.getMaxOccursUnbounded()); e = (ElementBinding) t; assertEquals(new QName("group2"), e.getQName()); assertParticleChoiceBinding((ModelGroupBinding) e.getType().getParticle().getTerm()); } } ././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/PropertyChoiceBindingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000334011156144134033262 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithPropertiesChoice; /** * A PropertyChoiceBindingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class PropertyChoiceBindingTestCase extends AbstractJBossXmlModelGroupTest { /** * Create a new PropertyChoiceBindingTestCase. * * @param name */ public PropertyChoiceBindingTestCase(String name) { super(name); } public void testBinding() throws Exception { assertPropertiesChoiceBinding(RootWithPropertiesChoice.class, false); } } ././@LongLink0000000000000000000000000000023000000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/AbstractJBossXmlModelGroupTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000002164711156144134033274 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.xb.binding.sunday.unmarshalling.AllBinding; import org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A JBossXmlModelGroupUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public abstract class AbstractJBossXmlModelGroupTest extends AbstractBuilderTest { public AbstractJBossXmlModelGroupTest(String name) { super(name); } protected void assertParticleChoiceBinding(ModelGroupBinding s) { Collection particles = s.getParticles(); assertEquals(2, particles.size()); Iterator i = particles.iterator(); ParticleBinding choiceParticle; ParticleBinding elementParticle; if(s instanceof SequenceBinding) { choiceParticle = i.next(); elementParticle = i.next(); } else { ParticleBinding p = i.next(); if(p.getTerm().isModelGroup()) { choiceParticle = p; elementParticle = i.next(); } else { elementParticle = p; choiceParticle = i.next(); } } TermBinding t = choiceParticle.getTerm(); assertTrue(t instanceof ChoiceBinding); assertEquals(1, choiceParticle.getMaxOccurs()); assertFalse(choiceParticle.getMaxOccursUnbounded()); ChoiceBinding c = (ChoiceBinding) t; particles = c.getParticles(); assertEquals(2, particles.size()); Iterator choiceIter = particles.iterator(); t = choiceIter.next().getTerm(); assertTrue(t.isElement()); assertEquals(new QName("a"), ((ElementBinding)t).getQName()); t = choiceIter.next().getTerm(); assertTrue(t.isElement()); assertEquals(new QName("b"), ((ElementBinding)t).getQName()); t = elementParticle.getTerm(); assertTrue(t.isElement()); assertEquals(new QName("e"), ((ElementBinding)t).getQName()); } protected void assertPropertiesSequenceBinding(Class root, boolean inCollection) { SchemaBinding schema = JBossXBBuilder.build(root); ElementBinding e = schema.getElement(new QName("root")); assertNotNull(e); TermBinding t = e.getType().getParticle().getTerm(); assertTrue(t instanceof SequenceBinding || t instanceof UnorderedSequenceBinding); ModelGroupBinding s = (ModelGroupBinding) t; assertPropertiesSequenceBinding(s, inCollection); } protected void assertPropertiesSequenceBinding(ModelGroupBinding s, boolean inCollection) { Collection particles = s.getParticles(); assertEquals(1, particles.size()); ParticleBinding p = particles.iterator().next(); if(p.getTerm() instanceof SequenceBinding) assertABCGroupParticle(p, true, inCollection); else assertABCGroupParticle(p, false, inCollection); } protected void assertPropertiesChoiceBinding(Class root, boolean inCollection) { SchemaBinding schema = JBossXBBuilder.build(root); ElementBinding e = schema.getElement(new QName("root")); assertNotNull(e); TermBinding t = e.getType().getParticle().getTerm(); assertTrue(t instanceof SequenceBinding || t instanceof UnorderedSequenceBinding); ModelGroupBinding s = (ModelGroupBinding) t; Collection particles = s.getParticles(); assertEquals(1, particles.size()); ParticleBinding p = particles.iterator().next(); t = p.getTerm(); assertTrue(t instanceof ChoiceBinding); //assertEquals(0, p.getMinOccurs()); assertEquals(1, p.getMaxOccurs()); assertEquals(inCollection, p.getMaxOccursUnbounded()); ChoiceBinding c = (ChoiceBinding) t; particles = c.getParticles(); assertEquals(3, particles.size()); Set set = new HashSet(); set.add(new QName("c")); set.add(new QName("b")); set.add(new QName("a")); for(ParticleBinding cp : particles) { t = cp.getTerm(); assertTrue(t.isElement()); assertTrue(set.contains(((ElementBinding) t).getQName())); } } protected void assertPropertiesAllBinding(Class root, boolean inCollection) { SchemaBinding schema = JBossXBBuilder.build(root); ElementBinding e = schema.getElement(new QName("root")); assertNotNull(e); TermBinding t = e.getType().getParticle().getTerm(); assertTrue(t instanceof SequenceBinding || t instanceof UnorderedSequenceBinding); ModelGroupBinding s = (ModelGroupBinding) t; Collection particles = s.getParticles(); assertEquals(2, particles.size()); Iterator i = particles.iterator(); ParticleBinding groupParticle = null; ParticleBinding elementParticle = null; if(s instanceof SequenceBinding) { groupParticle = i.next(); elementParticle = i.next(); } else { groupParticle = i.next(); if(groupParticle.getTerm().isElement()) { elementParticle = groupParticle; groupParticle = i.next(); } else elementParticle = i.next(); } assertTrue(groupParticle.getTerm() instanceof AllBinding); assertABCGroupParticle(groupParticle, false, inCollection); t = elementParticle.getTerm(); assertTrue(t.isElement()); assertEquals(0, elementParticle.getMinOccurs()); assertEquals(1, elementParticle.getMaxOccurs()); assertFalse(elementParticle.getMaxOccursUnbounded()); assertEquals(new QName("prop"), ((ElementBinding)t).getQName()); } protected void assertABCGroupParticle(ParticleBinding p, boolean ordered, boolean inCollection) { Collection particles; assertEquals(1, p.getMaxOccurs()); assertEquals(inCollection, p.getMaxOccursUnbounded()); ModelGroupBinding group = (ModelGroupBinding) p.getTerm(); particles = group.getParticles(); assertEquals(3, particles.size()); if (ordered) { Iterator i = particles.iterator(); TermBinding t = i.next().getTerm(); assertTrue(t.isElement()); assertEquals(new QName("c"), ((ElementBinding) t).getQName()); t = i.next().getTerm(); assertTrue(t.isElement()); assertEquals(new QName("b"), ((ElementBinding) t).getQName()); t = i.next().getTerm(); assertTrue(t.isElement()); assertEquals(new QName("a"), ((ElementBinding) t).getQName()); } else { Set set = new HashSet(); set.add(new QName("c")); set.add(new QName("b")); set.add(new QName("a")); for (ParticleBinding cp : particles) { TermBinding t = cp.getTerm(); assertTrue(t.isElement()); assertTrue(set.contains(((ElementBinding) t).getQName())); } } } } ././@LongLink0000000000000000000000000000024100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatableParticleChoiceBindingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000001037011156144134033263 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import java.util.Collection; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithParticlesChoiceCollection; import org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A RepeatableParticleChoiceBindingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RepeatableParticleChoiceBindingTestCase extends AbstractJBossXmlModelGroupTest { /** * Create a new RepeatableParticleChoiceBindingTestCase. * * @param name */ public RepeatableParticleChoiceBindingTestCase(String name) { super(name); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(RootWithParticlesChoiceCollection.class); ElementBinding e = schema.getElement(new QName("root")); assertNotNull(e); TermBinding t = e.getType().getParticle().getTerm(); assertTrue(t instanceof SequenceBinding || t instanceof UnorderedSequenceBinding); ModelGroupBinding s = (ModelGroupBinding) t; Collection particles = s.getParticles(); assertEquals(2, particles.size()); Iterator i = particles.iterator(); ParticleBinding choiceParticle; ParticleBinding elementParticle; if(t instanceof SequenceBinding) { choiceParticle = i.next(); elementParticle = i.next(); } else { ParticleBinding p = i.next(); if (p.getTerm().isElement()) { elementParticle = p; choiceParticle = i.next(); } else { choiceParticle = p; elementParticle = i.next(); } } t = choiceParticle.getTerm(); assertTrue(t instanceof ChoiceBinding); assertEquals(1, choiceParticle.getMaxOccurs()); assertTrue(choiceParticle.getMaxOccursUnbounded()); ChoiceBinding c = (ChoiceBinding) t; particles = c.getParticles(); assertEquals(2, particles.size()); Iterator choiceIter = particles.iterator(); t = choiceIter.next().getTerm(); assertTrue(t.isElement()); assertEquals(new QName("a"), ((ElementBinding)t).getQName()); t = choiceIter.next().getTerm(); assertTrue(t.isElement()); assertEquals(new QName("b"), ((ElementBinding)t).getQName()); t = elementParticle.getTerm(); assertTrue(t.isElement()); assertEquals(new QName("e"), ((ElementBinding)t).getQName()); } } ././@LongLink0000000000000000000000000000024300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatablePropertySequenceBindingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000345111156144134033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithPropertiesSequenceCollection; /** * A RepeatablePropertySequenceBindingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RepeatablePropertySequenceBindingTestCase extends AbstractJBossXmlModelGroupTest { /** * Create a new RepeatablePropertySequenceBindingTestCase. * * @param name */ public RepeatablePropertySequenceBindingTestCase(String name) { super(name); } public void testBinding() throws Exception { assertPropertiesSequenceBinding(RootWithPropertiesSequenceCollection.class, true); } } ././@LongLink0000000000000000000000000000023600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/RepeatablePropertyAllBindingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000324111156144134033262 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithPropertiesAllCollection; /** * A RepeatablePropertyAllBindingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RepeatablePropertyAllBindingTestCase extends AbstractJBossXmlModelGroupTest { public RepeatablePropertyAllBindingTestCase(String name) { super(name); } public void testBinding() throws Exception { assertPropertiesAllBinding(RootWithPropertiesAllCollection.class, true); } } ././@LongLink0000000000000000000000000000023500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/test/PropertyChoiceUnmarshallingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000371511156144340033267 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.PropertiesChoice; import org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support.RootWithPropertiesChoice; /** * A PropertyChoiceUnmarshallingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class PropertyChoiceUnmarshallingTestCase extends AbstractBuilderTest { public PropertyChoiceUnmarshallingTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { RootWithPropertiesChoice o = unmarshalObject(RootWithPropertiesChoice.class); PropertiesChoice g = o.getGroup(); assertNotNull(g); assertNull(g.getA()); assertNull(g.getB()); assertEquals("c", g.getC()); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000755000175000017500000000000011620316745033265 5ustar twernertwerner././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/RootWithPropertiesSequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000306711145311353033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import javax.xml.bind.annotation.XmlRootElement; /** * A RootWithPropertiesSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") public class RootWithPropertiesSequence { private PropertiesSequence group; public PropertiesSequence getGroup() { return group; } public void setGroup(PropertiesSequence group) { this.group = group; } } ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/RootWithPropertiesChoice.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000305711145311353033264 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import javax.xml.bind.annotation.XmlRootElement; /** * A RootWithPropertiesSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") public class RootWithPropertiesChoice { private PropertiesChoice group; public PropertiesChoice getGroup() { return group; } public void setGroup(PropertiesChoice group) { this.group = group; } } ././@LongLink0000000000000000000000000000024100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/RootWithPropertiesSequenceCollection.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000317611145311353033266 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import java.util.List; import javax.xml.bind.annotation.XmlRootElement; /** * A RootWithPropertiesSequenceCollection. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") public class RootWithPropertiesSequenceCollection { private List groups; public List getGroups() { return groups; } public void setGroups(List groups) { this.groups = groups; } } ././@LongLink0000000000000000000000000000022200000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/RootWithPropertiesAll.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000343611146546505033277 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A RootWithPropertiesSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"group", "prop"}) public class RootWithPropertiesAll { private PropertiesAll group; private String prop; public PropertiesAll getGroup() { return group; } public void setGroup(PropertiesAll group) { this.group = group; } public String getProp() { return prop; } public void setProp(String prop) { this.prop = prop; } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/AbstractChoice.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000367411145311353033271 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlValue; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; /** * A AbstractChoiceItem. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlModelGroup ( name="ab", kind=JBossXmlConstants.MODEL_GROUP_CHOICE, particles={ @JBossXmlModelGroup.Particle(element=@XmlElement(name="a"), type = ChoiceA.class), @JBossXmlModelGroup.Particle(element=@XmlElement(name="b"), type = ChoiceB.class) } ) public class AbstractChoice { private String value; @XmlValue public String getValue() { return value; } public void setValue(String value) { this.value = value; } } ././@LongLink0000000000000000000000000000023400000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/RootWithPropertiesAllCollection.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000354611146546505033301 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import java.util.List; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A RootWithPropertiesSequenceCollection. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"groups", "prop"}) public class RootWithPropertiesAllCollection { private List groups; private String prop; public List getGroups() { return groups; } public void setGroups(List groups) { this.groups = groups; } public String getProp() { return prop; } public void setProp(String prop) { this.prop = prop; } } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/PropertiesSequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000362011145311353033260 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; /** * A PropertiesSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlModelGroup(name="ps", kind=JBossXmlConstants.MODEL_GROUP_SEQUENCE, propOrder={"c", "b", "a"}) public class PropertiesSequence { private String a; private String b; private String c; public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } public String getC() { return c; } public void setC(String c) { this.c = c; } } ././@LongLink0000000000000000000000000000022600000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/RootWithTwoPropertyGroups.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000465311147002623033266 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A ReusedPropertiesGroup. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="main-root") @XmlType(propOrder={"group1", "group2"}) public class RootWithTwoPropertyGroups { private GroupWrapper1 group1; private GroupWrapper2 group2; public GroupWrapper1 getGroup1() { return this.group1; } public void setGroup1(GroupWrapper1 group1) { this.group1 = group1; } public GroupWrapper2 getGroup2() { return this.group2; } public void setGroup2(GroupWrapper2 group2) { this.group2 = group2; } public static class GroupWrapper1 { private PropertiesSequence group; public PropertiesSequence getGroup() { return group; } public void setGroup(PropertiesSequence group) { this.group = group; } } public static class GroupWrapper2 { private PropertiesSequence group; public PropertiesSequence getGroup() { return group; } public void setGroup(PropertiesSequence group) { this.group = group; } } } ././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/ChoiceCollectionXmlType.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000421211146302240033252 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import java.util.ArrayList; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; /** * A ChoiceCollection. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @SuppressWarnings("serial") @XmlType public class ChoiceCollectionXmlType extends ArrayList { private String a; private String e; private String value; @XmlAttribute public String getA() { return a; } public void setA(String a) { this.a = a; } public String getE() { return e; } public void setE(String e) { this.e = e; } @XmlValue public String getValue() { return value; } public void setValue(String value) { this.value = value; } @Override @XmlTransient public boolean isEmpty() { return super.isEmpty(); } } ././@LongLink0000000000000000000000000000023400000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/RootWithChoiceCollectionXmlType.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000326011146302240033254 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlSchema; /** * A RootWithChoiceCollection. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @JBossXmlSchema(normalizeSpace=true) public class RootWithChoiceCollectionXmlType { private ChoiceCollectionXmlType choices; public ChoiceCollectionXmlType getChoices() { return choices; } public void setChoices(ChoiceCollectionXmlType choices) { this.choices = choices; } } ././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/RootWithParticlesChoice.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000342011145311353033256 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A RootWithParticlesChoice. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"choice", "e"}) public class RootWithParticlesChoice { private AbstractChoice choice; private String e; public AbstractChoice getChoice() { return choice; } public void setChoice(AbstractChoice choice) { this.choice = choice; } public String getE() { return e; } public void setE(String e) { this.e = e; } } ././@LongLink0000000000000000000000000000023700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/RootWithPropertiesChoiceCollection.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000316611145311353033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import java.util.List; import javax.xml.bind.annotation.XmlRootElement; /** * A RootWithPropertiesSequenceCollection. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") public class RootWithPropertiesChoiceCollection { private List groups; public List getGroups() { return groups; } public void setGroups(List groups) { this.groups = groups; } } ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/PropertiesAll.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000355311145311353033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; /** * A PropertiesSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlModelGroup(name="pa", kind=JBossXmlConstants.MODEL_GROUP_ALL) public class PropertiesAll { private String a; private String b; private String c; public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } public String getC() { return c; } public void setC(String c) { this.c = c; } } ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/PropertiesChoice.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000356111145311353033264 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; /** * A PropertiesSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlModelGroup(name="pc", kind=JBossXmlConstants.MODEL_GROUP_CHOICE) public class PropertiesChoice { private String a; private String b; private String c; public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } public String getC() { return c; } public void setC(String c) { this.c = c; } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/ChoiceA.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000240211145311353033255 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; /** * A ChoiceA. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ChoiceA extends AbstractChoice { } ././@LongLink0000000000000000000000000000023600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/RootWithParticlesChoiceCollection.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000351611145311353033264 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import java.util.List; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A RootWithParticlesChoice. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"choices", "e"}) public class RootWithParticlesChoiceCollection { private List choices; private String e; public List getChoices() { return choices; } public void setChoices(List choices) { this.choices = choices; } public String getE() { return e; } public void setE(String e) { this.e = e; } } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/ChoiceB.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000240211145311353033255 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; /** * A ChoiceA. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ChoiceB extends AbstractChoice { } ././@LongLink0000000000000000000000000000022600000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxmlmodelgroup/support/RootWithTwoParticleGroups.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/jbossxml0000644000175000017500000000537711171577572033313 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.jbossxmlmodelgroup.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A ReusedPropertiesGroup. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="main-root") @XmlType(propOrder={"group1", "group2"}) public class RootWithTwoParticleGroups { private GroupWrapper1 group1; private GroupWrapper2 group2; public GroupWrapper1 getGroup1() { return this.group1; } public void setGroup1(GroupWrapper1 group1) { this.group1 = group1; } public GroupWrapper2 getGroup2() { return this.group2; } public void setGroup2(GroupWrapper2 group2) { this.group2 = group2; } @XmlType(propOrder={"group", "e"}) public static class GroupWrapper1 { private AbstractChoice group; public AbstractChoice getGroup() { return group; } public void setGroup(AbstractChoice group) { this.group = group; } public String getE() { return ""; } public void setE(String e) { } } @XmlType(propOrder={"group", "e"}) public static class GroupWrapper2 { private AbstractChoice group; public AbstractChoice getGroup() { return group; } public void setGroup(AbstractChoice group) { this.group = group; } public String getE() { return ""; } public void setE(String e) { } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000755000175000017500000000000011620316747033224 5ustar twernertwerner././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000755000175000017500000000000011620316747033224 5ustar twernertwerner././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/test/ComponentTypeUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000644000175000017500000000472311135125034033220 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection.test; import java.util.List; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.collection.support.RootSomeInterface; import org.jboss.test.xb.builder.object.type.collection.support.SomeInterface; import org.jboss.xb.binding.JBossXBException; /** * ComponentTypeUnitTestCase * * @author Ales Justin */ public class ComponentTypeUnitTestCase extends AbstractBuilderTest { public ComponentTypeUnitTestCase(String name) { super(name); } public static Test suite() { return suite(ComponentTypeUnitTestCase.class); } public void testPass() throws Exception { RootSomeInterface root = unmarshalObject(RootSomeInterface.class); List list = root.getIface(); assertNotNull(list); assertEquals(3, list.size()); } @SuppressWarnings({"ThrowableResultOfMethodCallIgnored"}) public void testFailure() throws Throwable { try { unmarshalObject(RootSomeInterface.class); fail("Should not be here."); } catch (Throwable t) { if (t instanceof RuntimeException || t instanceof JBossXBException) t = t.getCause(); IllegalArgumentException iae = assertInstanceOf(t, IllegalArgumentException.class); assertTrue(iae.getMessage().startsWith("Child is not an instance of")); } } }././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/test/ArrayUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000644000175000017500000000575211144523074033231 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.collection.support.RootArray; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * ArrayUnitTestCase * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ArrayUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(ArrayUnitTestCase.class); } public ArrayUnitTestCase(String name) { super(name); } @SuppressWarnings("unchecked") public void testUnmarshal() throws Exception { RootArray result = unmarshalObject(RootArray.class); String[] array = result.getArray(); assertNotNull(array); assertEquals(new String[] { "ONE", "TWO", "THREE" }, array); } public void testSimpleBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(RootArray.class); assertNotNull(schemaBinding); QName elementName = new QName(XMLConstants.NULL_NS_URI, "root-array"); ElementBinding elementBinding = schemaBinding.getElement(elementName); assertNotNull(elementBinding); // TODO //ModelGroupBinding group = (ModelGroupBinding) elementBinding.getType().getParticle().getTerm(); //assertRepeatableElementBinding(group); } protected void assertRepeatableElementBinding(ModelGroupBinding group) { assertEquals(1, group.getParticles().size()); ParticleBinding p = group.getParticles().iterator().next(); assertTrue(p.getTerm().isElement()); assertTrue(p.getMaxOccursUnbounded()); } } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/test/ArrayListUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000644000175000017500000000305310562616254033227 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.type.collection.support.RootArrayList; /** * ArrayListUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @SuppressWarnings("unchecked") public class ArrayListUnitTestCase extends AbstractCollectionTest { public static Test suite() { return suite(ArrayListUnitTestCase.class); } public ArrayListUnitTestCase(String name) { super(name, RootArrayList.class); } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/test/HashSetUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000644000175000017500000000303710562616254033231 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.type.collection.support.RootHashSet; /** * HashSetUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @SuppressWarnings("unchecked") public class HashSetUnitTestCase extends AbstractCollectionTest { public static Test suite() { return suite(HashSetUnitTestCase.class); } public HashSetUnitTestCase(String name) { super(name, RootHashSet.class); } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/test/AbstractCollectionTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000644000175000017500000000653111144523074033225 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection.test; import java.util.ArrayList; import java.util.Collection; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.collection.support.Root; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * AbstractCollectionTest * * @param the test class * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractCollectionTest>> extends AbstractBuilderTest { /** The root class */ private Class root; /** The expected value */ private ArrayList expected; public AbstractCollectionTest(String name, Class root) { super(name); this.root = root; this.expected = new ArrayList(); expected.add("ONE"); expected.add("TWO"); expected.add("THREE"); } @SuppressWarnings("unchecked") public void testUnmarshal() throws Exception { T result = unmarshalObject(root); Collection collection = result.getCollection(); Collection actual = new ArrayList(collection); assertEquals(expected, actual); } public void testSimpleBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(root); assertNotNull(schemaBinding); QName elementName = new QName(XMLConstants.NULL_NS_URI, JBossXBBuilder.generateXMLNameFromJavaName(root.getSimpleName(), true, true)); ElementBinding elementBinding = schemaBinding.getElement(elementName); assertNotNull(elementBinding); ModelGroupBinding group = (ModelGroupBinding) elementBinding.getType().getParticle().getTerm(); assertRepeatableElementBinding(group); } protected void assertRepeatableElementBinding(ModelGroupBinding group) { assertEquals(1, group.getParticles().size()); ParticleBinding p = group.getParticles().iterator().next(); assertTrue(p.getMaxOccursUnbounded()); assertTrue(p.getTerm().isElement()); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000755000175000017500000000000011620316747033224 5ustar twernertwerner././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/WrongImpl.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000644000175000017500000000222211113542347033216 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection.support; /** * SomeImpl. * * @author Ales Justin */ public class WrongImpl { }././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/SomeImpl.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000644000175000017500000000225211113542347033221 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection.support; /** * SomeImpl. * * @author Ales Justin */ public class SomeImpl implements SomeInterface { }././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000644000175000017500000000270310562616254033230 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection.support; import java.util.Collection; /** * SimpleObjectWildcard. * * @param the expected type * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Root> { private T collection; public T getCollection() { return collection; } public void setCollection(T collection) { this.collection = collection; } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/RootArrayList.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000644000175000017500000000272410562616254033233 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection.support; import java.util.ArrayList; /** * RootArrayList. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class RootArrayList extends Root> { @Override public ArrayList getCollection() { return super.getCollection(); } @Override public void setCollection(ArrayList collection) { super.setCollection(collection); } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/SomeInterface.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000644000175000017500000000223711113542347033224 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection.support; /** * SomeInterface. * * @author Ales Justin */ public interface SomeInterface { }././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/RootHashSet.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000644000175000017500000000274010562616254033231 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection.support; import java.util.LinkedHashSet; /** * RootHashSet. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class RootHashSet extends Root> { @Override public LinkedHashSet getCollection() { return super.getCollection(); } @Override public void setCollection(LinkedHashSet collection) { super.setCollection(collection); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/RootArray.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000644000175000017500000000253610562616254033234 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection.support; /** * SimpleObjectWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class RootArray { private String[] array; public String[] getArray() { return array; } public void setArray(String[] array) { this.array = array; } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/support/RootSomeInterface.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000644000175000017500000000324511113542347033224 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection.support; import java.util.List; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; /** * RootSomeInterface. * * @author Ales Justin */ public class RootSomeInterface { private List iface; public List getIface() { return iface; } @XmlElements ({ @XmlElement(name="iface", type=SomeImpl.class), @XmlElement(name="impl", type=WrongImpl.class) }) @XmlAnyElement public void setIface(List iface) { this.iface = iface; } }././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collection/ObjectTypeCollectionTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/collecti0000755000175000017500000000413611113542347033227 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.collection; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.type.collection.test.ArrayListUnitTestCase; import org.jboss.test.xb.builder.object.type.collection.test.ArrayUnitTestCase; import org.jboss.test.xb.builder.object.type.collection.test.HashSetUnitTestCase; import org.jboss.test.xb.builder.object.type.collection.test.ComponentTypeUnitTestCase; /** * ObjectTypeCollectionTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectTypeCollectionTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object Type Collection Tests"); suite.addTest(ArrayListUnitTestCase.suite()); suite.addTest(HashSetUnitTestCase.suite()); suite.addTest(ArrayUnitTestCase.suite()); suite.addTest(ComponentTypeUnitTestCase.suite()); // TODO lots of other tests return suite; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/ObjectTypeTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/ObjectTy0000755000175000017500000000524511135322051033146 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.type.accessor.ObjectTypeAccessorTestSuite; import org.jboss.test.xb.builder.object.type.collection.ObjectTypeCollectionTestSuite; import org.jboss.test.xb.builder.object.type.simple.ObjectTypeSimpleTestSuite; import org.jboss.test.xb.builder.object.type.value.ObjectTypeValueTestSuite; import org.jboss.test.xb.builder.object.type.xmlanyelement.ObjectTypeXmlAnyElementTestSuite; import org.jboss.test.xb.builder.object.type.xmlenum.ObjectTypeXmlEnumTestSuite; import org.jboss.test.xb.builder.object.type.xmltransient.ObjectTypeXmlTransientTestSuite; import org.jboss.test.xb.builder.object.type.xmltype.ObjectTypeXmlTypeTestSuite; /** * ObjectTypeXmlTypeTestSuite. * * @author Adrian Brock * @author Ales Justin * @version $Revision: 1.1 $ */ public class ObjectTypeTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object Type Tests"); suite.addTest(ObjectTypeXmlTypeTestSuite.suite()); suite.addTest(ObjectTypeXmlEnumTestSuite.suite()); suite.addTest(ObjectTypeSimpleTestSuite.suite()); suite.addTest(ObjectTypeCollectionTestSuite.suite()); suite.addTest(ObjectTypeValueTestSuite.suite()); suite.addTest(ObjectTypeXmlAnyElementTestSuite.suite()); suite.addTest(ObjectTypeXmlTransientTestSuite.suite()); suite.addTest(ObjectTypeAccessorTestSuite.suite()); return suite; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000755000175000017500000000000011620316746033256 5ustar twernertwerner././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000755000175000017500000000000011620316746033256 5ustar twernertwerner././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ListObjectWildcardUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000764411336746232033274 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.test; import java.util.List; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.AnotherJavaBean; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.ListObjectWildcard; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.SimpleJavaBean; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.CollectionPropertyWildcardHandler; /** * ListObjectWildcardUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ListObjectWildcardUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(ListObjectWildcardUnitTestCase.class); } public ListObjectWildcardUnitTestCase(String name) { super(name); } public void testUnmarshalWildcard() throws Exception { ListObjectWildcard result = unmarshalObject(ListObjectWildcard.class, ListObjectWildcard.class, SimpleJavaBean.class, AnotherJavaBean.class); List wildcard = result.getWildcard(); assertNotNull(wildcard); assertEquals(2, wildcard.size()); assertTrue(wildcard.get(0) instanceof SimpleJavaBean); assertTrue(wildcard.get(1) instanceof AnotherJavaBean); } public void testWildcardBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(ListObjectWildcard.class); assertNotNull(schemaBinding); QName qName = new QName(XMLConstants.NULL_NS_URI, "list-object-wildcard"); ElementBinding element = schemaBinding.getElement(qName); assertNotNull(element); TypeBinding type = element.getType(); assertNotNull(type); ParticleBinding particle = type.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); term = assertSingleRepeatableSequence(term); assertTrue(term instanceof WildcardBinding); WildcardBinding wildcardBinding = type.getWildcard(); assertNotNull(wildcardBinding); assertTrue(term == wildcardBinding); assertTrue(wildcardBinding.isProcessContentsStrict()); ParticleHandler particleHandler = wildcardBinding.getWildcardHandler(); assertNotNull(particleHandler); //assertTrue(particleHandler instanceof CollectionPropertyWildcardHandler); } } ././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ListElementWildcardUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000771311336746232033271 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.test; import java.util.List; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.ListElementWildcard; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.CollectionPropertyWildcardHandler; import org.jboss.xb.builder.runtime.DOMHandler; import org.w3c.dom.Element; /** * ListElementWildcardUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ListElementWildcardUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(ListElementWildcardUnitTestCase.class); } public ListElementWildcardUnitTestCase(String name) { super(name); } public void testUnmarshalWildcard() throws Exception { ListElementWildcard result = unmarshalObject(ListElementWildcard.class); List wildcard = result.getWildcard(); assertNotNull(wildcard); assertEquals(2, wildcard.size()); assertEquals("test-element-1", wildcard.get(0).getNodeName()); assertEquals("test-element-2", wildcard.get(1).getNodeName()); } public void testWildcardBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(ListElementWildcard.class); assertNotNull(schemaBinding); QName qName = new QName(XMLConstants.NULL_NS_URI, "list-element-wildcard"); ElementBinding element = schemaBinding.getElement(qName); assertNotNull(element); TypeBinding type = element.getType(); assertNotNull(type); ParticleBinding particle = type.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); term = assertSingleRepeatableSequence(term); assertTrue(term instanceof WildcardBinding); WildcardBinding wildcardBinding = type.getWildcard(); assertNotNull(wildcardBinding); assertTrue(term == wildcardBinding); assertTrue(wildcardBinding.isProcessContentsLax()); assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedCharactersHandler()); assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedElementHandler()); ParticleHandler particleHandler = wildcardBinding.getWildcardHandler(); assertNotNull(particleHandler); //assertTrue(particleHandler instanceof CollectionPropertyWildcardHandler); } } ././@LongLink0000000000000000000000000000023400000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/NotAnnotatedElementWildcardUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000001056411153522526033262 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.test; import java.util.Collection; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.NotAnnotatedElementWildcard; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.DOMHandler; import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** * ElementWildcardUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NotAnnotatedElementWildcardUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(NotAnnotatedElementWildcardUnitTestCase.class); } public NotAnnotatedElementWildcardUnitTestCase(String name) { super(name); } public void testUnmarshalWildcard() throws Exception { NotAnnotatedElementWildcard result = unmarshalObject(NotAnnotatedElementWildcard.class); Element element = result.getElement(); assertNotNull(element); assertEquals("element", element.getNodeName()); NodeList childNodes = element.getChildNodes(); assertNotNull(childNodes); assertEquals(1, childNodes.getLength()); element = (Element) childNodes.item(0); assertEquals("test-child-element", element.getNodeName()); } public void testWildcardBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(NotAnnotatedElementWildcard.class); assertNotNull(schemaBinding); QName qName = new QName(XMLConstants.NULL_NS_URI, "not-annotated-element-wildcard"); ElementBinding element = schemaBinding.getElement(qName); assertNotNull(element); TypeBinding type = element.getType(); assertNotNull(type); ParticleBinding particle = type.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); term = assertSingleSequence(term); assertTrue(term.isElement()); element = (ElementBinding) term; assertEquals(new QName("element"), element.getQName()); term = element.getType().getParticle().getTerm(); assertTrue(term instanceof SequenceBinding); Collection particles = ((SequenceBinding)term).getParticles(); assertEquals(1, particles.size()); particle = particles.iterator().next(); term = particle.getTerm(); assertTrue(term instanceof WildcardBinding); type = element.getType(); WildcardBinding wildcardBinding = type.getWildcard(); assertNotNull(wildcardBinding); assertTrue(term == wildcardBinding); assertTrue(wildcardBinding.isProcessContentsSkip()); assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedCharactersHandler()); assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedElementHandler()); } } ././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ArrayObjectWildcardUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000756411277234404033272 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.AnotherJavaBean; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.ArrayObjectWildcard; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.SimpleJavaBean; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.PropertyWildcardHandler; /** * ArrayObjectWildcardUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ArrayObjectWildcardUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(ArrayObjectWildcardUnitTestCase.class); } public ArrayObjectWildcardUnitTestCase(String name) { super(name); } public void testUnmarshalWildcard() throws Exception { ArrayObjectWildcard result = unmarshalObject(ArrayObjectWildcard.class, ArrayObjectWildcard.class, SimpleJavaBean.class, AnotherJavaBean.class); Object[] wildcard = result.getWildcard(); assertNotNull(wildcard); assertEquals(2, wildcard.length); assertTrue(wildcard[0] instanceof SimpleJavaBean); assertTrue(wildcard[1] instanceof AnotherJavaBean); } public void testWildcardBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(ArrayObjectWildcard.class); assertNotNull(schemaBinding); QName qName = new QName(XMLConstants.NULL_NS_URI, "array-object-wildcard"); ElementBinding element = schemaBinding.getElement(qName); assertNotNull(element); TypeBinding type = element.getType(); assertNotNull(type); ParticleBinding particle = type.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); term = assertSingleRepeatableSequence(term); assertTrue(term instanceof WildcardBinding); WildcardBinding wildcardBinding = type.getWildcard(); assertNotNull(wildcardBinding); assertTrue(term == wildcardBinding); assertTrue(wildcardBinding.isProcessContentsStrict()); ParticleHandler particleHandler = wildcardBinding.getWildcardHandler(); assertNotNull(particleHandler); assertTrue(particleHandler instanceof PropertyWildcardHandler); } } ././@LongLink0000000000000000000000000000023400000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/XmlElementsAndXmlAnyElementUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000521311350647605033262 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.test; import java.util.List; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.XmlElementsAndXmlAnyElement; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.XmlElementsAndXmlAnyElementArray; /** * A XmlElementsAndXmlAnyElementUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class XmlElementsAndXmlAnyElementUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(XmlElementsAndXmlAnyElementUnitTestCase.class); } public XmlElementsAndXmlAnyElementUnitTestCase(String name) { super(name); } public void testList() throws Exception { XmlElementsAndXmlAnyElement o = unmarshalObject(XmlElementsAndXmlAnyElement.class); List list = o.getList(); assertNotNull(list); assertEquals(3, list.size()); assertEquals(11, list.get(0)); assertEquals("22", list.get(1)); assertTrue(list.get(2) instanceof XmlElementsAndXmlAnyElement); } public void testArray() throws Exception { XmlElementsAndXmlAnyElementArray o = unmarshalObject(XmlElementsAndXmlAnyElementArray.class); Object[] array = o.getArray(); assertNotNull(array); assertEquals(3, array.length); assertEquals(11, array[0]); assertEquals("22", array[1]); assertTrue(array[2] instanceof XmlElementsAndXmlAnyElementArray); } } ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ArrayElementWildcardUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000763211277234404033266 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.ArrayElementWildcard; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.DOMHandler; import org.jboss.xb.builder.runtime.PropertyWildcardHandler; import org.w3c.dom.Element; /** * ArrayElementWildcardUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ArrayElementWildcardUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(ArrayElementWildcardUnitTestCase.class); } public ArrayElementWildcardUnitTestCase(String name) { super(name); } public void testUnmarshalWildcard() throws Exception { ArrayElementWildcard result = unmarshalObject(ArrayElementWildcard.class); Element[] wildcard = result.getWildcard(); assertNotNull(wildcard); assertEquals(2, wildcard.length); assertEquals("test-element-1", wildcard[0].getNodeName()); assertEquals("test-element-2", wildcard[1].getNodeName()); } public void testWildcardBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(ArrayElementWildcard.class); assertNotNull(schemaBinding); QName qName = new QName(XMLConstants.NULL_NS_URI, "array-element-wildcard"); ElementBinding element = schemaBinding.getElement(qName); assertNotNull(element); TypeBinding type = element.getType(); assertNotNull(type); ParticleBinding particle = type.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); term = assertSingleRepeatableSequence(term); assertTrue(term instanceof WildcardBinding); WildcardBinding wildcardBinding = type.getWildcard(); assertNotNull(wildcardBinding); assertTrue(term == wildcardBinding); assertTrue(wildcardBinding.isProcessContentsLax()); assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedCharactersHandler()); assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedElementHandler()); ParticleHandler particleHandler = wildcardBinding.getWildcardHandler(); assertNotNull(particleHandler); assertTrue(particleHandler instanceof PropertyWildcardHandler); } } ././@LongLink0000000000000000000000000000022000000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementWildcardUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000001105211153522526033253 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.ElementWildcard; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.DOMHandler; import org.jboss.xb.builder.runtime.PropertyWildcardHandler; import org.w3c.dom.Element; /** * ElementWildcardUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ElementWildcardUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(ElementWildcardUnitTestCase.class); } public ElementWildcardUnitTestCase(String name) { super(name); } public void testUnmarshalWildcard() throws Exception { ElementWildcard result = unmarshalObject(ElementWildcard.class); Element element = result.getWildcard(); assertNotNull(element); assertEquals("test-element", element.getNodeName()); } public void testWildcardBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(ElementWildcard.class); assertNotNull(schemaBinding); QName qName = new QName(XMLConstants.NULL_NS_URI, "element-wildcard"); ElementBinding element = schemaBinding.getElement(qName); assertNotNull(element); TypeBinding type = element.getType(); assertNotNull(type); ParticleBinding particle = type.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); term = assertSingleSequence(term); assertTrue(term instanceof WildcardBinding); WildcardBinding wildcardBinding = type.getWildcard(); assertNotNull(wildcardBinding); assertTrue(term == wildcardBinding); assertTrue(wildcardBinding.isProcessContentsLax()); assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedCharactersHandler()); assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedElementHandler()); ParticleHandler particleHandler = wildcardBinding.getWildcardHandler(); assertNotNull(particleHandler); assertTrue(particleHandler instanceof PropertyWildcardHandler); } public void testUnmarshalWildcardInUnroderedSequence() throws Exception { boolean useUnorderedSequence = JBossXBBuilder.isUseUnorderedSequence(); JBossXBBuilder.setUseUnorderedSequence(true); try { SchemaBinding schema = JBossXBBuilder.build(ElementWildcard.class, true); Object o = unmarshal(getRootName() + ".xml", schema); assertNotNull(o); assertTrue(o instanceof ElementWildcard); ElementWildcard ew = (ElementWildcard) o; Element element = ew.getWildcard(); assertNotNull(element); assertEquals("test-element", element.getNodeName()); } finally { JBossXBBuilder.setUseUnorderedSequence(useUnorderedSequence); } } } ././@LongLink0000000000000000000000000000022500000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/SimpleObjectWildcardUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000733611153522526033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.SimpleJavaBean; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.SimpleObjectWildcard; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.PropertyWildcardHandler; /** * SimpleObjectWildcardUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class SimpleObjectWildcardUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(SimpleObjectWildcardUnitTestCase.class); } public SimpleObjectWildcardUnitTestCase(String name) { super(name); } public void testUnmarshalWildcard() throws Exception { SimpleObjectWildcard result = unmarshalObject(SimpleObjectWildcard.class, SimpleObjectWildcard.class, SimpleJavaBean.class); Object object = result.getWildcard(); assertNotNull(object); assertTrue(object instanceof SimpleJavaBean); } public void testWildcardBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(SimpleObjectWildcard.class); assertNotNull(schemaBinding); QName qName = new QName(XMLConstants.NULL_NS_URI, "simple-object-wildcard"); ElementBinding element = schemaBinding.getElement(qName); assertNotNull(element); TypeBinding type = element.getType(); assertNotNull(type); ParticleBinding particle = type.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); term = assertSingleSequence(term); assertTrue(term instanceof WildcardBinding); WildcardBinding wildcardBinding = type.getWildcard(); assertNotNull(wildcardBinding); assertTrue(term == wildcardBinding); assertTrue(wildcardBinding.isProcessContentsStrict()); ParticleHandler particleHandler = wildcardBinding.getWildcardHandler(); assertNotNull(particleHandler); assertTrue(particleHandler instanceof PropertyWildcardHandler); } } ././@LongLink0000000000000000000000000000024600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementWildcardWithCollectionPropertyUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000001133010676445111033255 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.test; import java.util.ArrayList; import java.util.Collection; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.ElementWildcardWithCollectionProperty; import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** * ElementWildcardUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ElementWildcardWithCollectionPropertyUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(ElementWildcardWithCollectionPropertyUnitTestCase.class); } public ElementWildcardWithCollectionPropertyUnitTestCase(String name) { super(name); } public void testUnmarshalWildcardWithProperties() throws Exception { ElementWildcardWithCollectionProperty result = unmarshalObject(ElementWildcardWithCollectionProperty.class); Collection properties = result.getProperties(); ArrayList expected = new ArrayList(); expected.add("1"); expected.add("2"); assertEquals(expected, properties); Element element = result.getWildcard(); assertNotNull(element); assertEquals("test-element", element.getNodeName()); NodeList childNodes = element.getChildNodes(); assertNotNull(childNodes); assertEquals(1, childNodes.getLength()); element = (Element) childNodes.item(0); assertEquals("test-child-element", element.getNodeName()); } public void testUnmarshalResolvedWildcard() throws Exception { ElementWildcardWithCollectionProperty result = unmarshalObject(ElementWildcardWithCollectionProperty.class); Collection properties = result.getProperties(); ArrayList expected = new ArrayList(); expected.add("1"); expected.add("2"); assertEquals(expected, properties); Element element = result.getWildcard(); assertNotNull(element); assertEquals("wildcard", element.getNodeName()); NodeList childNodes = element.getChildNodes(); assertNotNull(childNodes); assertEquals(1, childNodes.getLength()); element = (Element) childNodes.item(0); assertEquals("test-child-element", element.getNodeName()); } /* // TODO Fix this public void testWildcardWithPropertiesBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(ElementWildcardWithCollectionProperty.class); assertNotNull(schemaBinding); QName qName = new QName(XMLConstants.NULL_NS_URI, "element-wildcard-with-collection-property"); ElementBinding element = schemaBinding.getElement(qName); assertNotNull(element); TypeBinding type = element.getType(); assertNotNull(type); ParticleBinding particle = type.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); assertTrue(term instanceof SequenceBinding); // i don't think the following assertion is wrong term = assertSingleSequence(term); assertTrue(term instanceof WildcardBinding); WildcardBinding wildcardBinding = type.getWildcard(); assertNotNull(wildcardBinding); assertTrue(term == wildcardBinding); assertTrue(wildcardBinding.isProcessContentsLax()); assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedCharactersHandler()); assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedElementHandler()); ParticleHandler particleHandler = wildcardBinding.getWildcardHandler(); assertNotNull(particleHandler); assertTrue(particleHandler instanceof PropertyWildcardHandler); } */ } ././@LongLink0000000000000000000000000000023500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementPropertiesAndWildcardUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000001660311153522526033262 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.test; import java.util.Collection; import java.util.Iterator; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.ElementPropertiesAndWildcard; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.DOMHandler; import org.jboss.xb.builder.runtime.PropertyWildcardHandler; import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** * ElementWildcardUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ElementPropertiesAndWildcardUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(ElementPropertiesAndWildcardUnitTestCase.class); } public ElementPropertiesAndWildcardUnitTestCase(String name) { super(name); } public void testUnmarshalWildcard() throws Exception { ElementPropertiesAndWildcard result = unmarshalObject(ElementPropertiesAndWildcard.class); Element element = result.getE1(); assertNotNull(element); assertEquals("e1", element.getNodeName()); NodeList childNodes = element.getChildNodes(); assertNotNull(childNodes); assertEquals(1, childNodes.getLength()); element = (Element) childNodes.item(0); assertEquals("e1-child", element.getNodeName()); element = result.getE2(); assertNotNull(element); assertEquals("e2", element.getNodeName()); childNodes = element.getChildNodes(); assertNotNull(childNodes); assertEquals(1, childNodes.getLength()); element = (Element) childNodes.item(0); assertEquals("e2-child", element.getNodeName()); element = result.getOther(); assertNotNull(element); assertEquals("e3", element.getNodeName()); childNodes = element.getChildNodes(); assertNotNull(childNodes); assertEquals(1, childNodes.getLength()); element = (Element) childNodes.item(0); assertEquals("e3-child", element.getNodeName()); } public void testWildcardBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(ElementPropertiesAndWildcard.class); assertNotNull(schemaBinding); QName qName = new QName(XMLConstants.NULL_NS_URI, "element-properties-and-wildcard"); ElementBinding element = schemaBinding.getElement(qName); assertNotNull(element); TypeBinding type = element.getType(); assertNotNull(type); ParticleBinding particle = type.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); assertTrue(term instanceof SequenceBinding || term instanceof UnorderedSequenceBinding); Collection particles = ((ModelGroupBinding)term).getParticles(); assertEquals(3, particles.size()); Iterator i = particles.iterator(); ParticleBinding e1p = null; ParticleBinding e2p = null; ParticleBinding wp = null; if(term instanceof SequenceBinding) { e1p = i.next(); e2p = i.next(); wp = i.next(); } else { while(i.hasNext()) { particle = i.next(); term = particle.getTerm(); if(term.isElement()) { if("e1".equals(((ElementBinding)term).getQName().getLocalPart())) e1p = particle; else e2p = particle; } else wp = particle; } } assertTrue(e1p.getTerm().isElement()); assertEquals(0, e1p.getMinOccurs()); assertEquals(1, e1p.getMaxOccurs()); assertFalse(e1p.getMaxOccursUnbounded()); element = (ElementBinding) e1p.getTerm(); assertEquals(new QName("e1"), element.getQName()); particles = ((ModelGroupBinding)element.getType().getParticle().getTerm()).getParticles(); assertEquals(1, particles.size()); particle = particles.iterator().next(); assertWildcardTerm(element.getType(), particle, (short) 2); assertTrue(e2p.getTerm().isElement()); assertEquals(0, e2p.getMinOccurs()); assertEquals(1, e2p.getMaxOccurs()); assertFalse(e2p.getMaxOccursUnbounded()); element = (ElementBinding) e2p.getTerm(); assertEquals(new QName("e2"), element.getQName()); particles = ((ModelGroupBinding)element.getType().getParticle().getTerm()).getParticles(); assertEquals(1, particles.size()); particle = particles.iterator().next(); assertWildcardTerm(element.getType(), particle, (short) 2); assertWildcardTerm(type, wp, (short) 3); WildcardBinding wildcardBinding = type.getWildcard(); ParticleHandler particleHandler = wildcardBinding.getWildcardHandler(); assertNotNull(particleHandler); assertTrue(particleHandler instanceof PropertyWildcardHandler); } private void assertWildcardTerm(TypeBinding type, ParticleBinding particle, short pc) { TermBinding term; term = particle.getTerm(); assertTrue(particle.getTerm().isWildcard()); assertEquals(0, particle.getMinOccurs()); assertEquals(1, particle.getMaxOccurs()); assertFalse(particle.getMaxOccursUnbounded()); WildcardBinding wildcardBinding = type.getWildcard(); assertNotNull(wildcardBinding); assertTrue(term == wildcardBinding); assertEquals(pc, wildcardBinding.getProcessContents()); assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedCharactersHandler()); assertTrue(DOMHandler.INSTANCE == wildcardBinding.getUnresolvedElementHandler()); } } ././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/test/ElementBeforePrimitiveUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000001214411153522526033256 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.test; import java.util.Collection; import java.util.Iterator; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmlanyelement.support.ElementBeforePrimitive; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** * A ElementBeforePrimitiveUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ElementBeforePrimitiveUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(ElementBeforePrimitiveUnitTestCase.class); } public ElementBeforePrimitiveUnitTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { ElementBeforePrimitive o = unmarshalObject(ElementBeforePrimitive.class); Element element = o.getDom(); assertNotNull(element); assertEquals("dom", element.getNodeName()); NodeList childNodes = element.getChildNodes(); assertNotNull(childNodes); assertEquals(2, childNodes.getLength()); element = (Element) childNodes.item(0); assertEquals("sweet", element.getNodeName()); assertEquals("frustration is not professional", o.getText()); } public void testBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(ElementBeforePrimitive.class); assertNotNull(schemaBinding); QName qName = new QName(XMLConstants.NULL_NS_URI, "element-before-primitive"); ElementBinding element = schemaBinding.getElement(qName); assertNotNull(element); TypeBinding type = element.getType(); assertNotNull(type); ParticleBinding particle = type.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); assertTrue(term instanceof SequenceBinding || term instanceof UnorderedSequenceBinding); Collection particles = ((ModelGroupBinding)term).getParticles(); assertEquals(2, particles.size()); ParticleBinding domParticle; ParticleBinding textParticle; Iterator i = particles.iterator(); if(term instanceof SequenceBinding) { domParticle = i.next(); textParticle = i.next(); } else { particle = i.next(); if (((ElementBinding) particle.getTerm()).getQName().equals(new QName("dom"))) { domParticle = particle; textParticle = i.next(); } else { textParticle = particle; domParticle = i.next(); } } term = domParticle.getTerm(); assertTrue(term.isElement()); assertEquals(0, domParticle.getMinOccurs()); assertEquals(1, domParticle.getMaxOccurs()); assertFalse(domParticle.getMaxOccursUnbounded()); element = (ElementBinding) term; assertEquals(new QName("dom"), element.getQName()); term = textParticle.getTerm(); assertTrue(term.isElement()); assertEquals(0, textParticle.getMinOccurs()); assertEquals(1, textParticle.getMaxOccurs()); assertFalse(textParticle.getMaxOccursUnbounded()); element = (ElementBinding) term; assertEquals(new QName("text"), element.getQName()); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000755000175000017500000000000011620316746033256 5ustar twernertwerner././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ElementBeforePrimitive.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000330311144772643033262 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import javax.xml.bind.annotation.XmlType; import org.w3c.dom.Element; /** * A ElementBeforePrimitive. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlType(propOrder={"dom", "text"}) public class ElementBeforePrimitive { private Element dom; private String text; public Element getDom() { return dom; } public void setDom(Element dom) { this.dom = dom; } public String getText() { return text; } public void setText(String text) { this.text = text; } } ././@LongLink0000000000000000000000000000022400000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ElementPropertiesAndWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000352010676471510033261 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlType; import org.w3c.dom.Element; /** * ElementWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlType(propOrder={"e1", "e2", "other"}) public class ElementPropertiesAndWildcard { private Element e1; private Element e2; private Element other; public Element getE1() { return e1; } public void setE1(Element e1) { this.e1 = e1; } public Element getE2() { return e2; } public void setE2(Element e2) { this.e2 = e2; } public Element getOther() { return other; } @XmlAnyElement(lax=true) public void setOther(Element other) { this.other = other; } } ././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/NotAnnotatedElementWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000263210676471510033264 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import org.w3c.dom.Element; /** * ElementWildcard. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class NotAnnotatedElementWildcard { private Element element; public Element getElement() { return element; } public void setElement(Element element) { this.element = element; } } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/AnotherJavaBean.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000243710562616254033267 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import org.jboss.xb.annotations.JBossXmlSchema; /** * AnotherJavaBean. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @JBossXmlSchema(namespace="urn:AnotherJavaBean") public class AnotherJavaBean { } ././@LongLink0000000000000000000000000000023000000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/XmlElementsAndXmlAnyElementArray.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000353711350647605033271 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlRootElement; /** * XmlElementsAndXmlAnyElement. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ // apprently if there is no propOrder the test fails //@XmlType(propOrder="list") @XmlRootElement(name="xml-elements-and-xml-any-element") public class XmlElementsAndXmlAnyElementArray { private Object[] array; public Object[] getArray() { return array; } @XmlElements ({ @XmlElement(name="a", type=Integer.class), @XmlElement(name="b", type=String.class) }) @XmlAnyElement public void setArray(Object[] wildcard) { this.array = wildcard; } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/SimpleObjectWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000267610562616254033274 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import javax.xml.bind.annotation.XmlAnyElement; /** * SimpleObjectWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class SimpleObjectWildcard { private Object wildcard; public Object getWildcard() { return wildcard; } @XmlAnyElement public void setWildcard(Object wildcard) { this.wildcard = wildcard; } } ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ListObjectWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000274410562616254033270 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import java.util.List; import javax.xml.bind.annotation.XmlAnyElement; /** * ListObjectWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ListObjectWildcard { private List wildcard; public List getWildcard() { return wildcard; } @XmlAnyElement public void setWildcard(List wildcard) { this.wildcard = wildcard; } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ArrayObjectWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000270210562616254033262 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import javax.xml.bind.annotation.XmlAnyElement; /** * ArrayObjectWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ArrayObjectWildcard { private Object[] wildcard; public Object[] getWildcard() { return wildcard; } @XmlAnyElement public void setWildcard(Object[] wildcard) { this.wildcard = wildcard; } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ArrayElementWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000275610562616254033273 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import javax.xml.bind.annotation.XmlAnyElement; import org.w3c.dom.Element; /** * ArrayElementWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ArrayElementWildcard { private Element[] wildcard; public Element[] getWildcard() { return wildcard; } @XmlAnyElement(lax=true) public void setWildcard(Element[] wildcard) { this.wildcard = wildcard; } } ././@LongLink0000000000000000000000000000023500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ElementWildcardWithCollectionProperty.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000364210676471510033266 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import java.util.Collection; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import org.w3c.dom.Element; /** * ElementWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlType(propOrder={"properties", "wildcard"}) public class ElementWildcardWithCollectionProperty { private Element wildcard; private Collection properties; public Collection getProperties() { return properties; } @XmlElement(name="property") public void setProperties(Collection properties) { this.properties = properties; } public Element getWildcard() { return wildcard; } @XmlAnyElement(lax=true) public void setWildcard(Element wildcard) { this.wildcard = wildcard; } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ListElementWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000302010562616254033254 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import java.util.List; import javax.xml.bind.annotation.XmlAnyElement; import org.w3c.dom.Element; /** * ListElementWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ListElementWildcard { private List wildcard; public List getWildcard() { return wildcard; } @XmlAnyElement(lax=true) public void setWildcard(List wildcard) { this.wildcard = wildcard; } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/SimpleJavaBean.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000243410562616254033264 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import org.jboss.xb.annotations.JBossXmlSchema; /** * SimpleJavaBean. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @JBossXmlSchema(namespace="urn:SimpleJavaBean") public class SimpleJavaBean { } ././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/XmlElementsAndXmlAnyElement.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000341310754275541033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import java.util.List; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; /** * XmlElementsAndXmlAnyElement. * * @author Adrian Brock * @version $Revision: 1.1 $ */ // apprently if there is no propOrder the test fails //@XmlType(propOrder="list") public class XmlElementsAndXmlAnyElement { private List list; public List getList() { return list; } @XmlElements ({ @XmlElement(name="a", type=Integer.class), @XmlElement(name="b", type=String.class) }) @XmlAnyElement public void setList(List wildcard) { this.list = wildcard; } } ././@LongLink0000000000000000000000000000020700000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/support/ElementWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000644000175000017500000000273610562616254033271 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement.support; import javax.xml.bind.annotation.XmlAnyElement; import org.w3c.dom.Element; /** * ElementWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ElementWildcard { private Element wildcard; public Element getWildcard() { return wildcard; } @XmlAnyElement(lax=true) public void setWildcard(Element wildcard) { this.wildcard = wildcard; } } ././@LongLink0000000000000000000000000000022000000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyelement/ObjectTypeXmlAnyElementTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmlanyel0000755000175000017500000000626210754275541033275 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmlanyelement; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.type.xmlanyelement.test.ArrayElementWildcardUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlanyelement.test.ArrayObjectWildcardUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlanyelement.test.ElementPropertiesAndWildcardUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlanyelement.test.ElementWildcardUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlanyelement.test.ElementWildcardWithCollectionPropertyUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlanyelement.test.ListElementWildcardUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlanyelement.test.ListObjectWildcardUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlanyelement.test.NotAnnotatedElementWildcardUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlanyelement.test.SimpleObjectWildcardUnitTestCase; import org.jboss.test.xb.builder.object.type.xmlanyelement.test.XmlElementsAndXmlAnyElementUnitTestCase; /** * ObjectTypeXmlAnyElementTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectTypeXmlAnyElementTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object Type XmlAnyElement Tests"); suite.addTest(SimpleObjectWildcardUnitTestCase.suite()); suite.addTest(ArrayObjectWildcardUnitTestCase.suite()); suite.addTest(ListObjectWildcardUnitTestCase.suite()); suite.addTest(ElementWildcardUnitTestCase.suite()); suite.addTest(ArrayElementWildcardUnitTestCase.suite()); suite.addTest(ListElementWildcardUnitTestCase.suite()); suite.addTest(ElementPropertiesAndWildcardUnitTestCase.suite()); suite.addTest(ElementWildcardWithCollectionPropertyUnitTestCase.suite()); suite.addTest(NotAnnotatedElementWildcardUnitTestCase.suite()); suite.addTest(XmlElementsAndXmlAnyElementUnitTestCase.suite()); return suite; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/simple/0000755000175000017500000000000011620316747032776 5ustar twernertwerner././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/simple/ObjectTypeSimpleTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/simple/O0000755000175000017500000000346410562616254033131 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.simple; import org.jboss.test.xb.builder.object.type.simple.test.IntegerUnitTestCase; import org.jboss.test.xb.builder.object.type.simple.test.StringUnitTestCase; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * ObjectTypeAccessorTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectTypeSimpleTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object Type Simple Tests"); suite.addTest(StringUnitTestCase.suite()); suite.addTest(IntegerUnitTestCase.suite()); // TODO test all simple types return suite; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/simple/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/simple/t0000755000175000017500000000000011620316747033162 5ustar twernertwerner././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/simple/test/StringUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/simple/t0000644000175000017500000000266210562616254033172 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.simple.test; import junit.framework.Test; /** * StringUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class StringUnitTestCase extends AbstractSimpleTest { public static Test suite() { return suite(StringUnitTestCase.class); } public StringUnitTestCase(String name) { super(name, String.class, "hello"); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/simple/test/IntegerUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/simple/t0000644000175000017500000000267710562616254033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.simple.test; import junit.framework.Test; /** * IntegerUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class IntegerUnitTestCase extends AbstractSimpleTest { public static Test suite() { return suite(IntegerUnitTestCase.class); } public IntegerUnitTestCase(String name) { super(name, Integer.class, new Integer(4)); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/simple/test/AbstractSimpleTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/simple/t0000644000175000017500000000525010562616254033166 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.simple.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * AbstractSimpleTest. * * @param the simple type * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractSimpleTest extends AbstractBuilderTest { /** The root class */ private Class root; /** The expected value */ private T expected; public AbstractSimpleTest(String name, Class root, T expected) { super(name); this.root = root; this.expected = expected; } public void testUnmarshal() throws Exception { T result = unmarshalObject(root); assertEquals(expected, result); } public void testSimpleBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(root); assertNotNull(schemaBinding); QName qName = SimpleTypeBindings.typeQName(root); assertNotNull(qName); TypeBinding expectedTypeBinding = schemaBinding.getType(qName); QName elementName = new QName(XMLConstants.NULL_NS_URI, JBossXBBuilder.generateXMLNameFromJavaName(root.getSimpleName(), true, true)); ElementBinding elementBinding = schemaBinding.getElement(elementName); assertNotNull(elementBinding); assertTrue(expectedTypeBinding == elementBinding.getType()); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000755000175000017500000000000011620316746033206 5ustar twernertwerner././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000755000175000017500000000000011620316746033206 5ustar twernertwerner././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/test/BeanAdapterUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000644000175000017500000000713310625561630033212 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmltype.adapter.Adapted; import org.jboss.test.xb.builder.object.type.xmltype.adapter.AdaptedSubclass; import org.jboss.test.xb.builder.object.type.xmltype.adapter.TestBeanAdapterFactory; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.BeanHandler; import org.jboss.xb.spi.BeanAdapterFactory; /** * AbstractMCTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BeanAdapterUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(BeanAdapterUnitTestCase.class); } public BeanAdapterUnitTestCase(String name) { super(name); } public void testAdaptedUnmarshal() throws Exception { Adapted result = unmarshalObject(Adapted.class); // Class should have been changed by the adapter assertTrue(result instanceof AdaptedSubclass); // Properties should have been swapped by the adapter assertEquals("property1", result.property2); assertEquals("property2", result.property1); } public void testAdaptedTypeBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(Adapted.class); assertNotNull(schemaBinding); // Check the type QName qName = new QName("testNamespace", "adapted"); TypeBinding type = schemaBinding.getType(qName); assertNotNull(type); assertEquals(qName, type.getQName()); QName elementName = new QName(XMLConstants.NULL_NS_URI, "adapted"); ElementBinding elementBinding = schemaBinding.getElement(elementName); assertNotNull(elementBinding); TypeBinding typeBinding = elementBinding.getType(); assertTrue(type == typeBinding); ParticleHandler particleHandler = typeBinding.getHandler(); assertNotNull(particleHandler); assertTrue(particleHandler instanceof BeanHandler); BeanHandler beanInfoElementHandler = (BeanHandler) particleHandler; BeanAdapterFactory beanAdapterFactory = beanInfoElementHandler.getBeanAdapterFactory(); assertTrue(beanAdapterFactory instanceof TestBeanAdapterFactory); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/test/DefaultsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000644000175000017500000000277110562616254033220 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.type.xmltype.support.defaults.Root; /** * DefaultsTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class DefaultsUnitTestCase extends AbstractDefaultsTest { public static Test suite() { return suite(DefaultsUnitTestCase.class); } public DefaultsUnitTestCase(String name) { super(name, Root.class, true); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/test/AbstractDefaultsTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000644000175000017500000000712210625561630033210 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.BeanHandler; import org.jboss.xb.spi.AbstractBeanAdapterFactory; import org.jboss.xb.spi.BeanAdapterFactory; /** * AbstractErrorTest. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractDefaultsTest extends AbstractBuilderTest { /** The root class */ private Class root; /** Whether this is a root type */ private boolean rootType; public AbstractDefaultsTest(String name, Class root, boolean rootType) { super(name); this.root = root; this.rootType = rootType; } public void testDefaultsUnmarshal() throws Exception { unmarshalObject(root); } public void testDefaultsTypeBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(root); testDefaults(schemaBinding); } protected void testDefaults(SchemaBinding schemaBinding) { assertNotNull(schemaBinding); // Check the type QName qName = new QName(XMLConstants.NULL_NS_URI, "root"); QName elementName = qName; TypeBinding type = schemaBinding.getType(qName); if (rootType) { assertNotNull(type); assertEquals(qName, type.getQName()); } else assertNull(type); ElementBinding elementBinding = schemaBinding.getElement(elementName); assertNotNull(elementBinding); TypeBinding typeBinding = elementBinding.getType(); if (rootType) assertTrue(type == typeBinding); ParticleHandler particleHandler = typeBinding.getHandler(); assertNotNull(particleHandler); assertTrue(particleHandler instanceof BeanHandler); BeanHandler beanInfoElementHandler = (BeanHandler) particleHandler; BeanAdapterFactory beanAdapterFactory = beanInfoElementHandler.getBeanAdapterFactory(); assertTrue(beanAdapterFactory instanceof AbstractBeanAdapterFactory); AbstractBeanAdapterFactory abstractBeanAdapterFactory = (AbstractBeanAdapterFactory) beanAdapterFactory; assertEquals(root.getName(), abstractBeanAdapterFactory.getBeanInfo().getName()); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/test/NoneUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000644000175000017500000000275210562616254033217 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.type.xmltype.support.none.Root; /** * NoneUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NoneUnitTestCase extends AbstractDefaultsTest { public static Test suite() { return suite(NoneUnitTestCase.class); } public NoneUnitTestCase(String name) { super(name, Root.class, false); } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/test/NonDefaultsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000644000175000017500000000666110625561630033217 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.type.xmltype.support.nondefaults.Root; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.builder.runtime.BeanHandler; import org.jboss.xb.spi.AbstractBeanAdapterFactory; import org.jboss.xb.spi.BeanAdapterFactory; /** * NonDefaultsUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NonDefaultsUnitTestCase extends AbstractBuilderTest { public static Test suite() { return suite(NonDefaultsUnitTestCase.class); } public NonDefaultsUnitTestCase(String name) { super(name); } public void testBeanAdapterUnmarshal() throws Exception { unmarshalObject(Root.class); } public void testNonDefaultsTypeBinding() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(Root.class); assertNotNull(schemaBinding); // Check the type QName qName = new QName("testNamespace", "nondefaults"); TypeBinding type = schemaBinding.getType(qName); assertNotNull(type); assertEquals(qName, type.getQName()); QName elementName = new QName(XMLConstants.NULL_NS_URI, "root"); ElementBinding elementBinding = schemaBinding.getElement(elementName); assertNotNull(elementBinding); TypeBinding typeBinding = elementBinding.getType(); assertTrue(type == typeBinding); ParticleHandler particleHandler = typeBinding.getHandler(); assertNotNull(particleHandler); assertTrue(particleHandler instanceof BeanHandler); BeanHandler beanInfoElementHandler = (BeanHandler) particleHandler; BeanAdapterFactory beanAdapterFactory = beanInfoElementHandler.getBeanAdapterFactory(); assertTrue(beanAdapterFactory instanceof AbstractBeanAdapterFactory); AbstractBeanAdapterFactory abstractBeanAdapterFactory = (AbstractBeanAdapterFactory) beanAdapterFactory; assertEquals(Root.class.getName(), abstractBeanAdapterFactory.getBeanInfo().getName()); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/adapter/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000755000175000017500000000000011620316746033206 5ustar twernertwerner././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/adapter/TestBeanAdapterFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000644000175000017500000000261010625561630033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype.adapter; import org.jboss.xb.spi.BeanAdapter; import org.jboss.xb.spi.BeanAdapterFactory; /** * TestBeanAdapterFactory. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestBeanAdapterFactory extends BeanAdapterFactory { public BeanAdapter newInstance() { return new TestBeanAdapter(this); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/adapter/Adapted.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000644000175000017500000000321211143235515033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype.adapter; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlType; /** * Adapted * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlType(namespace="testNamespace", name="adapted", propOrder={"property1", "property2"}) @JBossXmlType(beanAdapterBuilder=TestBeanAdapterBuilder.class) public class Adapted { public String property1; public String property2; public void setProperty1(String property1) { this.property1 = property1; } public void setProperty2(String property2) { this.property2 = property2; } } ././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/adapter/TestBeanAdapterBuilder.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000644000175000017500000000302310625561630033204 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype.adapter; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.xb.spi.BeanAdapterBuilder; import org.jboss.xb.spi.BeanAdapterFactory; /** * TestBeanAdapterBuilder. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestBeanAdapterBuilder implements BeanAdapterBuilder { public BeanAdapterFactory newFactory(BeanInfo beanInfo, MethodInfo factory) { return new TestBeanAdapterFactory(); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/adapter/AdaptedSubclass.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000644000175000017500000000230710625561630033210 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype.adapter; /** * AdaptedSubclass. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class AdaptedSubclass extends Adapted { } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/adapter/TestBeanAdapter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000644000175000017500000000405010625561630033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype.adapter; import java.lang.reflect.Method; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.xb.spi.BeanAdapter; import org.jboss.xb.spi.BeanAdapterFactory; /** * TestBeanAdapter. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TestBeanAdapter extends BeanAdapter { Adapted adapted; public TestBeanAdapter(BeanAdapterFactory beanAdapterFactory) { super(beanAdapterFactory); adapted = new AdaptedSubclass(); } public void set(PropertyInfo propertyInfo, Object child) throws Throwable { String methodName = null; if ("property1".equals(propertyInfo.getName())) methodName = "setProperty2"; else methodName = "setProperty1"; Method method = Adapted.class.getMethod(methodName, String.class); method.invoke(adapted, child); } public Object get(PropertyInfo propertyInfo) throws Throwable { return null; } public Object getValue() { return adapted; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000755000175000017500000000000011620316746033206 5ustar twernertwerner././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/support/defaults/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000755000175000017500000000000011620316746033206 5ustar twernertwerner././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/support/defaults/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000644000175000017500000000234710562616254033217 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype.support.defaults; import javax.xml.bind.annotation.XmlType; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlType public class Root { } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/support/none/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000755000175000017500000000000011620316746033206 5ustar twernertwerner././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/support/none/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000644000175000017500000000225710562616254033217 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype.support.none; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class Root { } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/support/nondefaults/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000755000175000017500000000000011620316746033206 5ustar twernertwerner././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/support/nondefaults/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000644000175000017500000000243110562616254033211 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype.support.nondefaults; import javax.xml.bind.annotation.XmlType; /** * EnumGlobalType * * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlType(namespace="testNamespace", name="nondefaults") public class Root { } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/ObjectTypeXmlTypeTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/type/xmltype/0000755000175000017500000000410210625561630033206 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.type.xmltype; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.type.xmltype.test.BeanAdapterUnitTestCase; import org.jboss.test.xb.builder.object.type.xmltype.test.DefaultsUnitTestCase; import org.jboss.test.xb.builder.object.type.xmltype.test.NonDefaultsUnitTestCase; import org.jboss.test.xb.builder.object.type.xmltype.test.NoneUnitTestCase; /** * ObjectTypeXmlTypeTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectTypeXmlTypeTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object Type XmlType Tests"); suite.addTest(NoneUnitTestCase.suite()); suite.addTest(DefaultsUnitTestCase.suite()); suite.addTest(NonDefaultsUnitTestCase.suite()); suite.addTest(BeanAdapterUnitTestCase.suite()); // TODO test semantics return suite; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/schema/0000755000175000017500000000000011620316756031764 5ustar twernertwerner././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/schema/ObjectSchemaTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/schema/Object0000755000175000017500000000347410562616254033130 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.schema; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.jboss.test.xb.builder.object.jbossxmlschema.ObjectJBossXmlSchemaTestSuite; import org.jboss.test.xb.builder.object.xmlschema.ObjectXmlSchemaTestSuite; /** * ObjectXmlElementTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectSchemaTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object Schema Tests"); suite.addTest(ObjectJBossXmlSchemaTestSuite.suite()); suite.addTest(ObjectXmlSchemaTestSuite.suite()); // TODO test XmlSchemaType(s) return suite; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/AbstractErrorTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/AbstractError0000644000175000017500000000442310562616254033227 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object; import junit.framework.AssertionFailedError; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.xb.builder.JBossXBBuilder; /** * AbstractErrorTest. * * @param the expected error * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractErrorTest extends AbstractBuilderTest { /** The root class */ private Class root; /** The expected throwable */ private Class expected; public AbstractErrorTest(String name, Class root, Class expected) { super(name); this.root = root; this.expected = expected; } public void testErrorUnmarshal() throws Exception { try { unmarshalObject(root); fail("Should not be here"); } catch (AssertionFailedError e) { throw e; } catch (Throwable t) { checkThrowable(expected, t); } } public void testError() throws Exception { try { JBossXBBuilder.build(root); fail("Should not be here"); } catch (AssertionFailedError e) { throw e; } catch (Throwable t) { checkThrowable(expected, t); } } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlcollection/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlcolle0000755000175000017500000000000011620316756033325 5ustar twernertwerner././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlcollection/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlcolle0000755000175000017500000000000011620316756033325 5ustar twernertwerner././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlcollection/test/JBossXmlCollectionUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlcolle0000644000175000017500000000717311337022577033337 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlcollection.test; import java.util.LinkedList; import java.util.List; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.jbossxmlcollection.support.Root; /** * A JBossXmlCollectionUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class JBossXmlCollectionUnitTestCase extends AbstractBuilderTest { public JBossXmlCollectionUnitTestCase(String name) { super(name); } public void testDefault() throws Exception { Root root = unmarshalObject(Root.class); assertNotNull(root); assertNull(root.getUnparameterizedList()); assertNull(root.getJbossXmlList()); List list = root.getDefaultList(); assertNotNull(list); assertEquals(3, list.size()); assertEquals("default1", list.get(0)); assertEquals("default22", list.get(1)); assertEquals("default333", list.get(2)); } public void testUnparameterized() throws Exception { Root root = unmarshalObject(Root.class); assertNotNull(root); assertNull(root.getDefaultList()); assertNull(root.getJbossXmlList()); List list = root.getUnparameterizedList(); assertNotNull(list); assertEquals(3, list.size()); assertEquals(1, list.get(0)); assertEquals(22, list.get(1)); assertEquals(333, list.get(2)); } public void testJbossXmlList() throws Exception { Root root = unmarshalObject(Root.class); assertNotNull(root); assertNull(root.getDefaultList()); assertNull(root.getUnparameterizedList()); List list = root.getJbossXmlList(); assertNotNull(list); assertEquals(LinkedList.class, list.getClass()); assertEquals(3, list.size()); assertEquals("jbossxmllist1", list.get(0)); assertEquals("jbossxmllist22", list.get(1)); assertEquals("jbossxmllist333", list.get(2)); } public void testUnparameterizedJbossXmlList() throws Exception { Root root = unmarshalObject(Root.class); assertNotNull(root); assertNull(root.getDefaultList()); assertNull(root.getUnparameterizedList()); assertNull(root.getJbossXmlList()); List list = root.getUnparameterizedJbossXmlList(); assertNotNull(list); assertEquals(LinkedList.class, list.getClass()); assertEquals(3, list.size()); assertEquals(11, list.get(0)); assertEquals(22, list.get(1)); assertEquals(33, list.get(2)); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlcollection/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlcolle0000755000175000017500000000000011620316756033325 5ustar twernertwerner././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlcollection/support/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/jbossxmlcolle0000644000175000017500000000544511171577572033345 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.jbossxmlcollection.support; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlCollection; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlType; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement @JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_CHOICE) public class Root { private List defaultList; private List unparameterizedList; private List jbossXmlList; private List unparameterizedJbossXmlList; public List getDefaultList() { return defaultList; } public void setDefaultList(List list) { this.defaultList = list; } @XmlElement(type=Integer.class) public List getUnparameterizedList() { return unparameterizedList; } public void setUnparameterizedList(List unparameterizedList) { this.unparameterizedList = unparameterizedList; } public List getJbossXmlList() { return jbossXmlList; } @JBossXmlCollection(type=java.util.LinkedList.class) public void setJbossXmlList(List list) { this.jbossXmlList = list; } @JBossXmlCollection(type=java.util.LinkedList.class) @XmlElement(type=Integer.class) public List getUnparameterizedJbossXmlList() { return unparameterizedJbossXmlList; } public void setUnparameterizedJbossXmlList(List unparameterizedList) { this.unparameterizedJbossXmlList = unparameterizedList; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/0000755000175000017500000000000011620316756032527 5ustar twernertwerner././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/ObjectAttributeTestSuite.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/Obj0000755000175000017500000000351410562616254033172 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute; import org.jboss.test.xb.builder.object.attribute.test.IntegerUnitTestCase; import org.jboss.test.xb.builder.object.attribute.test.StringUnitTestCase; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * ObjectAttributeTestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ObjectAttributeTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("Object Attribute Tests"); suite.addTest(StringUnitTestCase.suite()); suite.addTest(IntegerUnitTestCase.suite()); // TODO test other simple types // TODO other tests return suite; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/tes0000755000175000017500000000000011620316756033243 5ustar twernertwerner././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/test/QualifierPointListUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/tes0000644000175000017500000000633111305204145033234 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.test; import java.util.Arrays; import java.util.Iterator; import java.util.List; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.object.attribute.support.IntegerListAttribute; import org.jboss.test.xb.builder.object.attribute.support.QualifierPoint; import org.jboss.test.xb.builder.object.attribute.support.QualifierPointListAttribute; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * IntegerListUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class QualifierPointListUnitTestCase extends AbstractAttributeTest> { public static Test suite() { return suite(QualifierPointListUnitTestCase.class); } public QualifierPointListUnitTestCase(String name) { super(name, QualifierPointListAttribute.class, Arrays.asList(new QualifierPoint[]{QualifierPoint.METHOD, QualifierPoint.PROPERTY, QualifierPoint.CONSTRUCTOR})); } @Override public void testSimpleAttribute() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(root); assertNotNull(schemaBinding); QName elementName = new QName(XMLConstants.NULL_NS_URI, JBossXBBuilder.generateXMLNameFromJavaName(root.getSimpleName(), true, true)); ElementBinding elementBinding = schemaBinding.getElement(elementName); assertNotNull(elementBinding); TypeBinding typeBinding = elementBinding.getType(); assertNotNull(typeBinding); QName attributeName = new QName(XMLConstants.NULL_NS_URI, "attribute"); AttributeBinding attribute = typeBinding.getAttribute(attributeName); assertNotNull(attribute); TypeBinding attributeType = attribute.getType(); TypeBinding itemType = attributeType.getItemType(); assertNotNull(itemType); assertTrue(itemType.getValueAdapter() != null); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/test/StringUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/tes0000644000175000017500000000301010562616254033237 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.attribute.support.StringAttribute; /** * StringUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class StringUnitTestCase extends AbstractAttributeTest { public static Test suite() { return suite(StringUnitTestCase.class); } public StringUnitTestCase(String name) { super(name, StringAttribute.class, "hello"); } } ././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/test/SchemaDefaultAttributeValueUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/tes0000644000175000017500000001577411301331614033245 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.test; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.attribute.support.DefaultAttribute; import org.jboss.util.xml.JBossEntityResolver; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingInitializer; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.runtime.BeanHandler; /** * A SchemaDefaultAttributeValueUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class SchemaDefaultAttributeValueUnitTestCase extends AbstractBuilderTest { public SchemaDefaultAttributeValueUnitTestCase(String name) { super(name); } /** * This test demonstrates unmarshalling with default attribute values * * @throws Exception */ public void testMain() throws Exception { UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance(); Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller(); // this is to make the SAX parser parse the XSD as well and include default attribute values in the startElement unmarshaller.setSchemaValidation(true); // this is EntityResolver that SAX parser (xerces) will use to resolve XSD location for the XML being parsed JBossEntityResolver xmlResolver = new JBossEntityResolver(); // Here we map schema location specified in the XML file to the local schema location, // which is a path relative to the resources directory visible in the classpath. // Note, we have to specify here and XML the complete URL including the protocol part into the schemaLocation. // The reason is that if we specify schemaLocation in XML as just a filename, // the SAX parser will compose its schemaLocation by adding the protocol, baseURI (which will depend on the // environment the code is run in) and the schemaLocation we specified in the XML and then // will pass this new schemaLocation to the resolver. xmlResolver.registerLocalEntity("http://www.hostame.org/SchemaDefaultAttributeValue.xsd", "org/jboss/test/xb/builder/object/attribute/test/SchemaDefaultAttributeValue.xsd"); unmarshaller.setEntityResolver(xmlResolver); // this is to resolve namespace to class mapping and build the SchemaBinding from the class MultiClassSchemaResolver schemaBindingResolver = new MultiClassSchemaResolver(); schemaBindingResolver.mapURIToClass("xb:test:default-attribute", DefaultAttribute.class); // the reason we configured a separate EntityResolver for unmarshaller above instead of // calling schemaBindingResolver.mapSchemaLocation(nsURI, location) is that // entity resolution inside schemaBindingResolver is used only for nsURI to class resolution (by XsdBinder) // and is not related to SAX parser entity resolution and XML validation. String xml = findXML("SchemaDefaultAttributeValue.xml"); Object result = unmarshaller.unmarshal(xml, schemaBindingResolver); assertNotNull(result); assertTrue(result instanceof DefaultAttribute); DefaultAttribute da = (DefaultAttribute) result; assertEquals(new Integer(123), da.getAttribute()); } /** * This test demonstrates unmarshalling with default attribute values not added by the sax parser * * @throws Exception */ public void testValidationDisabled() throws Exception { UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance(); Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller(); // this is to make the SAX parser parse the XSD as well and include default attribute values in the startElement //unmarshaller.setSchemaValidation(true); JBossEntityResolver xmlResolver = new JBossEntityResolver(); xmlResolver.registerLocalEntity("http://www.hostame.org/SchemaDefaultAttributeValue.xsd", "org/jboss/test/xb/builder/object/attribute/test/SchemaDefaultAttributeValue.xsd"); unmarshaller.setEntityResolver(xmlResolver); MultiClassSchemaResolver schemaBindingResolver = new MultiClassSchemaResolver(); schemaBindingResolver.mapURIToClass("xb:test:default-attribute", DefaultAttribute.class); // add the default constraint to the attribute schemaBindingResolver.mapSchemaInitializer("xb:test:default-attribute", new SchemaBindingInitializer() { public SchemaBinding init(SchemaBinding schema) { ElementBinding element = schema.getElement(new QName("xb:test:default-attribute", "default-attribute")); assertNotNull(element); TypeBinding type = element.getType(); AttributeBinding attribute = type.getAttribute(new QName("attribute")); assertNotNull(attribute); attribute.setDefaultConstraint("123"); // with this kind attributes handler this has to be done... BeanHandler handler = (BeanHandler) type.getHandler(); handler.getAttributesHandler().addAttribute(attribute); return schema; } } ); String xml = findXML("SchemaDefaultAttributeValue.xml"); Object result = unmarshaller.unmarshal(xml, schemaBindingResolver); assertNotNull(result); assertTrue(result instanceof DefaultAttribute); DefaultAttribute da = (DefaultAttribute) result; assertEquals(new Integer(123), da.getAttribute()); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/test/IntegerUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/tes0000644000175000017500000000302610562616254033246 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.test; import junit.framework.Test; import org.jboss.test.xb.builder.object.attribute.support.IntegerAttribute; /** * IntegerUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class IntegerUnitTestCase extends AbstractAttributeTest { public static Test suite() { return suite(IntegerUnitTestCase.class); } public IntegerUnitTestCase(String name) { super(name, IntegerAttribute.class, new Integer(4)); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/test/IntegerListUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/tes0000644000175000017500000000625511305204145033241 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.test; import java.util.Arrays; import java.util.List; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import junit.framework.Test; import org.jboss.test.xb.builder.object.attribute.support.IntegerListAttribute; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * IntegerListUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class IntegerListUnitTestCase extends AbstractAttributeTest> { public static Test suite() { return suite(IntegerListUnitTestCase.class); } public IntegerListUnitTestCase(String name) { super(name, IntegerListAttribute.class, Arrays.asList(new Integer[]{new Integer(3), new Integer(2), new Integer(4)})); } @Override public void testSimpleAttribute() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(root); assertNotNull(schemaBinding); QName qName = SimpleTypeBindings.typeQName(Integer.class); assertNotNull(qName); TypeBinding expectedItemType = schemaBinding.getType(qName); QName elementName = new QName(XMLConstants.NULL_NS_URI, JBossXBBuilder.generateXMLNameFromJavaName(root.getSimpleName(), true, true)); ElementBinding elementBinding = schemaBinding.getElement(elementName); assertNotNull(elementBinding); TypeBinding typeBinding = elementBinding.getType(); assertNotNull(typeBinding); QName attributeName = new QName(XMLConstants.NULL_NS_URI, "attribute"); AttributeBinding attribute = typeBinding.getAttribute(attributeName); assertNotNull(attribute); TypeBinding attributeType = attribute.getType(); TypeBinding itemType = attributeType.getItemType(); assertNotNull(itemType); assertTrue("Expected " + expectedItemType + " got " + itemType, expectedItemType == itemType); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/test/AbstractAttributeTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/tes0000644000175000017500000000650511305204145033237 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.test; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.attribute.support.SimpleAttribute; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * AbstractAttributeTest. * * @param the simple type * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractAttributeTest extends AbstractBuilderTest { /** The root class */ protected Class root; /** The expected value */ protected T expected; public AbstractAttributeTest(String name, Class root, T expected) { super(name); this.root = root; this.expected = expected; } @SuppressWarnings("unchecked") public void testUnmarshal() throws Exception { SimpleAttribute result = (SimpleAttribute) unmarshalObject(root); T actual = (T) result.getAttribute(); assertEquals(expected, actual); } public void testSimpleAttribute() throws Exception { SchemaBinding schemaBinding = JBossXBBuilder.build(root); assertNotNull(schemaBinding); QName qName = SimpleTypeBindings.typeQName(expected.getClass()); assertNotNull(qName); TypeBinding expectedTypeBinding = schemaBinding.getType(qName); QName elementName = new QName(XMLConstants.NULL_NS_URI, JBossXBBuilder.generateXMLNameFromJavaName(root.getSimpleName(), true, true)); ElementBinding elementBinding = schemaBinding.getElement(elementName); assertNotNull(elementBinding); TypeBinding typeBinding = elementBinding.getType(); assertNotNull(typeBinding); QName attributeName = new QName(XMLConstants.NULL_NS_URI, "attribute"); AttributeBinding attribute = typeBinding.getAttribute(attributeName); assertNotNull(attribute); TypeBinding attributeType = attribute.getType(); assertTrue("Expected " + expectedTypeBinding + " got " + attributeType, expectedTypeBinding == attributeType); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/javatypeadapter/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/jav0000755000175000017500000000000011620316756033230 5ustar twernertwerner././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/javatypeadapter/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/jav0000755000175000017500000000000011620316756033230 5ustar twernertwerner././@LongLink0000000000000000000000000000022700000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/javatypeadapter/test/JavaTypeAdapterUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/jav0000644000175000017500000000354711343672270033241 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.javatypeadapter.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.object.attribute.javatypeadapter.support.Root; import org.jboss.test.xb.builder.object.attribute.javatypeadapter.support.StringWrapper; /** * A JavaTypeAdapterUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class JavaTypeAdapterUnitTestCase extends AbstractBuilderTest { public JavaTypeAdapterUnitTestCase(String name) { super(name); } public void testAdaptedAttribute() throws Exception { Root root = unmarshalObject(Root.class); StringWrapper attr = root.getAttr(); assertNotNull(attr); assertEquals("val", attr.getValue()); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/javatypeadapter/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/jav0000755000175000017500000000000011620316756033230 5ustar twernertwerner././@LongLink0000000000000000000000000000022300000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/javatypeadapter/support/StringWrapperAdapter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/jav0000644000175000017500000000315611343672270033235 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.javatypeadapter.support; import javax.xml.bind.annotation.adapters.XmlAdapter; /** * A StringWrapperAdapter. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class StringWrapperAdapter extends XmlAdapter { @Override public String marshal(StringWrapper v) throws Exception { return v == null ? null : v.getValue(); } @Override public StringWrapper unmarshal(String v) throws Exception { return v == null ? null : new StringWrapper(v); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/javatypeadapter/support/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/jav0000644000175000017500000000327411343672270033236 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.javatypeadapter.support; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; /** * A RootWithStringWrapperAttribute. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") public class Root { private StringWrapper attr; @XmlAttribute() @XmlJavaTypeAdapter(value = StringWrapperAdapter.class) public StringWrapper getAttr() { return attr; } public void setAttr(StringWrapper attr) { this.attr = attr; } } ././@LongLink0000000000000000000000000000021400000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/javatypeadapter/support/StringWrapper.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/jav0000644000175000017500000000275011343672270033234 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.javatypeadapter.support; /** * A StringWrapper. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class StringWrapper { private String value; public StringWrapper(String value) { this.value = value; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/sup0000755000175000017500000000000011620316756033257 5ustar twernertwerner././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/support/QualifierPoint.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/sup0000644000175000017500000000260111305204145033244 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.support; import javax.xml.bind.annotation.XmlEnumValue; /** * A QualifierPoint. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public enum QualifierPoint { @XmlEnumValue("Constructor") CONSTRUCTOR, @XmlEnumValue("Method") METHOD, @XmlEnumValue("Property") PROPERTY } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/support/StringAttribute.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/sup0000644000175000017500000000273210562616254033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.support; import javax.xml.bind.annotation.XmlAttribute; /** * StringAttribute. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class StringAttribute extends SimpleAttribute { @Override @XmlAttribute public String getAttribute() { return super.getAttribute(); } @Override public void setAttribute(String attribute) { super.setAttribute(attribute); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/support/SimpleAttribute.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/sup0000644000175000017500000000260410562616254033263 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.support; /** * SimpleAttribute. * * @param the attribute type * @author Adrian Brock * @version $Revision: 1.1 $ */ public class SimpleAttribute { private T attribute; public T getAttribute() { return attribute; } public void setAttribute(T attribute) { this.attribute = attribute; } } ././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/support/QualifierPointListAttribute.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/sup0000644000175000017500000000306011305204145033244 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.support; import java.util.List; import javax.xml.bind.annotation.XmlAttribute; /** * IntegerListAttribute. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class QualifierPointListAttribute extends SimpleAttribute> { @Override @XmlAttribute public List getAttribute() { return super.getAttribute(); } @Override public void setAttribute(List attribute) { super.setAttribute(attribute); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/support/IntegerAttribute.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/sup0000644000175000017500000000273710562616254033272 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.support; import javax.xml.bind.annotation.XmlAttribute; /** * IntegerAttribute. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class IntegerAttribute extends SimpleAttribute { @Override @XmlAttribute public Integer getAttribute() { return super.getAttribute(); } @Override public void setAttribute(Integer attribute) { super.setAttribute(attribute); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/support/IntegerListAttribute.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/sup0000644000175000017500000000302411305204145033244 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.support; import java.util.List; import javax.xml.bind.annotation.XmlAttribute; /** * IntegerListAttribute. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class IntegerListAttribute extends SimpleAttribute> { @Override @XmlAttribute public List getAttribute() { return super.getAttribute(); } @Override public void setAttribute(List attribute) { super.setAttribute(attribute); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/support/DefaultAttribute.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/object/attribute/sup0000644000175000017500000000325211223226345033254 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.object.attribute.support; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; /** * A DefaultAttribute. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="default-attribute", namespace="xb:test:default-attribute") public class DefaultAttribute extends SimpleAttribute { @Override @XmlAttribute public Integer getAttribute() { return super.getAttribute(); } @Override public void setAttribute(Integer attribute) { super.setAttribute(attribute); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/DebugElementHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/DebugElementHandler.0000644000175000017500000000421410562616254033116 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.xml.sax.Attributes; /** * DebugElementHandler. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class DebugElementHandler implements ParticleHandler { public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { throw new UnsupportedOperationException("Using Default Handler! startParticle: " + elementName + " " + particle); } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { throw new UnsupportedOperationException("Using Default Handler! setParent: " + elementName + " " + particle); } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { throw new UnsupportedOperationException("Using Default Handler! endParticle: " + elementName + " " + particle); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/useunorderedsequence/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/useunorderedsequence0000755000175000017500000000000011620316756033434 5ustar twernertwerner././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/useunorderedsequence/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/useunorderedsequence0000755000175000017500000000000011620316756033434 5ustar twernertwerner././@LongLink0000000000000000000000000000021200000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/useunorderedsequence/test/InitializationUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/useunorderedsequence0000644000175000017500000000324011171577572033443 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.useunorderedsequence.test; import org.jboss.test.xb.builder.AbstractSystemPropertyInitializationTest; import org.jboss.xb.builder.JBossXBBuilder; /** * A InitializationUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class InitializationUnitTestCase extends AbstractSystemPropertyInitializationTest { @Override protected String getPropertyGetter() { return "isUseUnorderedSequence"; } @Override protected String getPropertyName() { return JBossXBBuilder.USE_UNORDERED_SEQUENCE_PROPERTY; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000755000175000017500000000000011620316744033465 5ustar twernertwerner././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000755000175000017500000000000011620316744033465 5ustar twernertwerner././@LongLink0000000000000000000000000000023200000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/test/RootWithUnorderedSequenceUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000317511171577572033506 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.test; import org.jboss.test.xb.builder.sequencesrequireproporder.support.RootWithUnorderedSequence; /** * A SequencesRequirePropOrderUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RootWithUnorderedSequenceUnitTestCase extends AbstractSequencesRequirePropOrderTest { @Override protected Class getRootType() { return RootWithUnorderedSequence.class; } @Override protected boolean isPropOrderProvided() { return true; } } ././@LongLink0000000000000000000000000000023300000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/test/RootWithUndefinedPropOrderUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000320311171577572033476 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.test; import org.jboss.test.xb.builder.sequencesrequireproporder.support.RootWithUndefinedPropOrder; /** * A SequencesRequirePropOrderUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RootWithUndefinedPropOrderUnitTestCase extends AbstractSequencesRequirePropOrderTest { @Override protected Class getRootType() { return RootWithUndefinedPropOrder.class; } @Override protected boolean isPropOrderProvided() { return false; } } ././@LongLink0000000000000000000000000000023100000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/test/RootWithXmlAccessorOrderUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000317111171577572033502 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.test; import org.jboss.test.xb.builder.sequencesrequireproporder.support.RootWithXmlAccessorOrder; /** * A SequencesRequirePropOrderUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RootWithXmlAccessorOrderUnitTestCase extends AbstractSequencesRequirePropOrderTest { @Override protected Class getRootType() { return RootWithXmlAccessorOrder.class; } @Override protected boolean isPropOrderProvided() { return true; } } ././@LongLink0000000000000000000000000000021700000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/test/InitializationUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000324711171577572033506 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.test; import org.jboss.test.xb.builder.AbstractSystemPropertyInitializationTest; import org.jboss.xb.builder.JBossXBBuilder; /** * A InitializationUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class InitializationUnitTestCase extends AbstractSystemPropertyInitializationTest { @Override protected String getPropertyGetter() { return "isSequencesRequirePropOrder"; } @Override protected String getPropertyName() { return JBossXBBuilder.SEQUENCES_REQUIRE_PROP_ORDER; } } ././@LongLink0000000000000000000000000000023200000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/test/AbstractSequencesRequirePropOrderTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000635011171577572033504 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.test; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.builder.JBossXBBuilder; import junit.framework.TestCase; /** * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public abstract class AbstractSequencesRequirePropOrderTest extends TestCase { protected abstract boolean isPropOrderProvided(); protected abstract Class getRootType(); protected boolean isUseUnorderedSequence() { return false; } protected boolean isPropOrderConfigured() { return isUseUnorderedSequence() || isPropOrderProvided(); } public void testSequencesRequirePropOrderTrue() throws Exception { boolean defSequencesRequirePropOrder = JBossXBBuilder.isSequencesRequirePropOrder(); JBossXBBuilder.setSequencesRequirePropOrder(true); boolean defUseUnorderedSequence = JBossXBBuilder.isUseUnorderedSequence(); JBossXBBuilder.setUseUnorderedSequence(isUseUnorderedSequence()); try { JBossXBBuilder.build(getRootType(), true); if(!isPropOrderConfigured()) fail("Binding didn't fail for " + getRootType().getName()); } catch(JBossXBRuntimeException e) { if(isPropOrderProvided()) throw e; } finally { JBossXBBuilder.setSequencesRequirePropOrder(defSequencesRequirePropOrder); JBossXBBuilder.setUseUnorderedSequence(defUseUnorderedSequence); } } public void testSequencesRequirePropOrderFalse() throws Exception { boolean defSequencesRequirePropOrder = JBossXBBuilder.isSequencesRequirePropOrder(); JBossXBBuilder.setSequencesRequirePropOrder(false); boolean defUseUnorderedSequence = JBossXBBuilder.isUseUnorderedSequence(); JBossXBBuilder.setUseUnorderedSequence(isUseUnorderedSequence()); try { JBossXBBuilder.build(getRootType(), true); } finally { JBossXBBuilder.setSequencesRequirePropOrder(defSequencesRequirePropOrder); JBossXBBuilder.setUseUnorderedSequence(defUseUnorderedSequence); } } }././@LongLink0000000000000000000000000000025700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/test/UnorderedSequenceForRootWithUndefinedPropOrderUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000337111171577572033504 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.test; import org.jboss.test.xb.builder.sequencesrequireproporder.support.RootWithUndefinedPropOrder; /** * A SequencesRequirePropOrderUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class UnorderedSequenceForRootWithUndefinedPropOrderUnitTestCase extends AbstractSequencesRequirePropOrderTest { @Override protected Class getRootType() { return RootWithUndefinedPropOrder.class; } @Override protected boolean isPropOrderProvided() { return false; } @Override protected boolean isUseUnorderedSequence() { return true; } } ././@LongLink0000000000000000000000000000024200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/test/RootWithUnorderedSequencePropertyUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000322711171577572033504 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.test; import org.jboss.test.xb.builder.sequencesrequireproporder.support.RootWithUnorderedSequenceProperty; /** * A SequencesRequirePropOrderUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RootWithUnorderedSequencePropertyUnitTestCase extends AbstractSequencesRequirePropOrderTest { @Override protected Class getRootType() { return RootWithUnorderedSequenceProperty.class; } @Override protected boolean isPropOrderProvided() { return true; } } ././@LongLink0000000000000000000000000000023100000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/test/RootWithSequencePropertyUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000317511171577572033506 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.test; import org.jboss.test.xb.builder.sequencesrequireproporder.support.RootWithSequenceProperty; /** * A SequencesRequirePropOrderUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RootWithSequencePropertyUnitTestCase extends AbstractSequencesRequirePropOrderTest { @Override protected Class getRootType() { return RootWithSequenceProperty.class; } @Override protected boolean isPropOrderProvided() { return false; } } ././@LongLink0000000000000000000000000000025500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/test/UnorderedSequenceForRootWithSequencePropertyUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000336311171577572033505 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.test; import org.jboss.test.xb.builder.sequencesrequireproporder.support.RootWithSequenceProperty; /** * A SequencesRequirePropOrderUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class UnorderedSequenceForRootWithSequencePropertyUnitTestCase extends AbstractSequencesRequirePropOrderTest { @Override protected Class getRootType() { return RootWithSequenceProperty.class; } @Override protected boolean isPropOrderProvided() { return false; } @Override protected boolean isUseUnorderedSequence() { return true; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000755000175000017500000000000011620316744033465 5ustar twernertwerner././@LongLink0000000000000000000000000000022100000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/support/RootWithUnorderedSequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000303311171577572033477 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlType; /** * A RootWithUnorderedSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement @JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE) public class RootWithUnorderedSequence extends BasicSequence { } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/support/SequenceType.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000270411171577572033503 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.support; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; /** * A SequenceType. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlModelGroup(name="sequence", kind=JBossXmlConstants.MODEL_GROUP_SEQUENCE) public class SequenceType extends BasicSequence { } ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/support/UnorderedSequenceType.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000272711171577572033510 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.support; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; /** * A SequenceType. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlModelGroup(name="sequence", kind=JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE) public class UnorderedSequenceType extends BasicSequence { } ././@LongLink0000000000000000000000000000022000000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/support/RootWithSequenceProperty.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000304611171577572033503 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.support; import javax.xml.bind.annotation.XmlRootElement; /** * A RootWithSequenceProperty. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement() public class RootWithSequenceProperty { private SequenceType sequence; public SequenceType getSequence() { return sequence; } public void setSequence(SequenceType sequence) { this.sequence = sequence; } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/support/BasicSequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000312511171577572033501 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.support; /** * A RootWithUnorderedSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class BasicSequence { private String a; private String b; public BasicSequence() { super(); } public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } }././@LongLink0000000000000000000000000000023100000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/support/RootWithUnorderedSequenceProperty.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000312311171577572033477 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.support; import javax.xml.bind.annotation.XmlRootElement; /** * A RootWithUnorderedSequenceProperty. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement() public class RootWithUnorderedSequenceProperty { private UnorderedSequenceType sequence; public UnorderedSequenceType getSequence() { return sequence; } public void setSequence(UnorderedSequenceType sequence) { this.sequence = sequence; } } ././@LongLink0000000000000000000000000000022200000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/support/RootWithUndefinedPropOrder.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000264511171577572033507 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A RootWithoutPropOrder. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType() public class RootWithUndefinedPropOrder extends BasicSequence { } ././@LongLink0000000000000000000000000000022000000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireproporder/support/RootWithXmlAccessorOrder.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/sequencesrequireprop0000644000175000017500000000307711171577572033507 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.sequencesrequireproporder.support; import javax.xml.bind.annotation.XmlAccessOrder; import javax.xml.bind.annotation.XmlAccessorOrder; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A RootWithXmlAccessorOrder. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType() @XmlAccessorOrder(XmlAccessOrder.ALPHABETICAL) public class RootWithXmlAccessorOrder extends BasicSequence { } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/0000755000175000017500000000000011620316756033373 5ustar twernertwerner././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/0000755000175000017500000000000011620316756033373 5ustar twernertwerner././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/test/MultipleRootClassesUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/0000644000175000017500000002504511133404571033373 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.multiplerootclasses.test; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.builder.multiplerootclasses.support.AnotherRootAnotherNs; import org.jboss.test.xb.builder.multiplerootclasses.support.AnotherRootDefaultNs; import org.jboss.test.xb.builder.multiplerootclasses.support.AnotherRootMainNs; import org.jboss.test.xb.builder.multiplerootclasses.support.MainRootDefaultNs; import org.jboss.test.xb.builder.multiplerootclasses.support.MainRootMainNs; import org.jboss.test.xb.builder.multiplerootclasses.support.YetAnotherRootMainNs; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A MultipleRootClassesUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class MultipleRootClassesUnitTestCase extends AbstractBuilderTest { public MultipleRootClassesUnitTestCase(String name) { super(name); } public void testMainNsAnotherNs() throws Exception { SchemaBinding mainSchema = JBossXBBuilder.build(MainRootMainNs.class, true); assertFalse(mainSchema.isStrictSchema()); assertEquals(1, mainSchema.getNamespaces().size()); Iterator elements = mainSchema.getElements(); assertTrue(elements.hasNext()); ElementBinding e = elements.next(); assertEquals(new QName("main.namespace", "main-root"), e.getQName()); assertFalse(elements.hasNext()); SchemaBinding anotherSchema = JBossXBBuilder.build(AnotherRootAnotherNs.class); assertTrue(anotherSchema.isStrictSchema()); assertEquals(1, anotherSchema.getNamespaces().size()); elements = anotherSchema.getElements(); assertTrue(elements.hasNext()); e = elements.next(); assertEquals(new QName("another.namespace", "another-root"), e.getQName()); assertFalse(elements.hasNext()); try { JBossXBBuilder.build(mainSchema, AnotherRootAnotherNs.class); fail("Different namespaces can not be merged."); } catch (IllegalStateException ise) { assertEquals("SchemaBinding namespace 'main.namespace' does not match class namespace 'another.namespace'", ise.getMessage()); } } public void testDefaultNsAnotherNs() throws Exception { SchemaBinding mainSchema = JBossXBBuilder.build(MainRootDefaultNs.class, true); assertFalse(mainSchema.isStrictSchema()); assertEquals(1, mainSchema.getNamespaces().size()); Iterator elements = mainSchema.getElements(); assertTrue(elements.hasNext()); ElementBinding e = elements.next(); assertEquals(new QName("main-root"), e.getQName()); assertFalse(elements.hasNext()); SchemaBinding anotherSchema = JBossXBBuilder.build(AnotherRootAnotherNs.class); assertTrue(anotherSchema.isStrictSchema()); assertEquals(1, anotherSchema.getNamespaces().size()); elements = anotherSchema.getElements(); assertTrue(elements.hasNext()); e = elements.next(); assertEquals(new QName("another.namespace", "another-root"), e.getQName()); assertFalse(elements.hasNext()); try { JBossXBBuilder.build(mainSchema, AnotherRootAnotherNs.class); fail("Different namespaces can not be merged."); } catch (IllegalStateException ise) { assertEquals("SchemaBinding namespace '' does not match class namespace 'another.namespace'", ise.getMessage()); } } public void testMainNsDefaultNs() throws Exception { SchemaBinding mainSchema = JBossXBBuilder.build(MainRootMainNs.class, true); assertFalse(mainSchema.isStrictSchema()); assertEquals(1, mainSchema.getNamespaces().size()); Iterator elements = mainSchema.getElements(); assertTrue(elements.hasNext()); ElementBinding e = elements.next(); assertEquals(new QName("main.namespace", "main-root"), e.getQName()); assertFalse(elements.hasNext()); SchemaBinding anotherSchema = JBossXBBuilder.build(AnotherRootDefaultNs.class); assertTrue(anotherSchema.isStrictSchema()); assertEquals(1, anotherSchema.getNamespaces().size()); elements = anotherSchema.getElements(); assertTrue(elements.hasNext()); e = elements.next(); assertEquals(new QName("another-root"), e.getQName()); assertFalse(elements.hasNext()); try { JBossXBBuilder.build(mainSchema, AnotherRootDefaultNs.class); fail("Different namespaces can not be merged."); } catch (IllegalStateException ise) { assertEquals("SchemaBinding namespace 'main.namespace' does not match class namespace ''", ise.getMessage()); } } public void testDefaultNsDefaultNs() throws Exception { SchemaBinding mainSchema = JBossXBBuilder.build(MainRootDefaultNs.class, true); assertFalse(mainSchema.isStrictSchema()); assertEquals(1, mainSchema.getNamespaces().size()); Iterator elements = mainSchema.getElements(); assertTrue(elements.hasNext()); ElementBinding e = elements.next(); assertEquals(new QName("main-root"), e.getQName()); assertFalse(elements.hasNext()); SchemaBinding anotherSchema = JBossXBBuilder.build(AnotherRootDefaultNs.class); assertTrue(anotherSchema.isStrictSchema()); assertEquals(1, anotherSchema.getNamespaces().size()); elements = anotherSchema.getElements(); assertTrue(elements.hasNext()); e = elements.next(); assertEquals(new QName("another-root"), e.getQName()); assertFalse(elements.hasNext()); JBossXBBuilder.build(mainSchema, AnotherRootDefaultNs.class); assertFalse(mainSchema.isStrictSchema()); assertEquals(1, mainSchema.getNamespaces().size()); elements = mainSchema.getElements(); assertTrue(elements.hasNext()); elements.next(); assertTrue(elements.hasNext()); elements.next(); assertFalse(elements.hasNext()); e = mainSchema.getElement(new QName("main-root")); assertNotNull(e); e = mainSchema.getElement(new QName("another-root")); assertNotNull("another-root is added to the main schema", e); } public void testMainNsMainNs() throws Exception { SchemaBinding mainSchema = JBossXBBuilder.build(MainRootMainNs.class, true); assertFalse(mainSchema.isStrictSchema()); assertEquals(1, mainSchema.getNamespaces().size()); Iterator elements = mainSchema.getElements(); assertTrue(elements.hasNext()); ElementBinding e = elements.next(); assertEquals(new QName("main.namespace", "main-root"), e.getQName()); assertFalse(elements.hasNext()); SchemaBinding anotherSchema = JBossXBBuilder.build(AnotherRootMainNs.class); assertTrue(anotherSchema.isStrictSchema()); assertEquals(1, anotherSchema.getNamespaces().size()); elements = anotherSchema.getElements(); assertTrue(elements.hasNext()); e = elements.next(); assertEquals(new QName("main.namespace", "another-root"), e.getQName()); assertFalse(elements.hasNext()); JBossXBBuilder.build(mainSchema, AnotherRootMainNs.class); assertFalse(mainSchema.isStrictSchema()); assertEquals(1, mainSchema.getNamespaces().size()); elements = mainSchema.getElements(); assertTrue(elements.hasNext()); elements.next(); assertTrue(elements.hasNext()); elements.next(); assertFalse(elements.hasNext()); e = mainSchema.getElement(new QName("main.namespace", "main-root")); assertNotNull(e); e = mainSchema.getElement(new QName("main.namespace", "another-root")); assertNotNull("another-root is added to the main schema", e); } public void testBuildArrayMainNsDefaultNs() throws Exception { try { JBossXBBuilder.build(MainRootMainNs.class, YetAnotherRootMainNs.class, AnotherRootDefaultNs.class); fail("Different namespaces can not be merged."); } catch (IllegalStateException ise) { assertEquals("SchemaBinding namespace 'main.namespace' does not match class namespace ''", ise.getMessage()); } } public void testBuildArrayMainNs() throws Exception { SchemaBinding schema = JBossXBBuilder.build(MainRootMainNs.class, YetAnotherRootMainNs.class, AnotherRootMainNs.class); assertFalse(schema.isStrictSchema()); assertEquals(1, schema.getNamespaces().size()); Iterator elements = schema.getElements(); assertTrue(elements.hasNext()); elements.next(); assertTrue(elements.hasNext()); elements.next(); assertTrue(elements.hasNext()); elements.next(); assertFalse(elements.hasNext()); ElementBinding e = schema.getElement(new QName("main.namespace", "main-root")); assertNotNull(e); e = schema.getElement(new QName("main.namespace", "another-root")); assertNotNull("another-root is added to the main schema", e); e = schema.getElement(new QName("main.namespace", "yet-another-root")); assertNotNull("yet-another-root is added to the main schema", e); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/0000755000175000017500000000000011620316756033373 5ustar twernertwerner././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/support/AnotherRootDefaultNs.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/0000644000175000017500000000264711133404571033376 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.multiplerootclasses.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlSchema; /** * A AnotherRootDefaultNs. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="another-root") @JBossXmlSchema(strict=true) public class AnotherRootDefaultNs { } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/support/AnotherRootAnotherNs.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/0000644000175000017500000000267211133404571033374 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.multiplerootclasses.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlSchema; /** * A MainRoot. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="another-root") @JBossXmlSchema(namespace="another.namespace", strict=true) public class AnotherRootAnotherNs { } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/support/YetAnotherRootMainNs.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/0000644000175000017500000000265611133404571033376 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.multiplerootclasses.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlSchema; /** * A MainRoot. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="yet-another-root") @JBossXmlSchema(namespace="main.namespace") public class YetAnotherRootMainNs { } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/support/MainRootDefaultNs.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/0000644000175000017500000000263711133404571033375 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.multiplerootclasses.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlSchema; /** * A MainRootDefaultNs. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="main-root") @JBossXmlSchema(strict=false) public class MainRootDefaultNs { } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/support/AnotherRootMainNs.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/0000644000175000017500000000266411133404571033375 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.multiplerootclasses.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlSchema; /** * A MainRoot. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="another-root") @JBossXmlSchema(namespace="main.namespace", strict=true) public class AnotherRootMainNs { } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/support/MainRootMainNs.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/multiplerootclasses/0000644000175000017500000000265711133404571033377 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder.multiplerootclasses.support; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlSchema; /** * A MainRoot. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="main-root") @JBossXmlSchema(namespace="main.namespace", strict=false) public class MainRootMainNs { } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/builder/SchemaPrinter.java0000644000175000017500000002350610625561630032670 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.builder; import java.util.Collection; import java.util.Iterator; import javax.xml.XMLConstants; import org.jboss.xb.binding.sunday.unmarshalling.AllBinding; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; /** * SchemaPrinter. * * TODO finish this off properly * @author Adrian Brock * @version $Revision: 1.1 $ */ public class SchemaPrinter { @SuppressWarnings("unchecked") public static String printSchema(SchemaBinding schemaBinding) { String nsURI = (String) schemaBinding.getNamespaces().iterator().next(); StringBuilder builder = new StringBuilder(); builder.append("\n"); int pad=3; Iterator elements = schemaBinding.getElementParticles(); while (elements != null && elements.hasNext()) printElement(builder, pad, elements.next()); Iterator types = schemaBinding.getTypes(); while (types != null && types.hasNext()) printType(builder, pad, types.next()); builder.append(""); return builder.toString(); } public static void printElement(StringBuilder builder, int pad, ParticleBinding particle) { ElementBinding element = (ElementBinding) particle.getTerm(); pad(builder, pad); builder.append(""); if (type != null && type.getQName() == null) printAnonymousType(builder, pad + 3, type); pad(builder, pad); builder.append(""); } public static void printAnonymousType(StringBuilder builder, int pad, TypeBinding type) { pad(builder, pad); builder.append(""); TypeBinding baseTypeBinding = type.getBaseType(); String qName; if (baseTypeBinding != null) qName = baseTypeBinding.getQName().toString(); else qName = "xsd:anyType"; pad(builder, pad); builder.append(" "); printTypeInfo(builder, pad+6, type); pad(builder, pad); builder.append(" "); pad(builder, pad); builder.append(""); } public static void printType(StringBuilder builder, int pad, TypeBinding type) { if (type.isSimple()) printSimpleType(builder, pad, type); else printComplexType(builder, pad, type); } public static void printSimpleType(StringBuilder builder, int pad, TypeBinding type) { pad(builder, pad); builder.append(""); printTypeInfo(builder, pad+3, type); pad(builder, pad); builder.append(""); } public static void printComplexType(StringBuilder builder, int pad, TypeBinding type) { pad(builder, pad); builder.append(""); printTypeInfo(builder, pad+3, type); pad(builder, pad); builder.append(""); } @SuppressWarnings("unchecked") public static void printTypeInfo(StringBuilder builder, int pad, TypeBinding type) { ParticleBinding particle = type.getParticle(); if (particle != null) { printParticle(builder, pad, particle); } Collection attributes = type.getAttributes(); if (attributes != null) { for (AttributeBinding attribute : attributes) { printAttribute(builder, pad, attribute); } } } public static void printParticle(StringBuilder builder, int pad, ParticleBinding particle) { TermBinding term = particle.getTerm(); if (term instanceof ElementBinding) printElement(builder, pad, particle); else if (term instanceof WildcardBinding) printWildcard(builder, pad, particle); else if (term instanceof SequenceBinding) printModel(builder, pad, particle, "sequence"); else if (term instanceof AllBinding) printModel(builder, pad, particle, "all"); else if (term instanceof ChoiceBinding) printModel(builder, pad, particle, "choice"); } @SuppressWarnings("unchecked") public static void printModel(StringBuilder builder, int pad, ParticleBinding particle, String prefix) { pad(builder, pad); builder.append("<").append(prefix); int minOccurs = particle.getMinOccurs(); if (minOccurs != 1) builder.append(" minOccurs=\"").append(minOccurs).append("\""); int maxOccurs = particle.getMaxOccurs(); if (maxOccurs != 1) { builder.append(" maxOccurs=\""); if (maxOccurs == -1) builder.append("unbounded"); else builder.append(maxOccurs); builder.append("\""); } builder.append(">"); ModelGroupBinding model = (ModelGroupBinding) particle.getTerm(); Collection particles = model.getParticles(); boolean newLine = true; if (particles != null) { for (ParticleBinding component : particles) printParticle(builder, pad+3, component); } else { newLine = false; } pad(builder, pad, newLine); builder.append(""); } public static void printWildcard(StringBuilder builder, int pad, ParticleBinding particle) { pad(builder, pad); builder.append(""); } public static void printAttribute(StringBuilder builder, int pad, AttributeBinding attribute) { pad(builder, pad); TypeBinding typeBinding = attribute.getType(); String qName = null; if (typeBinding != null && typeBinding.getQName() != null) qName = typeBinding.getQName().toString(); else qName = "CDATA"; builder.append(""); } public static void pad(StringBuilder builder, int pad) { pad(builder, pad, true); } public static void pad(StringBuilder builder, int pad, boolean newLine) { if (newLine) builder.append("\n"); for (int i = 0; i < pad; ++ i) builder.append(' '); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/0000755000175000017500000000000011620316744027612 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/test/0000755000175000017500000000000011620316744030571 5ustar twernertwerner././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/test/BasicBindingValidatorUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/test/BasicBindingV0000644000175000017500000003234111260156052033153 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.validator.test; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.sunday.unmarshalling.AllBinding; import org.jboss.xb.binding.sunday.unmarshalling.AnyAttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.util.DefaultSchemaBindingValidator; import org.jboss.xb.util.SchemaBindingValidator; import org.xml.sax.InputSource; /** * A BasicBindingValidatorUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class BasicBindingValidatorUnitTestCase extends AbstractBuilderTest { public BasicBindingValidatorUnitTestCase(String name) { super(name); } private SchemaBinding schema; private Map handlerByMsg; SchemaBindingValidator validator = new DefaultSchemaBindingValidator() { /* protected void log(String msg) { System.out.println(msg); } */ }; public void setUp() throws Exception { super.setUp(); schema = new SchemaBinding(); handlerByMsg = new HashMap(); //validator.enableLogging(true); // this is basically handlers for each error that occurs and that build the schema binding from scratch new AbstractErrorHandler("TypeBinding {urn:jboss:xb:test}excludedType is not found in the SchemaBinding.") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { validator.excludeType(new QName("urn:jboss:xb:test", "excludedType")); } }; new AbstractErrorHandler("TypeBinding {urn:jboss:xb:test}attributesType is not found in the SchemaBinding.") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { TypeBinding type = new TypeBinding(new QName("urn:jboss:xb:test", "attributesType")); schema.addType(type); } }; new AbstractErrorHandler("Attribute attr1 is not found in TypeBinding {urn:jboss:xb:test}attributesType") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { TypeBinding type = schema.getType(new QName("urn:jboss:xb:test", "attributesType")); AttributeBinding attr = new AttributeBinding(schema, new QName("attr1"), schema.getType(Constants.QNAME_STRING), null); type.addAttribute(attr); } }; new AbstractErrorHandler("TypeBinding {urn:jboss:xb:test}choiceType is not found in the SchemaBinding.") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { TypeBinding type = new TypeBinding(new QName("urn:jboss:xb:test", "choiceType")); schema.addType(type); ChoiceBinding choice = new ChoiceBinding(schema); type.setParticle(new ParticleBinding(choice)); } }; new AbstractErrorHandler("ModelGroupBinding expected to have 3 particle(s) but has 0") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { TypeBinding type = schema.getType(new QName("urn:jboss:xb:test", "choiceType")); ParticleBinding particle = type.getParticle(); ChoiceBinding choice = (ChoiceBinding) particle.getTerm(); ElementBinding e = new ElementBinding(schema, new QName("urn:jboss:xb:test", "choice1"), schema.getType(Constants.QNAME_STRING)); choice.addParticle(new ParticleBinding(e)); e = new ElementBinding(schema, new QName("urn:jboss:xb:test", "choice2"), schema.getType(Constants.QNAME_STRING)); choice.addParticle(new ParticleBinding(e)); SequenceBinding sequence = new SequenceBinding(schema); choice.addParticle(new ParticleBinding(sequence)); //e = new ElementBinding(schema, new QName("urn:jboss:xb:test", "choice4"), schema.getType(Constants.QNAME_STRING)); e = new ElementBinding(schema, new QName("urn:jboss:xb:test", "choice3_1"), schema.getType(Constants.QNAME_STRING)); sequence.addParticle(new ParticleBinding(e)); //e = new ElementBinding(schema, new QName("urn:jboss:xb:test", "choice3"), schema.getType(Constants.QNAME_STRING)); e = new ElementBinding(schema, new QName("urn:jboss:xb:test", "choice3_2"), schema.getType(Constants.QNAME_STRING)); sequence.addParticle(new ParticleBinding(e)); } }; /* new AbstractErrorHandler("ElementBinding {urn:jboss:xb:test}choice3 is missing: [{urn:jboss:xb:test}choice1, {urn:jboss:xb:test}choice2, {urn:jboss:xb:test}choice3_2, {urn:jboss:xb:test}choice3_1]") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { TypeBinding type = schema.getType(new QName("urn:jboss:xb:test", "choiceType")); ParticleBinding particle = type.getParticle(); ChoiceBinding choice = (ChoiceBinding) particle.getTerm(); SequenceBinding sequence = null; for(ParticleBinding p : choice.getParticles()) { if(p.getTerm().isModelGroup()) sequence = (SequenceBinding) p.getTerm(); } if(sequence == null) throw new IllegalStateException("sequence not found in choice"); assertEquals(2, sequence.getParticles().size()); Iterator iterator = sequence.getParticles().iterator(); ParticleBinding p = iterator.next(); p.setTerm(new ElementBinding(schema, new QName("urn:jboss:xb:test", "choice3_1"), schema.getType(Constants.QNAME_STRING))); p = iterator.next(); p.setTerm(new ElementBinding(schema, new QName("urn:jboss:xb:test", "choice3_2"), schema.getType(Constants.QNAME_STRING))); } }; */ new AbstractErrorHandler("TypeBinding {urn:jboss:xb:test}aComplexType is not found in the SchemaBinding.") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { TypeBinding type = new TypeBinding(new QName("urn:jboss:xb:test", "aComplexType")); schema.addType(type); } }; new AbstractErrorHandler("TypeBinding {urn:jboss:xb:test}aComplexType doesn't have AnyAttributeBinding") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { TypeBinding type = schema.getType(new QName("urn:jboss:xb:test", "aComplexType")); type.setAnyAttribute(new AnyAttributeBinding(schema, null)); } }; new AbstractErrorHandler("TypeBinding {urn:jboss:xb:test}aComplexType doesn't contain a ParticleBinding.") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { TypeBinding type = schema.getType(new QName("urn:jboss:xb:test", "aComplexType")); ParticleBinding particle = new ParticleBinding(new ChoiceBinding(schema)); type.setParticle(particle); } }; new AbstractErrorHandler("ModelGroupBinding expected to be a sequence but was choice:") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { TypeBinding type = schema.getType(new QName("urn:jboss:xb:test", "aComplexType")); ParticleBinding particle = type.getParticle(); particle.setTerm(new SequenceBinding(schema)); } }; new AbstractErrorHandler("ModelGroupBinding expected to have 1 particle(s) but has 0") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { TypeBinding type = schema.getType(new QName("urn:jboss:xb:test", "aComplexType")); ParticleBinding particle = type.getParticle(); ModelGroupBinding group = (ModelGroupBinding) particle.getTerm(); group.addParticle(new ParticleBinding(new AllBinding(schema))); } }; new AbstractErrorHandler("TermBinding expected to be a wildcard but was all:") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { TypeBinding type = schema.getType(new QName("urn:jboss:xb:test", "aComplexType")); ParticleBinding particle = type.getParticle(); //ModelGroupBinding group = (ModelGroupBinding) particle.getTerm(); //group.getParticles().clear(); SequenceBinding group = new SequenceBinding(schema); particle.setTerm(group); WildcardBinding wildcard = new WildcardBinding(schema); group.addParticle(new ParticleBinding(wildcard)); } }; new AbstractErrorHandler("Wildcard processContents doesn't match: XSD processContents is 3, WildcardBinding processContents is 1") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { TypeBinding type = schema.getType(new QName("urn:jboss:xb:test", "aComplexType")); ParticleBinding particle = type.getParticle(); SequenceBinding group = (SequenceBinding) particle.getTerm(); particle = group.getParticles().iterator().next(); WildcardBinding wildcard = (WildcardBinding) particle.getTerm(); wildcard.setProcessContents((short) 3); } }; new AbstractErrorHandler("XSD particle of wildcard has maxOccurs unbounded but ParticleBinding of wildcard processContents=lax does not.") { public void handle(SchemaBindingValidator validator, SchemaBinding schema) { TypeBinding type = schema.getType(new QName("urn:jboss:xb:test", "aComplexType")); ParticleBinding particle = type.getParticle(); SequenceBinding group = (SequenceBinding) particle.getTerm(); particle = group.getParticles().iterator().next(); particle.setMaxOccursUnbounded(true); } }; } public void testMain() throws Exception { String xsd = findXML("BasicBindingValidatorUnitTestCase.xsd"); InputSource xsdIs = new InputSource(xsd); boolean retry = true; while(retry) { try { validator.validate(xsdIs, schema); retry = false; } catch(IllegalStateException e) { ErrorHandler handler = handlerByMsg.remove(e.getMessage()); if(handler == null) fail("unexpected error: " + e.getMessage()); handler.handle(validator, schema); } } if(!handlerByMsg.isEmpty()) fail("Not all the expected errors have been caught: " + handlerByMsg.keySet()); } private void addErrorHandler(ErrorHandler handler) { handlerByMsg.put(handler.getMessage(), handler); } private abstract class AbstractErrorHandler implements ErrorHandler { private final String msg; public AbstractErrorHandler(String msg) { this.msg = msg; addErrorHandler(this); } public String getMessage() { return msg; } } public interface ErrorHandler { String getMessage(); void handle(SchemaBindingValidator validator, SchemaBinding schema); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/test/ValidatingResolverUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/test/ValidatingRes0000644000175000017500000000702511225350072033245 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.validator.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.validator.support.EE2Root; import org.jboss.test.xb.validator.support.ValidatorTestRoot; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.builder.JBossXBBuilder; /** * A ValidatingResolverUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ValidatingResolverUnitTestCase extends AbstractBuilderTest { public ValidatingResolverUnitTestCase(String name) { super(name); } public void testInvalidBinding() throws Exception { MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); resolver.mapURIToClass("urn:jboss:xb:test", EE2Root.class); String xsd = findXML("ValidatingResolverUnitTestCase.xsd"); resolver.mapSchemaLocation("urn:jboss:xb:test", xsd); resolver.setValidateBinding(true); try { unmarshal("ValidatingResolverUnitTestCase.xml", EE2Root.class, resolver); fail("Validation expected to fail"); } catch(JBossXBException e) { String msg = e.getCause().getMessage(); if(JBossXBBuilder.isUseUnorderedSequence()) { // ordering hack boolean check = "ElementBinding {urn:jboss:xb:test}e is missing: [{urn:jboss:xb:test}e2, {urn:jboss:xb:test}e1]".equals(msg); check |= "ElementBinding {urn:jboss:xb:test}e is missing: [{urn:jboss:xb:test}e1, {urn:jboss:xb:test}e2]".equals(msg); assertTrue(check); } else { assertEquals("Compared elements have different names: XSD QName is {urn:jboss:xb:test}e1, ElementBinding QName is {urn:jboss:xb:test}e", msg); } } } public void testValidBinding() throws Exception { MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); resolver.mapURIToClass("urn:jboss:xb:test", ValidatorTestRoot.class); String xsd = findXML("ValidatingResolverUnitTestCase.xsd"); resolver.mapSchemaLocation("urn:jboss:xb:test", xsd); resolver.setValidateBinding(true); ValidatorTestRoot root = (ValidatorTestRoot) unmarshal("ValidatingResolverUnitTestCase.xml", ValidatorTestRoot.class, resolver); assertEquals("1", root.getE1()); assertEquals("2", root.getE2()); } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/test/ComplexTypeEquivalentToSimpleUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/test/ComplexTypeEq0000644000175000017500000000407211260156052033250 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.validator.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.validator.support.ValidatorTestRoot; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.util.DefaultSchemaBindingValidator; import org.xml.sax.InputSource; /** * A ImportedSchemaUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ComplexTypeEquivalentToSimpleUnitTestCase extends AbstractBuilderTest { public ComplexTypeEquivalentToSimpleUnitTestCase(String name) { super(name); } public void testMain() throws Exception { String xsd = findXML("ComplexTypeEquivalentToSimpleUnitTestCase.xsd"); InputSource xsdIs = new InputSource(xsd); SchemaBinding schema = JBossXBBuilder.build(ValidatorTestRoot.class); DefaultSchemaBindingValidator validator = new DefaultSchemaBindingValidator(); validator.validate(xsdIs, schema); } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/test/JavaBeanBindingValidationUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/test/JavaBeanBindi0000644000175000017500000000554211260156126033133 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.validator.test; import java.io.InputStream; import javax.xml.namespace.QName; import org.jboss.javabean.plugins.jaxb.JavaBean10; import org.jboss.javabean.plugins.jaxb.JavaBean20; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.util.DefaultSchemaBindingValidator; import org.xml.sax.InputSource; /** * A JavaBean10BindingValidationUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class JavaBeanBindingValidationUnitTestCase extends AbstractBuilderTest { public JavaBeanBindingValidationUnitTestCase(String name) { super(name); } public void testJavaBean10() throws Exception { InputStream xsd = Thread.currentThread().getContextClassLoader().getResourceAsStream("schema/javabean_1_0.xsd"); assertNotNull(xsd); InputSource xsdIs = new InputSource(xsd); SchemaBinding schema = JBossXBBuilder.build(JavaBean10.class); DefaultSchemaBindingValidator validator = new DefaultSchemaBindingValidator(); validator.excludeType(new QName("urn:jboss:javabean:1.0", "valueType")); validator.validate(xsdIs, schema); } public void testJavaBean20() throws Exception { InputStream xsd = Thread.currentThread().getContextClassLoader().getResourceAsStream("schema/javabean_2_0.xsd"); assertNotNull(xsd); InputSource xsdIs = new InputSource(xsd); SchemaBinding schema = JBossXBBuilder.build(JavaBean20.class); DefaultSchemaBindingValidator validator = new DefaultSchemaBindingValidator(); validator.excludeType(new QName("urn:jboss:javabean:2.0", "valueType")); validator.validate(xsdIs, schema); } } ././@LongLink0000000000000000000000000000021300000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/test/UnboundedChoiceAsUnorderedSequenceUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/test/UnboundedChoi0000644000175000017500000000414511236262462033246 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.validator.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.validator.support.UnorderedSequenceType; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.util.DefaultSchemaBindingValidator; import org.xml.sax.InputSource; /** * A UnboundedChoiceAsUnorderedSequenceUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class UnboundedChoiceAsUnorderedSequenceUnitTestCase extends AbstractBuilderTest { public UnboundedChoiceAsUnorderedSequenceUnitTestCase(String name) { super(name); } public void testMain() throws Exception { String xsd = findXML("UnboundedChoiceAsUnorderedSequenceUnitTestCase.xsd"); InputSource xsdIs = new InputSource(xsd); SchemaBinding schema = JBossXBBuilder.build(UnorderedSequenceType.class); DefaultSchemaBindingValidator validator = new DefaultSchemaBindingValidator(); validator.validate(xsdIs, schema); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/test/ImportedSchemaUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/test/ImportedSchem0000644000175000017500000000455511237042710033261 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.validator.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xb.validator.support.ImportedSchema; import org.jboss.test.xb.validator.support.ImportingSchema; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.resolver.MutableSchemaResolver; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.util.DefaultSchemaBindingValidator; import org.xml.sax.InputSource; /** * A ImportedSchemaUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ImportedSchemaUnitTestCase extends AbstractBuilderTest { public ImportedSchemaUnitTestCase(String name) { super(name); } public void testMain() throws Exception { String xsd = findXML("ImportedSchemaUnitTestCase.xsd"); InputSource xsdIs = new InputSource(xsd); SchemaBinding schema = JBossXBBuilder.build(ImportingSchema.class); MutableSchemaResolver resolver = new MultiClassSchemaResolver(); resolver.mapURIToClass("urn:jboss:xb:test:imported", ImportedSchema.class); DefaultSchemaBindingValidator validator = new DefaultSchemaBindingValidator(resolver); validator.validate(xsdIs, schema); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/support/0000755000175000017500000000000011620316744031326 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/support/ImportingSchema.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/support/ImportingS0000644000175000017500000000316211237042710033337 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.validator.support; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlSchema; /** * A ImportingSchema. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(namespace="urn:jboss:xb:test:importing", elementFormDefault=XmlNsForm.QUALIFIED) @XmlRootElement(name="root") public class ImportingSchema { private String a; public String getA() { return a; } public void setA(String a) { this.a = a; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/support/ImportedSchema.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/support/ImportedSc0000644000175000017500000000315711237042710033321 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.validator.support; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlSchema; /** * A ImportedSchema. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(namespace="urn:jboss:xb:test:imported", elementFormDefault=XmlNsForm.QUALIFIED) @XmlRootElement(name="root") public class ImportedSchema { private String a; public String getA() { return a; } public void setA(String a) { this.a = a; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/support/UnorderedSequenceType.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/support/UnorderedS0000644000175000017500000000403711236262462033327 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.validator.support; import java.util.Collection; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlSchema; import org.jboss.xb.annotations.JBossXmlType; /** * A UnorderedSequenceType. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(namespace="urn:jboss:xb:test", elementFormDefault=XmlNsForm.QUALIFIED) @XmlRootElement(name="root") @JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE) public class UnorderedSequenceType { private Collection a; private Collection b; public Collection getA() { return a; } public void setA(Collection a) { this.a = a; } public Collection getB() { return b; } public void setB(Collection b) { this.b = b; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/support/EE2Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/support/EE2Root.ja0000644000175000017500000000337411211712067033062 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.validator.support; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlSchema; /** * A ValidatorTestRoot. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(namespace="urn:jboss:xb:test", elementFormDefault=XmlNsForm.QUALIFIED) @XmlRootElement(name="root", namespace="urn:jboss:xb:test") @XmlType(propOrder={"e1", "e2"}, name="") public class EE2Root extends ValidatorTestRoot { @XmlElement(name="e") public String getE1() { return super.getE1(); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/support/ValidatorTestRoot.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xb/validator/support/ValidatorT0000644000175000017500000000372011211712067033316 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xb.validator.support; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlSchema; /** * A AbstractValidatorTestRoot. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlSchema(namespace="urn:jboss:xb:test", elementFormDefault=XmlNsForm.QUALIFIED) @XmlRootElement(name="root", namespace="urn:jboss:xb:test") @XmlType(propOrder={"e1", "e2"}, name="") public class ValidatorTestRoot { private String e1; private String e2; public ValidatorTestRoot() { super(); } public String getE1() { return e1; } public void setE1(String e1) { this.e1 = e1; } public String getE2() { return e2; } public void setE2(String e2) { this.e2 = e2; } }libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/0000755000175000017500000000000011620316743026013 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/XsiTypeUnitTestCase.java0000644000175000017500000004417411062436763032576 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.io.StringWriter; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.sunday.unmarshalling.LSInputAdaptor; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.w3c.dom.ls.LSInput; /** * @author Alexey Loubyansky * @version $Revision: 45337 $ */ public class XsiTypeUnitTestCase extends AbstractJBossXBTest { private static final String PO_NS = "http://www.example.com/IPO"; private static final String ADDRESS_XSD = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; private static final String ONE_ADDRESS_XSD = "" + " " + " " + ""; private static final String ONE_ADDRESS_XML = "" + " Helen Zoe" + " 47 Eden Street" + " Cambridge" + " CB1 1JR" + ""; private static final String PO_XSD = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; private static final String PO_XML = "" + " " + " Helen Zoe" + " 47 Eden Street" + " Cambridge" + " CB1 1JR" + " " + " " + " Robert Smith" + " 8 Oak Avenue" + " Old Town" + " PA" + " 95819" + " " + ""; private static final String COLLECTION_XSD = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; private static final String COLLECTION_XML = "" + "
" + " Robert Smith" + " 8 Oak Avenue" + " Old Town" + " PA" + " 95819" + "
" + "
" + " Helen Zoe" + " 47 Eden Street" + " Cambridge" + " CB1 1JR" + "
" + ""; private static final SchemaBindingResolver SCHEMA_RESOLVER = new SchemaBindingResolver() { public String getBaseURI() { throw new UnsupportedOperationException("getBaseURI is not implemented."); } public void setBaseURI(String baseURI) { throw new UnsupportedOperationException("setBaseURI is not implemented."); } public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation) { throw new UnsupportedOperationException("resolve is not implemented."); } public LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation) { if(schemaLocation.endsWith("address.xsd")) { return new LSInputAdaptor(new StringReader(ADDRESS_XSD), null); } return null; } }; public XsiTypeUnitTestCase(String name) { super(name); } protected void configureLogging() { } public void testUnmarshalling() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(PO_XSD), null, SCHEMA_RESOLVER); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(PO_XML), schema); assertEquals(PurchaseOrder.INSTANCE, o); } public void testMarshallingXerces() throws Exception { XercesXsMarshaller marshaller = new XercesXsMarshaller(); marshaller.setSchemaResolver(SCHEMA_RESOLVER); marshaller.mapClassToXsiType(UKAddress.class, PO_NS, "UKAddress"); marshaller.mapClassToXsiType(USAddress.class, PO_NS, "USAddress"); MappingObjectModelProvider provider = new MappingObjectModelProvider(); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(PO_XSD), provider, PurchaseOrder.INSTANCE, writer); assertXmlEqual(PO_XML, writer.getBuffer().toString()); } public void testMarshallingSunday() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(PO_XSD), null, SCHEMA_RESOLVER); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.setSchemaResolver(SCHEMA_RESOLVER); marshaller.mapClassToXsiType(UKAddress.class, PO_NS, "UKAddress"); marshaller.mapClassToXsiType(USAddress.class, PO_NS, "USAddress"); StringWriter writer = new StringWriter(); marshaller.marshal(schema, null, PurchaseOrder.INSTANCE, writer); assertXmlEqual(PO_XML, writer.getBuffer().toString()); } public void testUnmarshalCollection() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(COLLECTION_XSD), null, SCHEMA_RESOLVER); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(COLLECTION_XML), schema); assertNotNull(o); assertTrue(o instanceof PurchaseOrder); PurchaseOrder po = (PurchaseOrder) o; assertNotNull(po.address); assertEquals(2, po.address.length); if(po.address[0] instanceof UKAddress) { assertEquals(PurchaseOrder.INSTANCE.shipTo, po.address[0]); assertEquals(PurchaseOrder.INSTANCE.billTo, po.address[1]); } else { assertEquals(PurchaseOrder.INSTANCE.shipTo, po.address[1]); assertEquals(PurchaseOrder.INSTANCE.billTo, po.address[0]); } } public void testMarshalCollectionSunday() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(COLLECTION_XSD), null, SCHEMA_RESOLVER); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.setSchemaResolver(SCHEMA_RESOLVER); marshaller.mapClassToXsiType(UKAddress.class, PO_NS, "UKAddress"); marshaller.mapClassToXsiType(USAddress.class, PO_NS, "USAddress"); StringWriter writer = new StringWriter(); PurchaseOrder po = new PurchaseOrder(); po.address = new Address[2]; po.address[0] = PurchaseOrder.INSTANCE.billTo; po.address[1] = PurchaseOrder.INSTANCE.shipTo; marshaller.marshal(schema, null, po, writer); assertXmlEqual(COLLECTION_XML, writer.getBuffer().toString()); } public void testOneAddressUnmarshalling() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(ONE_ADDRESS_XSD), null, SCHEMA_RESOLVER); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(ONE_ADDRESS_XML), schema); assertEquals(PurchaseOrder.INSTANCE.shipTo, o); } public void testOneAddressMarshalling() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(ONE_ADDRESS_XSD), null, SCHEMA_RESOLVER); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.setSchemaResolver(SCHEMA_RESOLVER); marshaller.mapClassToXsiType(UKAddress.class, PO_NS, "UKAddress"); StringWriter writer = new StringWriter(); marshaller.marshal(schema, null, PurchaseOrder.INSTANCE.shipTo, writer); assertXmlEqual(ONE_ADDRESS_XML, writer.getBuffer().toString()); } // Inner public static final class PurchaseOrder { public static final PurchaseOrder INSTANCE = new PurchaseOrder(); static { UKAddress ukAddr = new UKAddress(); ukAddr.name = "Helen Zoe"; ukAddr.street = "47 Eden Street"; ukAddr.city = "Cambridge"; ukAddr.postcode = "CB1 1JR"; ukAddr.exportCode = "1"; INSTANCE.shipTo = ukAddr; USAddress usAddr = new USAddress(); usAddr.name = "Robert Smith"; usAddr.street = "8 Oak Avenue"; usAddr.city = "Old Town"; usAddr.state = "PA"; usAddr.zip = "95819"; INSTANCE.billTo = usAddr; } public Address shipTo; public Address billTo; public Address[] address; //for collection test public String toString() { return "[shipTo=" + shipTo + ", billTo=" + billTo + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof PurchaseOrder)) { return false; } final PurchaseOrder purchaseOrder = (PurchaseOrder)o; if(billTo != null ? !billTo.equals(purchaseOrder.billTo) : purchaseOrder.billTo != null) { return false; } if(shipTo != null ? !shipTo.equals(purchaseOrder.shipTo) : purchaseOrder.shipTo != null) { return false; } return true; } public int hashCode() { int result; result = (shipTo != null ? shipTo.hashCode() : 0); result = 29 * result + (billTo != null ? billTo.hashCode() : 0); return result; } } public static class Address { public String name; public String street; public String city; public String toString() { return "name=" + name + ", street=" + street + ", city=" + city; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Address)) { return false; } final Address address = (Address)o; if(city != null ? !city.equals(address.city) : address.city != null) { return false; } if(name != null ? !name.equals(address.name) : address.name != null) { return false; } if(street != null ? !street.equals(address.street) : address.street != null) { return false; } return true; } public int hashCode() { int result; result = (name != null ? name.hashCode() : 0); result = 29 * result + (street != null ? street.hashCode() : 0); result = 29 * result + (city != null ? city.hashCode() : 0); return result; } } public static final class USAddress extends Address { public String state; public String zip; public String toString() { return super.toString() + ", state=" + state + ", zip=" + zip; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof USAddress)) { return false; } if(!super.equals(o)) { return false; } final USAddress usAddress = (USAddress)o; if(state != null ? !state.equals(usAddress.state) : usAddress.state != null) { return false; } if(zip != null ? !zip.equals(usAddress.zip) : usAddress.zip != null) { return false; } return true; } public int hashCode() { int result = super.hashCode(); result = 29 * result + (state != null ? state.hashCode() : 0); result = 29 * result + (zip != null ? zip.hashCode() : 0); return result; } } public static final class UKAddress extends Address { public String postcode; public String exportCode; public String toString() { return super.toString() + ", postcode=" + postcode + ", exportCode=" + exportCode; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof UKAddress)) { return false; } if(!super.equals(o)) { return false; } final UKAddress ukAddress = (UKAddress)o; if(exportCode != null ? !exportCode.equals(ukAddress.exportCode) : ukAddress.exportCode != null) { return false; } if(postcode != null ? !postcode.equals(ukAddress.postcode) : ukAddress.postcode != null) { return false; } return true; } public int hashCode() { int result = super.hashCode(); result = 29 * result + (postcode != null ? postcode.hashCode() : 0); result = 29 * result + (exportCode != null ? exportCode.hashCode() : 0); return result; } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/0000755000175000017500000000000011620316737030214 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/deployment/0000755000175000017500000000000011620316736032373 5ustar twernertwerner././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/deployment/AbstractKernelDeployment.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/deployment/Abstr0000644000175000017500000000401111061473704033363 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.deployment; import java.util.List; import org.jboss.test.xml.pojoserver.metadata.AbstractBeanMetaData; /** * An abstract kernel deployment. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class AbstractKernelDeployment { /** The name of the deployment */ protected String name; /** The beans List */ protected List beans; /** * Create a new kernel deployment */ public AbstractKernelDeployment() { } /** * Set the beans. * * @param beans a List. */ public void setBeans(List beans) { this.beans = beans; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List getBeans() { return beans; } }libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/0000755000175000017500000000000011620316737031774 5ustar twernertwerner././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/SupplyMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/SupplyM0000644000175000017500000000304110513427451033322 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public interface SupplyMetaData extends FeatureMetaData { // Constants ----------------------------------------------------- // Public -------------------------------------------------------- /** * Get what is supplied * * @return the supply */ Object getSupply(); // Inner classes ------------------------------------------------- } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/MetaDataVisitorNode.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/MetaDat0000644000175000017500000000324311061473704033235 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.Iterator; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public interface MetaDataVisitorNode { // Constants ----------------------------------------------------- // Public -------------------------------------------------------- /** * Visit the node * * @param vistor the visitor */ public void visit(MetaDataVisitor vistor); /** * Return the child nodes * * @return Iterator or null if there aren't any */ public Iterator getChildren(); } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/DataTypeConverter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/DataTyp0000644000175000017500000000267710513427451033275 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import javax.xml.namespace.NamespaceContext; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class DataTypeConverter { public static Object unmarshalStringValue(String text, NamespaceContext nsCtx) { return text == null ? null : new StringValueMetaData(text); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractConstructorMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000001067011061473704033277 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public class AbstractConstructorMetaData extends AbstractFeatureMetaData implements ConstructorMetaData { // Constants ----------------------------------------------------- // Attributes ---------------------------------------------------- /** The paramaters List */ protected List parameters; /** The factory */ protected ValueMetaData factory; /** The factory class name */ protected String factoryClassName; /** The factory method */ protected String factoryMethod; // Static -------------------------------------------------------- // Constructors -------------------------------------------------- /** * Create a new constructor meta data */ public AbstractConstructorMetaData() { } // Public -------------------------------------------------------- /** * Set the parameters * * @param parameters List */ public void setParameters(List parameters) { this.parameters = parameters; } /** * Set the factory * * @param factory the factory */ public void setFactory(ValueMetaData factory) { this.factory = factory; } /** * Set the factory class name * * @param name the factory class name */ public void setFactoryClass(String name) { this.factoryClassName = name; } /** * Set the factory method * * @param name the factory method */ public void setFactoryMethod(String name) { this.factoryMethod = name; } // ConstructorMetaData implementation ---------------------------- public List getParameters() { return parameters; } public ValueMetaData getFactory() { return factory; } public String getFactoryClass() { return factoryClassName; } public String getFactoryMethod() { return factoryMethod; } // MetaDataVisitorNode overrides ---------------------------------- public Iterator getChildren() { ArrayList list = new ArrayList(); if (parameters != null) list.addAll(parameters); if (factory != null) list.add(factory); return list.iterator(); } // JBossObject overrides ------------------------------------------ public void toString(StringBuffer buffer) { buffer.append("parameters=").append(parameters); if (factory != null) buffer.append(" factory=").append(factory); if (factoryClassName != null) buffer.append(" factoryClass=").append(factoryClassName); if (factoryMethod != null) buffer.append(" factoryMethod=").append(factoryMethod); super.toString(buffer); } // Package protected --------------------------------------------- // Protected ----------------------------------------------------- // Private ------------------------------------------------------- // Inner classes ------------------------------------------------- } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AnnotationMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Annotat0000644000175000017500000000335611061473704033327 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.Set; /** * Metadata about an annotation attribute. * * @author Adrian Brock * @version $Revision: 37406 $ */ public interface AnnotationMetaData { // Constants ----------------------------------------------------- // Public -------------------------------------------------------- /** * Get the name * * @return the name */ String getName(); /** * Get the annotation attributes. * * @return Set. */ Set getAttributes(); // Inner classes ------------------------------------------------- } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractLifecycleMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000463711061473704033305 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.List; /** * Metadata for lifecycle. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class AbstractLifecycleMetaData extends AbstractFeatureMetaData implements LifecycleMetaData { /** The state */ protected ControllerState state; /** The method name */ protected String methodName; /** The paramaters List */ protected List parameters; /** * Create a new lifecycle meta data */ public AbstractLifecycleMetaData() { } public ControllerState getState() { return state; } public void setState(ControllerState state) { this.state = state; } public String getMethodName() { return methodName; } /** * Set the method name * * @param name the factory method */ public void setMethodName(String name) { this.methodName = name; } public List getParameters() { return parameters; } /** * Set the parameters * * @param parameters List */ public void setParameters(List parameters) { this.parameters = parameters; } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractAnnotationAttributeMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000712410513427451033276 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * Metadata for an annotation attribute. * * @author Adrian Brock * @version $Revision: 38009 $ */ public class AbstractAnnotationAttributeMetaData implements AnnotationAttributeMetaData { // Constants ----------------------------------------------------- // Attributes ---------------------------------------------------- /** The attribute name */ protected String name; /** The attribute value */ protected ValueMetaData value; // Static -------------------------------------------------------- // Constructors -------------------------------------------------- /** * Create a new annotation attribute meta data */ public AbstractAnnotationAttributeMetaData() { } /** * Create a new annotation meta data * * @param name the name * @param value the value */ public AbstractAnnotationAttributeMetaData(String name, Object value) { this.name = name; this.value = new AbstractValueMetaData(value); } /** * Create a new annotation meta data * * @param name the name * @param value the string value */ public AbstractAnnotationAttributeMetaData(String name, String value) { this.name = name; this.value = new StringValueMetaData(value); } /** * Create a new annotation meta data * * @param name the name * @param value the value meta data */ public AbstractAnnotationAttributeMetaData(String name, ValueMetaData value) { this.name = name; this.value = value; } // Public -------------------------------------------------------- /** * Set the name * * @param name the name */ public void setName(String name) { this.name = name; } /** * Set the value * * @param value the value */ public void setValue(ValueMetaData value) { this.value = value; } // AnnotationAttributeMetaData implementation -------------------- public String getName() { return name; } public ValueMetaData getValue() { return value; } // Package protected --------------------------------------------- // Protected ----------------------------------------------------- // Private ------------------------------------------------------- // Inner classes ------------------------------------------------- } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractArrayMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000256110513427451033276 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * Array metadata. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class AbstractArrayMetaData extends AbstractListMetaData { /** * Create a new array value */ public AbstractArrayMetaData() { } }././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AnnotationAttributeMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Annotat0000644000175000017500000000326410513427451033324 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * Metadata about an annotation. * * @author Adrian Brock * @version $Revision: 37406 $ */ public interface AnnotationAttributeMetaData { // Constants ----------------------------------------------------- // Public -------------------------------------------------------- /** * Get the name * * @return the name */ String getName(); /** * Get the value. * * @return the value. */ ValueMetaData getValue(); // Inner classes ------------------------------------------------- } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/ControllerStateDataTypeConverter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Control0000644000175000017500000000266110513427451033340 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import javax.xml.namespace.NamespaceContext; /** * @author Adrian Brock * @version $Revision: 37406 $ */ public class ControllerStateDataTypeConverter { public static Object unmarshalStringValue(String text, NamespaceContext nsCtx) { return new ControllerState(text); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractPropertyMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000756710513427451033311 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.Iterator; import java.util.Collections; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public class AbstractPropertyMetaData extends AbstractFeatureMetaData implements PropertyMetaData { // Constants ----------------------------------------------------- // Attributes ---------------------------------------------------- /** The property name */ protected String name; /** The property value */ protected ValueMetaData value; // Static -------------------------------------------------------- // Constructors -------------------------------------------------- /** * Create a new property meta data */ public AbstractPropertyMetaData() { } /** * Create a new property meta data * * @param name the name * @param value the value */ public AbstractPropertyMetaData(String name, Object value) { this.name = name; this.value = new AbstractValueMetaData(value); } /** * Create a new property meta data * * @param name the name * @param value the string value */ public AbstractPropertyMetaData(String name, String value) { this.name = name; this.value = new StringValueMetaData(value); } /** * Create a new attribute meta data * * @param name the name * @param value the value meta data */ public AbstractPropertyMetaData(String name, ValueMetaData value) { this.name = name; this.value = value; } // Public -------------------------------------------------------- // PropertyMetaData implementation ------------------------------- public String getName() { return name; } public void setName(String name) { this.name = name; } public ValueMetaData getValue() { return value; } public void setValue(ValueMetaData value) { this.value = value; } // MetaDataVisitorNode overrides ---------------------------------- public Iterator getChildren() { if (value != null) return Collections.singletonList(value).iterator(); return null; } // JBossObject overrides ------------------------------------------ public void toString(StringBuffer buffer) { buffer.append("name=").append(name); if (value != null) buffer.append(" value=").append(value); super.toString(buffer); } public void toShortString(StringBuffer buffer) { buffer.append(name); } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractValueMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000345210513427451033276 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * Plain value. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class AbstractValueMetaData implements ValueMetaData { /** The value */ protected Object value; /** * Create a new plain value */ public AbstractValueMetaData() { } /** * Create a new plain value * * @param value the value */ public AbstractValueMetaData(Object value) { this.value = value; } public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } public Object getUnderlyingValue() { return value; } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/PropertyInitializer.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Propert0000644000175000017500000000551511356617671033367 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import javax.xml.namespace.QName; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.sunday.unmarshalling.DefaultWildcardHandler; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingInitializer; /** * ContainerInitializer. * * @author Adrian Brock * @version $Revision: 40741 $ */ public class PropertyInitializer implements SchemaBindingInitializer { public static final String NS = "dummy://www.jboss.org/property"; private static final QName propertyQName = new QName(NS, "property"); private static final QName valueQName = new QName(NS, "value"); public SchemaBinding init(SchemaBinding schema) { ElementBinding element = schema.getElement(propertyQName); ClassMetaData classMetaData = new ClassMetaData(); classMetaData.setImpl(AbstractPropertyMetaData.class.getName()); element.setClassMetaData(classMetaData); element.getType().getWildcard().setHandler(new DefaultWildcardHandler() { public void setParent(Object parent, Object o, QName elementName, ElementBinding element, ElementBinding parentElement) { AbstractPropertyMetaData property = (AbstractPropertyMetaData) parent; if (o instanceof ValueMetaData == false) o = new AbstractValueMetaData(o); property.setValue((ValueMetaData) o); } }); element = schema.getElement(valueQName); classMetaData = new ClassMetaData(); classMetaData.setImpl(StringValueMetaData.class.getName()); element.setClassMetaData(classMetaData); return schema; } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractFeatureMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000631011061473704033273 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.Map; import java.util.Iterator; import java.util.concurrent.ConcurrentHashMap; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public class AbstractFeatureMetaData implements FeatureMetaData { /** The description */ protected String description; /** The generic metadata */ protected Map values; // Static -------------------------------------------------------- // Constructors -------------------------------------------------- /** * Create a new meta data */ public AbstractFeatureMetaData() { } // Public -------------------------------------------------------- /** * Set the description. * * @param description the description. */ public void setDescription(String description) { this.description = description; } /** * Set the value. * * @param key the key to the value * @param value The value to set. */ public void setValue(String key, Object value) { if (values == null) values = new ConcurrentHashMap(); values.put(key, value); } // MetaData implementation --------------------------------------- public String getDescription() { return description; } public Object getValue(String key) { if (values == null) return null; return values.get(key); } // MetaDataVisitorNote overrides ---------------------------------- public void visit(MetaDataVisitor visitor) { visitor.visit(this); } public Iterator getChildren() { return null; } // JBossObject overrides ------------------------------------------ public void toString(StringBuffer buffer) { if (description != null) buffer.append("description=").append(description); if (values != null) buffer.append(" values=").append(values); } public void toShortString(StringBuffer buffer) { buffer.append(description); } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractDependencyValueMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000537410513427451033303 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * Dependency value. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class AbstractDependencyValueMetaData extends AbstractValueMetaData { /** The property name */ protected String property; /** The required state of the dependency or null to look in the registry */ protected ControllerState dependentState = ControllerState.INSTALLED; /** * Create a new dependency value */ public AbstractDependencyValueMetaData() { } /** * Create a new dependency value * * @param value the value */ public AbstractDependencyValueMetaData(Object value) { super(value); } /** * Create a new dependency value * * @param value the value * @param property the property */ public AbstractDependencyValueMetaData(Object value, String property) { super(value); this.property = property; } /** * Set the value * * @param value the value */ public void setValue(Object value) { super.setValue(value); } /** * Set the property * * @param property the property name */ public void setProperty(String property) { this.property = property; } /** * Set the required state of the dependency * * @param dependentState the required state or null if it must be in the registry */ public void setDependentState(ControllerState dependentState) { this.dependentState = dependentState; } public ControllerState getDependentState() { return dependentState; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractDemandMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000656010513427451033301 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public class AbstractDemandMetaData extends AbstractFeatureMetaData implements DemandMetaData { // Constants ----------------------------------------------------- // Attributes ---------------------------------------------------- /** The demand */ protected Object demand; /** When the dependency is required */ protected ControllerState whenRequired = ControllerState.DESCRIBED; // Static -------------------------------------------------------- // Constructors -------------------------------------------------- /** * Create a new demand */ public AbstractDemandMetaData() { } /** * Create a new demand * * @param demand the demand */ public AbstractDemandMetaData(Object demand) { this.demand = demand; } /** * Set the required state of the dependency * * @param whenRequired when the dependecy is required */ public void setWhenRequired(ControllerState whenRequired) { this.whenRequired = whenRequired; } // Public -------------------------------------------------------- /** * Set the demand * * @param demand the demand */ public void setDemand(Object demand) { this.demand = demand; } // DemandMetaData implementation --------------------------------- public Object getDemand() { return demand; } public ControllerState getWhenRequired() { return whenRequired; } // JBossObject overrides ----------------------------------------- public void toString(StringBuffer buffer) { buffer.append("demand=").append(demand); if (whenRequired != null) buffer.append(" whenRequired").append(whenRequired.getStateString()); } public void toShortString(StringBuffer buffer) { buffer.append(demand); } // Package protected --------------------------------------------- // Protected ----------------------------------------------------- // Private ------------------------------------------------------- // Inner classes ------------------------------------------------- } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/BeanMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/BeanMet0000644000175000017500000000433211061473704033231 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.Set; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public interface BeanMetaData extends FeatureMetaData { // Constants ----------------------------------------------------- // Public -------------------------------------------------------- /** * Get the bean. * * @return the bean. */ String getBean(); /** * Get the name * * @return the name */ String getName(); /** * Set the name * * @param name the name */ void setName(String name); /** * Get the properties. * * @return List. */ Set getProperties(); /** * Get the constructor * * @return the constructor metadata */ ConstructorMetaData getConstructor(); /** * Get what this bean demands. * * @return Set */ Set getDemands(); /** * Get what this bean supplies. * * @return Set */ Set getSupplies(); } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/FeatureMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Feature0000644000175000017500000000275110513427451033313 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public interface FeatureMetaData extends MetaDataVisitorNode { /** * Get the descrition. * * @return the description. */ String getDescription(); /** * Get the value. * * @param key the key to the value * @return the value. */ Object getValue(String key); } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/DemandMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/DemandM0000644000175000017500000000315710513427451033226 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public interface DemandMetaData extends FeatureMetaData { // Constants ----------------------------------------------------- // Public -------------------------------------------------------- /** * What is demanded * * @return the demand */ Object getDemand(); /** * Get when the dependency is required * * @return when the dependency is required */ ControllerState getWhenRequired(); } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/DependencyMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Depende0000644000175000017500000000260110513427451033256 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * Metadata about what a bean's dependency. * * @author Adrian Brock * @version $Revision: 37406 $ */ public interface DependencyMetaData { /** * What is the dependency * * @return the dependency */ Object getDependency(); } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractCollectionMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000610311061473704033273 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; /** * Collection metadata. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class AbstractCollectionMetaData extends AbstractTypeMetaData implements Collection { /** The collection */ protected ArrayList collection = new ArrayList(); /** The element type */ protected String elementType; /** * Create a new collection value */ public AbstractCollectionMetaData() { } /** * Get the element type * * @return the element type */ public String getElementType() { return elementType; } /** * Set the element type * * @param elementType the element type */ public void setElementType(String elementType) { this.elementType = elementType; } public boolean add(Object o) { return collection.add(o); } public boolean addAll(Collection c) { return collection.addAll(c); } public void clear() { collection.clear(); } public boolean contains(Object o) { return collection.contains(o); } public boolean containsAll(Collection c) { return collection.containsAll(c); } public boolean isEmpty() { return collection.isEmpty(); } public Iterator iterator() { return collection.iterator(); } public boolean remove(Object o) { return collection.remove(o); } public boolean removeAll(Collection c) { return collection.removeAll(c); } public boolean retainAll(Collection c) { return collection.retainAll(c); } public int size() { return collection.size(); } public Object[] toArray() { return collection.toArray(); } public Object[] toArray(Object[] a) { return collection.toArray(a); } }././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/LifecycleMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Lifecyc0000644000175000017500000000344111061473704033274 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.List; /** * Metadata about a lifecycle method. * * @author Adrian Brock * @version $Revision: 37406 $ */ public interface LifecycleMetaData extends FeatureMetaData { /** * Get the state * * @return the state */ ControllerState getState(); /** * Set the state * * @param state the state */ void setState(ControllerState state); /** * Get the method name. * * @return the method name. */ String getMethodName(); /** * Get the parameters. * * @return List. */ List getParameters(); } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractSupplyMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000546610513427451033305 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public class AbstractSupplyMetaData extends AbstractFeatureMetaData implements SupplyMetaData { // Constants ----------------------------------------------------- // Attributes ---------------------------------------------------- /** The supply */ protected Object supply; // Static -------------------------------------------------------- // Constructors -------------------------------------------------- /** * Create a new supply */ public AbstractSupplyMetaData() { } /** * Create a new supply * * @param supply the supply */ public AbstractSupplyMetaData(Object supply) { this.supply = supply; } // Public -------------------------------------------------------- /** * Set the supply * * @param supply the supply */ public void setSupply(Object supply) { this.supply = supply; } // SupplyMetaData implementation --------------------------------- public Object getSupply() { return supply; } // JBossObject overrides ----------------------------------------- public void toString(StringBuffer buffer) { buffer.append("supply=").append(supply); } public void toShortString(StringBuffer buffer) { buffer.append(supply); } // Package protected --------------------------------------------- // Protected ----------------------------------------------------- // Private ------------------------------------------------------- // Inner classes ------------------------------------------------- } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractParameterMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000564110513427451033300 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * Metadata for a parameter. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class AbstractParameterMetaData extends AbstractFeatureMetaData implements ParameterMetaData { /** The parameter type */ protected String type; /** The parameter value */ protected ValueMetaData value; /** * Create a new parameter meta data */ public AbstractParameterMetaData() { } /** * Create a new parameter meta data * * @param value the value */ public AbstractParameterMetaData(Object value) { this.type = value.getClass().getName(); this.value = new AbstractValueMetaData(value); } /** * Create a new parameter meta data * * @param type the type * @param value the value */ public AbstractParameterMetaData(String type, Object value) { this.type = type; this.value = new AbstractValueMetaData(value); } /** * Create a new parameter meta data * * @param type the type * @param value the string value */ public AbstractParameterMetaData(String type, String value) { this.type = type; this.value = new StringValueMetaData(value); } /** * Create a new parameter meta data * * @param type the type * @param value the value meta data */ public AbstractParameterMetaData(String type, ValueMetaData value) { this.type = type; this.value = value; } public String getType() { return type; } public void setType(String type) { this.type = type; } public ValueMetaData getValue() { return value; } public void setValue(ValueMetaData value) { this.value = value; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/ValueMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/ValueMe0000644000175000017500000000257710513427451033264 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * Metadata about a value. * * @author Adrian Brock * @version $Revision: 37406 $ */ public interface ValueMetaData { /** * Get the underlying value * * @return the underlying value */ public Object getUnderlyingValue(); } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractMapMetaDataEntry.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000342110513427451033272 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * Map metadata. * * @author Adrian Brock * @version $Revision: 38013 $ */ public class AbstractMapMetaDataEntry { private AbstractValueMetaData key; private AbstractValueMetaData value; public Object getKey() { return key.getUnderlyingValue(); } public void setKey(Object key) { this.key = (AbstractValueMetaData) key; } public Object getValue() { return value.getUnderlyingValue(); } public void setValue(Object value) { this.value = (AbstractValueMetaData) value; } public String toString() { return "[map-entry key=" + key + ", value=" + value + "]"; } }././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractAnnotationMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000550411061473704033277 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.Set; /** * Metadata for an annotation. * * @author Adrian Brock * @version $Revision: 38009 $ */ public class AbstractAnnotationMetaData implements AnnotationMetaData { // Constants ----------------------------------------------------- // Attributes ---------------------------------------------------- /** The annotation class name */ protected String name; /** The attributes Set */ protected Set attributes; // Static -------------------------------------------------------- // Constructors -------------------------------------------------- /** * Create a new annotation meta data */ public AbstractAnnotationMetaData() { super(); } // Public -------------------------------------------------------- /** * Set the name. * * @param name The name to set. */ public void setName(String name) { this.name = name; } /** * Set the attributes. * * @param attributes Set */ public void setAttributes(Set attributes) { this.attributes = attributes; } // AnnotationMetaData implementation ----------------------------- public String getName() { return name; } public Set getAttributes() { return attributes; } // Package protected --------------------------------------------- // Protected ----------------------------------------------------- // Private ------------------------------------------------------- // Inner classes ------------------------------------------------- } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/ConstructorMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Constru0000644000175000017500000000406311061473704033354 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.List; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public interface ConstructorMetaData extends FeatureMetaData { // Constants ----------------------------------------------------- // Public -------------------------------------------------------- /** * Get the parameters. * * @return List. */ List getParameters(); /** * Get the factory. * * @return the factory. */ ValueMetaData getFactory(); /** * Get the factory class. * * @return the class name of the factory. */ String getFactoryClass(); /** * Get the factory method. * * @return the factory method. */ String getFactoryMethod(); // Inner classes ------------------------------------------------- } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractBeanMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000001513111061473704033274 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.ArrayList; import java.util.Iterator; import java.util.Set; import java.util.Map; /** * Metadata for a bean. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class AbstractBeanMetaData extends AbstractFeatureMetaData implements BeanMetaData { /** The bean class name */ protected String bean; /** The name of this instance */ protected String name; /** The mode */ protected ControllerMode mode = null; /** The properties configuration Set */ protected Set properties; /** The constructor */ protected ConstructorMetaData constructor; /** The create lifecycle */ protected LifecycleMetaData create; /** The start lifecycle */ protected LifecycleMetaData start; /** The stop lifecycle */ protected LifecycleMetaData stop; /** The destroy lifecycle */ protected LifecycleMetaData destroy; /** What the bean demands Set */ protected Set demands; /** What the bean supplies Set */ protected Set supplies; protected Map metaData; /** * Create a new bean meta data */ public AbstractBeanMetaData() { super(); } /** * Create a new bean meta data * * @param bean the bean class name */ public AbstractBeanMetaData(String bean) { this.bean = bean; } /** * Create a new bean meta data * * @param name the name * @param bean the bean class name */ public AbstractBeanMetaData(String name, String bean) { this.name = name; this.bean = bean; } /** * Set the bean. * * @param bean The bean to set. */ public void setBean(String bean) { this.bean = bean; } /** * Set the propertiess. * * @param properties Set */ public void setProperties(Set properties) { this.properties = properties; } /** * Set the constructor * * @param constructor the constructor metadata */ public void setConstructor(ConstructorMetaData constructor) { this.constructor = constructor; } /** * Set what the bean demands. * * @param demands Set */ public void setDemands(Set demands) { this.demands = demands; } /** * Set what the bean supplies. * * @param supplies Set */ public void setSupplies(Set supplies) { this.supplies = supplies; } public String getBean() { return bean; } public String getName() { return name; } /** * Set the name. * * @param name The name to set. */ public void setName(String name) { this.name = name; } public ControllerMode getMode() { return mode; } public void setMode(ControllerMode mode) { this.mode = mode; } public Set getProperties() { return properties; } public ConstructorMetaData getConstructor() { return constructor; } public LifecycleMetaData getCreate() { return create; } /** * Set the lifecycle metadata * * @param lifecycle the lifecycle metadata */ public void setCreate(LifecycleMetaData lifecycle) { lifecycle.setState(ControllerState.CREATE); this.create = lifecycle; } public LifecycleMetaData getStart() { return start; } /** * Set the start metadata * * @param lifecycle the lifecycle metadata */ public void setStart(LifecycleMetaData lifecycle) { lifecycle.setState(ControllerState.START); this.start = lifecycle; } public LifecycleMetaData getStop() { return stop; } /** * Set the stop metadata * * @param lifecycle the lifecycle metadata */ public void setStop(LifecycleMetaData lifecycle) { lifecycle.setState(ControllerState.START); this.stop = lifecycle; } public LifecycleMetaData getDestroy() { return destroy; } /** * Set the destroy metadata * * @param lifecycle the lifecycle metadata */ public void setDestroy(LifecycleMetaData lifecycle) { lifecycle.setState(ControllerState.CREATE); this.destroy = lifecycle; } public Set getDemands() { return demands; } public Set getSupplies() { return supplies; } public Iterator getChildren() { ArrayList list = new ArrayList(); if (constructor != null) list.add(constructor); if (properties != null) list.addAll(properties); if (create != null) list.add(create); if (start != null) list.add(start); if (stop != null) list.add(stop); if (destroy != null) list.add(destroy); if (demands != null) list.addAll(demands); if (supplies != null) list.addAll(supplies); if (metaData != null) list.add(metaData); return list.iterator(); } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/PropertyMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Propert0000644000175000017500000000264610513427451033356 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public interface PropertyMetaData extends FeatureMetaData { /** * Get the name. * * @return the name. */ String getName(); /** * Get the value. * * @return the value. */ ValueMetaData getValue(); } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/StringValueMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/StringV0000644000175000017500000000361710513427451033316 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * String value. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class StringValueMetaData extends AbstractTypeMetaData { /** * Create a new string value */ public StringValueMetaData() { } /** * Create a new string value * * @param value the value */ public StringValueMetaData(String value) { super(value); } /** * Set the value * * @param value the value */ public void setValue(String value) { super.setValue(value); } public void setValue(Object value) { if (value != null && value instanceof String == false) throw new ClassCastException("value is not a String: " + value); super.setValue(value); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractTypeMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000344210513427451033275 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * A typed value. * * @author Adrian Brock * @version $Revision: 37406 $ */ public abstract class AbstractTypeMetaData extends AbstractValueMetaData { /** The type */ protected String type; /** * Create a new typed value */ public AbstractTypeMetaData() { } /** * Create a new typed value * * @param value the value */ public AbstractTypeMetaData(String value) { super(value); } /** * Set the type * * @param type the type */ public void setType(String type) { this.type = type; } public String getType() { return type; } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/ParameterMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Paramet0000644000175000017500000000321210513427451033302 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public interface ParameterMetaData extends FeatureMetaData { // Constants ----------------------------------------------------- // Public -------------------------------------------------------- /** * Get the type. * * @return the type. */ String getType(); /** * Get the value. * * @return the value. */ ValueMetaData getValue(); // Inner classes ------------------------------------------------- } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractSetMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000400711061473704033274 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.Collection; import java.util.Iterator; import java.util.Set; /** * Set metadata. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class AbstractSetMetaData extends AbstractCollectionMetaData implements Set { /** * Create a new set value */ public AbstractSetMetaData() { } public boolean add(Object o) { if (collection.contains(o)) return false; return super.add(o); } public boolean addAll(Collection c) { boolean changed = false; if (c != null && c.size() > 0) { for (Iterator i = c.iterator(); i.hasNext(); ) { Object o = i.next(); if (collection.contains(o) == false) { if (super.add(o)) changed = true; } } } return changed; } }././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractMapMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000627411061473704033304 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.Set; /** * Map metadata. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class AbstractMapMetaData extends AbstractTypeMetaData implements Map { /** The map */ private HashMap map = new HashMap(); /** The key type */ protected String keyType; /** The value type */ protected String valueType; /** * Create a new map value */ public AbstractMapMetaData() { } /** * Get the key type * * @return the key type */ public String getKeyType() { return keyType; } /** * Set the key type * * @param keyType the key type */ public void setKeyType(String keyType) { this.keyType = keyType; } /** * Get the value type * * @return the value type */ public String getValueType() { return valueType; } /** * Set the value type * * @param valueType the value type */ public void setValueType(String valueType) { this.valueType = valueType; } public void clear() { map.clear(); } public boolean containsKey(Object key) { return map.containsKey(key); } public boolean containsValue(Object value) { return map.containsValue(value); } public Set entrySet() { return map.entrySet(); } public Object get(Object key) { return map.get(key); } public boolean isEmpty() { return map.isEmpty(); } public Set keySet() { return map.keySet(); } public Object put(Object key, Object value) { return map.put(key, value); } public void putAll(Map t) { map.putAll(t); } public Object remove(Object key) { return map.remove(key); } public int size() { return map.size(); } public Collection values() { return map.values(); } }././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/ControllerState.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Control0000644000175000017500000000576210513427451033345 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * Description of state. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class ControllerState { /** Error */ public static final ControllerState ERROR = new ControllerState("**ERROR**"); /** Not installed state */ public static final ControllerState NOT_INSTALLED = new ControllerState("Not Installed"); /** Described state */ public static final ControllerState DESCRIBED = new ControllerState("Described"); /** Instantiated state */ public static final ControllerState INSTANTIATED = new ControllerState("Instantiated"); /** Configured state */ public static final ControllerState CONFIGURED = new ControllerState("Configured"); /** Create state */ public static final ControllerState CREATE = new ControllerState("Create"); /** Start state */ public static final ControllerState START = new ControllerState("Start"); /** Installed state */ public static final ControllerState INSTALLED = new ControllerState("Installed"); /** The state string */ protected final String stateString; /** * Create a new state * * @param stateString the string representation */ public ControllerState(String stateString) { if (stateString == null) throw new IllegalArgumentException("Null state string"); this.stateString = stateString; } /** * Get the state string * * @return the state string */ public String getStateString() { return stateString; } public boolean equals(Object object) { if (object == null || object instanceof ControllerState == false) return false; ControllerState other = (ControllerState) object; return stateString.equals(other.stateString); } public int hashCode() { return stateString.hashCode(); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/MetaDataVisitor.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/MetaDat0000644000175000017500000000236710513427451033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public interface MetaDataVisitor { public void visit(MetaDataVisitorNode node); } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/DependencyValueMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Depende0000644000175000017500000000340210513427451033256 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public interface DependencyValueMetaData extends ValueMetaData { // Constants ----------------------------------------------------- // Public -------------------------------------------------------- /** * Set the controller * * @param controller the controller */ void setController(Object controller); /** * Get the required state of the dependency * * @return the required state or null if it must be in the registry */ ControllerState getDependentState(); // Inner classes ------------------------------------------------- } ././@LongLink0000000000000000000000000000017500000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractDependencyMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000361610513427451033300 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * A dependency. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class AbstractDependencyMetaData implements DependencyMetaData { /** The dependency */ protected Object dependency; /** * Create a new dependency */ public AbstractDependencyMetaData() { } /** * Create a new dependency * * @param dependency the dependency */ public AbstractDependencyMetaData(Object dependency) { this.dependency = dependency; } /** * Set the dependency * * @param dependency the dependency */ public void setDependency(Object dependency) { this.dependency = dependency; } public Object getDependency() { return dependency; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/GenericBeanFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Generic0000644000175000017500000000545211061473704033276 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.Map; /** * Collection metadata. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class GenericBeanFactory { /** The bean class name */ protected String bean; /** The constructor metadata */ protected ConstructorMetaData constructor; /** The properties Map */ protected Map properties; /** * Create a new generic bean factory */ public GenericBeanFactory() { } // Public -------------------------------------------------------- /** * Get the bean name * * @return the bean */ public String getBean() { return bean; } /** * Set the bean name * * @param bean the bean name */ public void setBean(String bean) { this.bean = bean; } /** * Get the constructor metadata * * @return the contructor metadata */ public ConstructorMetaData getConstructor() { return constructor; } /** * Set the constructor metadata * * @param constructor the constructor metadata */ public void setConstructor(ConstructorMetaData constructor) { this.constructor = constructor; } /** * Get the properties * * @return the properties Map */ public Map getProperties() { return properties; } /** * Set the properties * * @param properties the properties Map */ public void setProperties(Map properties) { this.properties = properties; } }././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/ControllerMode.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Control0000644000175000017500000000475510513427451033346 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; /** * Mode of the context. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class ControllerMode { /** Automatic */ public static final ControllerMode AUTOMATIC = new ControllerMode("Automatic"); /** On demand */ public static final ControllerMode ON_DEMAND = new ControllerMode("On Demand"); /** Manual */ public static final ControllerMode MANUAL = new ControllerMode("Manual"); /** Disabled */ public static final ControllerMode DISABLED = new ControllerMode("Disabled"); /** The mode string */ protected final String modeString; /** * Create a new mode * * @param modeString the mode representation */ public ControllerMode(String modeString) { if (modeString == null) throw new IllegalArgumentException("Null mode string"); this.modeString = modeString; } /** * Get the mode string * * @return the mdoe string */ public String getModeString() { return modeString; } public boolean equals(Object object) { if (object == null || object instanceof ControllerMode == false) return false; ControllerMode other = (ControllerMode) object; return modeString.equals(other.modeString); } public int hashCode() { return modeString.hashCode(); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/AbstractListMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/metadata/Abstrac0000644000175000017500000000465511061473704033305 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver.metadata; import java.util.Collection; import java.util.List; import java.util.ListIterator; /** * List metadata. * * @author Adrian Brock * @version $Revision: 37406 $ */ public class AbstractListMetaData extends AbstractCollectionMetaData implements List { /** * Create a new list value */ public AbstractListMetaData() { } public void add(int index, Object element) { collection.add(index, element); } public boolean addAll(int index, Collection c) { return collection.addAll(index, c); } public Object get(int index) { return collection.get(index); } public int indexOf(Object o) { return collection.indexOf(o); } public int lastIndexOf(Object o) { return lastIndexOf(o); } public ListIterator listIterator() { return collection.listIterator(); } public ListIterator listIterator(int index) { return collection.listIterator(index); } public Object remove(int index) { return collection.remove(index); } public Object set(int index, Object element) { return set(index, element); } public List subList(int fromIndex, int toIndex) { return subList(fromIndex, toIndex); } }././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/SimpleBeanImpl.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/SimpleBeanImpl.j0000644000175000017500000001744711061473704033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver; import java.io.Serializable; import java.util.Date; import java.util.Collection; import java.util.Properties; import java.util.Set; import java.util.List; import java.math.BigDecimal; import java.math.BigInteger; /** * A simple bean * * @author Adrian Brock * @author Les A. Hazlewood * @version $Revision: 37406 $ */ public class SimpleBeanImpl implements Serializable, SimpleBean { // Constants ----------------------------------------------------- private static final long serialVersionUID = 3762247526635353911L; // Attributes ---------------------------------------------------- /** Constructor used */ private String constructorUsed; /** A string */ private String aString; /** Byte */ private Byte aByte; /** Boolean */ private Boolean aBoolean; /** Character */ private Character aCharacter; /** Short */ private Short aShort; /** Int */ private Integer anInt; /** Long */ private Long aLong; /** Float */ private Float aFloat; /** Double */ private Double aDouble; /** Date */ private Date aDate; /** BigDecimal */ private BigDecimal aBigDecimal; /** BigDecimal */ private BigInteger aBigInteger; /** byte */ private byte abyte; /** boolean */ private boolean aboolean; /** char */ private char achar; /** short */ private short ashort; /** int */ private int anint; /** long */ private long along; /** float */ private float afloat; /** double */ private double adouble; /** a simple bean */ private SimpleBean other; /** A collection */ private Collection collection; /** A list */ private List aList; /** A set */ private Set aSet; /** A properties */ private Properties props; // Static -------------------------------------------------------- // Constructors -------------------------------------------------- public SimpleBeanImpl() { constructorUsed = "()"; } public SimpleBeanImpl(String string) { constructorUsed = string; } public SimpleBeanImpl(SimpleBean other) { constructorUsed = SimpleBean.class.getName(); this.other = other; } // Public -------------------------------------------------------- public String getConstructorUsed() { return constructorUsed; } public BigDecimal getABigDecimal() { return aBigDecimal; } public void setABigDecimal(BigDecimal bigDecimal) { aBigDecimal = bigDecimal; } public BigInteger getABigInteger() { return aBigInteger; } public void setABigInteger(BigInteger bigInteger) { aBigInteger = bigInteger; } public boolean isAboolean() { return aboolean; } public void setAboolean(boolean aboolean) { this.aboolean = aboolean; } public Boolean getABoolean() { return aBoolean; } public void setABoolean(Boolean boolean1) { aBoolean = boolean1; } public byte getAbyte() { return abyte; } public void setAbyte(byte abyte) { this.abyte = abyte; } public Byte getAByte() { return aByte; } public void setAByte(Byte byte1) { aByte = byte1; } public char getAchar() { return achar; } public void setAchar(char achar) { this.achar = achar; } public Character getACharacter() { return aCharacter; } public void setACharacter(Character character) { aCharacter = character; } public Date getADate() { return aDate; } public void setADate(Date date) { aDate = date; } public double getAdouble() { return adouble; } public void setAdouble(double adouble) { this.adouble = adouble; } public Double getADouble() { return aDouble; } public void setADouble(Double double1) { aDouble = double1; } public float getAfloat() { return afloat; } public void setAfloat(float afloat) { this.afloat = afloat; } public Float getAFloat() { return aFloat; } public void setAFloat(Float float1) { aFloat = float1; } public long getAlong() { return along; } public void setAlong(long along) { this.along = along; } public Long getALong() { return aLong; } public void setALong(Long long1) { aLong = long1; } public int getAnint() { return anint; } public void setAnint(int anint) { this.anint = anint; } public Integer getAnInt() { return anInt; } public void setAnInt(Integer anInt) { this.anInt = anInt; } public short getAshort() { return ashort; } public void setAshort(short ashort) { this.ashort = ashort; } public Short getAShort() { return aShort; } public void setAShort(Short short1) { aShort = short1; } public String getAString() { return aString; } public void setAString(String string) { aString = string; } public SimpleBean getOther() { return other; } public void setOther(SimpleBean other) { /** TODO if (constructorUsed.equals("dependentState")) { if (other.getAString() != null) throw new RuntimeException("Should not be configured: " + other.getAString()); } */ this.other = other; } public Collection getCollection() { return collection; } public void setCollection(Collection collection) { this.collection = collection; } public List getAList() { return aList; } public void setAList(List aList) { this.aList = aList; } public Set getASet() { return aSet; } public void setASet(Set aSet) { this.aSet = aSet; } public Properties getProps() { return props; } public void setProps(Properties props) { this.props = props; } // Package protected --------------------------------------------- // Protected ----------------------------------------------------- // Private ------------------------------------------------------- // Inner classes ------------------------------------------------- } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/SimpleBean.java0000644000175000017500000000557410513427451033105 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Date; /** * A SimpleBean. * * @author Adrian Brock * @version $Revision: 37406 $ */ public interface SimpleBean { // Constants ----------------------------------------------------- // Public -------------------------------------------------------- String getConstructorUsed(); BigDecimal getABigDecimal(); void setABigDecimal(BigDecimal bigDecimal); BigInteger getABigInteger(); void setABigInteger(BigInteger bigInteger); boolean isAboolean(); void setAboolean(boolean aboolean); Boolean getABoolean(); void setABoolean(Boolean boolean1); byte getAbyte(); void setAbyte(byte abyte); Byte getAByte(); void setAByte(Byte byte1); char getAchar(); void setAchar(char achar); Character getACharacter(); void setACharacter(Character character); Date getADate(); void setADate(Date date); double getAdouble(); void setAdouble(double adouble); Double getADouble(); void setADouble(Double double1); float getAfloat(); void setAfloat(float afloat); Float getAFloat(); void setAFloat(Float float1); long getAlong(); void setAlong(long along); Long getALong(); void setALong(Long long1); int getAnint(); void setAnint(int anint); Integer getAnInt(); void setAnInt(Integer anInt); short getAshort(); void setAshort(short ashort); Short getAShort(); void setAShort(Short short1); String getAString(); void setAString(String string); SimpleBean getOther(); void setOther(SimpleBean other); // Inner classes ------------------------------------------------- }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/SimpleBeanFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/pojoserver/SimpleBeanFactor0000644000175000017500000000530110513427451033310 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.pojoserver; /** * A simple bean factory * * @author Adrian Brock * @version $Revision: 37406 $ */ public class SimpleBeanFactory { // Constants ----------------------------------------------------- /** The method used */ private static String methodUsed; // Attributes ---------------------------------------------------- // Static -------------------------------------------------------- public static String getMethodUsed() { return methodUsed; } public static SimpleBean staticCreateSimpleBean() { methodUsed = "staticCreateSimpleBean()"; return new SimpleBeanImpl(); } public static SimpleBean staticCreateSimpleBean(SimpleBean other) { methodUsed = "staticCreateSimpleBean(SimpleBean)"; return new SimpleBeanImpl(other); } // Constructors -------------------------------------------------- public SimpleBeanFactory() { } // Public -------------------------------------------------------- public SimpleBean createSimpleBean() { methodUsed = "createSimpleBean()"; return new SimpleBeanImpl(); } public SimpleBean createSimpleBean(SimpleBean other) { methodUsed = "createSimpleBean(SimpleBean)"; return new SimpleBeanImpl(other); } // Package protected --------------------------------------------- // Protected ----------------------------------------------------- // Private ------------------------------------------------------- // Inner classes ------------------------------------------------- } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/CollectionsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/CollectionsUnitTestCase.jav0000644000175000017500000003766011061473704033303 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.FileReader; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.net.URL; import java.util.Arrays; import java.util.List; import javax.xml.namespace.QName; import org.jboss.test.xml.collections.Collections; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * @author Alexey Loubyansky * @version $Revision: 56874 $ */ public class CollectionsUnitTestCase extends AbstractJBossXBTest { private static final String LIST_TYPE_XSD = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; private static final String LIST_TYPE_XML = "true false true"; private static final String LIST_TYPE_QNAME_ARR_XML = ""; private static final String MULTIDIM_ARR_XML = "" + " " + " s1" + " " + " " + " s2" + " s3" + " " + " " + " " + " " + " " + ""; private static final String[][] MULTIDIM_ARR = new String[][] { new String[]{"s1"}, new String[]{"s2", "s3"}, new String[]{null}, null }; public CollectionsUnitTestCase(String name) { super(name); } /* protected void configureLogging() { enableTrace("org.jboss.xb.binding"); } */ public void testUnmarshalling() throws Exception { String xml = getFullPath("xml/collections.xml"); Reader xmlReader = new FileReader(xml); unmarshalCollections(xmlReader); } public void testMarshalling() throws Exception { String ns = "http://www.jboss.org/test/xml/collections"; MarshallerImpl marshaller = new MarshallerImpl(); marshaller.addRootElement(new QName(ns, "collections")); marshaller.setRootTypeQName(new QName(ns, "collections")); marshaller.declareNamespace(null, ns); String xsd = getFullPath("xml/collections.xsd"); StringWriter xml = new StringWriter(); marshaller.marshal(xsd, new MappingObjectModelProvider(), Collections.getInstance(), xml); String marshalled = xml.getBuffer().toString(); try { unmarshalCollections(new StringReader(marshalled)); } catch(Throwable t) { fail("Failed to unmarshal:\n" + marshalled + "\n" + t.getMessage()); } } public void testMultidimArrMarshallingXerces() throws Exception { StringWriter writer = new StringWriter(); XercesXsMarshaller marshaller = new XercesXsMarshaller(); marshaller.marshal(new StringReader(getMultiDimArrayXsd(false)), new MappingObjectModelProvider(), MULTIDIM_ARR, writer ); String marshalled = writer.getBuffer().toString(); assertXmlEqual(MULTIDIM_ARR_XML, marshalled); } public void testMultidimArrMarshallingSunday() throws Exception { StringWriter writer = new StringWriter(); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.marshal(new StringReader(getMultiDimArrayXsd(false)), null, MULTIDIM_ARR, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(MULTIDIM_ARR_XML, marshalled); } public void testMultidimArrayUnmarshalling() throws Exception { Object o = unmarshalMDArray(false); assertTrue(o instanceof String[][]); String[][] arr = (String[][])o; assertMultidimArray(arr); } public void testAnnotatedMultiDimArray() throws Exception { Object o = unmarshalMDArray(true); assertTrue(o instanceof ArrayWrapper); String[][] arr = ((ArrayWrapper)o).arr; assertMultidimArray(arr); } public void testUnmarshalListType() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(LIST_TYPE_XSD), null); schema.setIgnoreUnresolvedFieldOrClass(false); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(LIST_TYPE_XML), schema); assertNotNull(o); assertTrue(o instanceof ListWrapper); ListWrapper lists = (ListWrapper)o; assertEquals(Arrays.asList(new String[]{"str1", "str2", "str3"}), lists.field1); assertEquals(Arrays.asList(new Boolean[]{Boolean.TRUE, Boolean.FALSE, Boolean.TRUE}), lists.field2); } public void testMarshallingListTypeXerces() throws Exception { ListWrapper lists = new ListWrapper(); lists.field1 = Arrays.asList(new String[]{"str1", "str2", "str3"}); lists.field2 = Arrays.asList(new Boolean[]{Boolean.TRUE, Boolean.FALSE, Boolean.TRUE}); StringWriter writer = new StringWriter(); XercesXsMarshaller marshaller = new XercesXsMarshaller(); MappingObjectModelProvider provider = new MappingObjectModelProvider(); provider.mapFieldToElement(ListWrapper.class, "field2", "http://jboss.org/test/xml/list", "e", null); marshaller.marshal(new StringReader(LIST_TYPE_XSD), provider, lists, writer); String xml = writer.getBuffer().toString(); assertXmlEqual(LIST_TYPE_XML, xml); } public void testMarshallingListTypeSunday() throws Exception { ListWrapper lists = new ListWrapper(); lists.field1 = Arrays.asList(new String[]{"str1", "str2", "str3"}); lists.field2 = Arrays.asList(new Boolean[]{Boolean.TRUE, Boolean.FALSE, Boolean.TRUE}); SchemaBinding schema = XsdBinder.bind(new StringReader(LIST_TYPE_XSD), null); schema.setIgnoreUnresolvedFieldOrClass(false); StringWriter writer = new StringWriter(); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.marshal(schema, null, lists, writer); String xml = writer.getBuffer().toString(); assertXmlEqual(LIST_TYPE_XML, xml); } public void testUnmarshalListTypeToArrayField() throws Exception { String xml = LIST_TYPE_QNAME_ARR_XML; unmarshalQNameArray(xml); } public void testMarshallingListTypeArrayToListXerces() throws Exception { ListWrapper lists = new ListWrapper(); lists.field3 = new QName[]{new QName("http://ns1", "name1"), new QName("http://ns2", "name2"), new QName("http://ns3", "name3") }; StringWriter writer = new StringWriter(); XercesXsMarshaller marshaller = new XercesXsMarshaller(); MappingObjectModelProvider provider = new MappingObjectModelProvider(); marshaller.marshal(new StringReader(LIST_TYPE_XSD), provider, lists, writer); String xml = writer.getBuffer().toString(); unmarshalQNameArray(xml); } public void testMarshallingListTypeArrayToListSunday() throws Exception { ListWrapper lists = new ListWrapper(); lists.field3 = new QName[]{new QName("http://ns1", "name1"), new QName("http://ns2", "name2"), new QName("http://ns3", "name3") }; SchemaBinding schema = XsdBinder.bind(new StringReader(LIST_TYPE_XSD), null); schema.setIgnoreUnresolvedFieldOrClass(false); StringWriter writer = new StringWriter(); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.marshal(schema, null, lists, writer); String xml = writer.getBuffer().toString(); unmarshalQNameArray(xml); } // Private private void unmarshalQNameArray(String xml) throws JBossXBException { SchemaBinding schema = XsdBinder.bind(new StringReader(LIST_TYPE_XSD), null); schema.setIgnoreUnresolvedFieldOrClass(false); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(xml), schema); assertNotNull(o); assertTrue(o instanceof ListWrapper); ListWrapper lists = (ListWrapper)o; assertNotNull(lists.field3); assertEquals(3, lists.field3.length); assertEquals(new QName("http://ns1", "name1"), lists.field3[0]); assertEquals(new QName("http://ns2", "name2"), lists.field3[1]); assertEquals(new QName("http://ns3", "name3"), lists.field3[2]); } private Object unmarshalMDArray(boolean annotations) throws JBossXBException { String xsd = getMultiDimArrayXsd(annotations); SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); schema.setIgnoreUnresolvedFieldOrClass(false); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); return unmarshaller.unmarshal(new StringReader(MULTIDIM_ARR_XML), schema); } private String getMultiDimArrayXsd(boolean annotations) { StringBuffer xsdBuf = new StringBuffer() .append("\n") .append(" \n") .append(" \n") .append( " \n" ) .append(" \n") .append(" \n") .append(" \n"); if(annotations) { xsdBuf .append(" \n") .append(" \n") .append(" \n") .append(" \n") .append(" \n"); } xsdBuf .append(" \n") .append(" \n"); if(annotations) { xsdBuf .append(" \n") .append(" \n") .append(" \n") .append(" \n") .append(" \n"); } xsdBuf .append(" \n") .append(" \n") .append(" \n") .append(" \n") .append(""); String xsd = xsdBuf.toString(); return xsd; } private void assertMultidimArray(String[][] arr) { assertNotNull(arr); assertEquals(4, arr.length); assertTrue(arr[0] instanceof String[]); assertEquals(1, arr[0].length); assertEquals("s1", arr[0][0]); assertEquals(2, arr[1].length); assertEquals("s2", arr[1][0]); assertEquals("s3", arr[1][1]); assertTrue(arr[2] instanceof String[]); assertEquals(1, arr[2].length); assertNull(arr[2][0]); assertNull(arr[3]); } private void unmarshalCollections(Reader xmlReader) throws JBossXBException { String xsd = getFullPath("xml/collections.xsd"); SchemaBinding schema = XsdBinder.bind(xsd); schema.setIgnoreUnresolvedFieldOrClass(false); String ns = "http://www.jboss.org/test/xml/collections"; QName rootQName = new QName(ns, "collections"); TypeBinding type = schema.getType(rootQName); assertNotNull(type); schema.addElement(rootQName, type); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Collections collections; collections = (Collections)unmarshaller.unmarshal(xmlReader, schema); assertEquals(Collections.getInstance(), collections); } private String getFullPath(String name) { URL url = Thread.currentThread().getContextClassLoader().getResource(name); if(url == null) { fail("Resource not found: " + name); } return url.getFile(); } // Inner public static final class ArrayWrapper { public String[][] arr; } public static final class ListWrapper { public List field1; public List field2; public QName[] field3; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/MappingTestCase.java0000644000175000017500000002447511061473704031721 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import org.jboss.logging.Logger; import org.jboss.xb.binding.DtdMarshaller; import org.jboss.xb.binding.MappingObjectModelFactory; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.Marshaller; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.test.xml.person.Address; import org.jboss.test.xml.person.Person; import org.jboss.test.xml.choice.Root; import org.jboss.test.xml.choice.Choice2; import org.jboss.test.xml.choice.Choice1; import org.jboss.test.xml.immutable.Child1; import org.jboss.test.xml.immutable.Child2; import org.jboss.test.xml.immutable.Child3; import org.jboss.test.xml.immutable.Parent; import org.jboss.test.xml.immutable.ImmutableChoice; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import junit.framework.TestCase; import java.io.InputStream; import java.io.StringWriter; import java.io.Reader; import java.io.InputStreamReader; import java.io.StringReader; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.net.URL; /** * @author Alexey Loubyansky * @version $Revision: 57179 $ */ public class MappingTestCase extends TestCase { private static final Logger log = Logger.getLogger(MappingTestCase.class); public MappingTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { URL url = Thread.currentThread().getContextClassLoader().getResource("xml/person.xml"); if(url == null) { fail("the xml not found"); } Reader xmlReader = new java.io.InputStreamReader(url.openStream()); Person person = unmarshalPerson(xmlReader); xmlReader.close(); assertNotNull("Person is null", person); assertEquals(person.getFirstName(), "Vasiliy"); assertEquals(person.getLastName(), "Poupkin"); assertEquals(person.getDateOfBirth(), SimpleTypeBindings.JAVA_UTIL_DATE.unmarshal("1980-01-01")); assertEquals(person.getPhones(), Arrays.asList(new Object[]{"01", "02"})); ArrayList
list = new ArrayList
(); Address addr1 = new Address(); addr1.setStreet("prosp. Rad. Ukr. 11A, 70"); list.add(addr1); addr1 = new Address(); addr1.setStreet("Sky 7"); list.add(addr1); assertEquals(person.getAddresses(), list); } public void testMarshalling() throws Exception { log.debug(""); final Person person = Person.newInstance(); StringWriter xmlOutput = new StringWriter(); InputStream is = getResource("xml/person.dtd"); Reader dtdReader = new InputStreamReader(is); // create an instance of DTD marshaller Marshaller marshaller = new DtdMarshaller(); // map publicId to systemId as it should appear in the resulting XML file marshaller.mapPublicIdToSystemId("-//DTD Person//EN", "resources/xml/person.dtd"); // create an instance of ObjectModelProvider with the book instance to be marshalled MappingObjectModelProvider provider = new MappingObjectModelProvider(); provider.mapFieldToElement(Person.class, "dateOfBirth", "", "date-of-birth", SimpleTypeBindings.JAVA_UTIL_DATE); // marshal the book marshaller.marshal(dtdReader, provider, person, xmlOutput); // close DTD reader dtdReader.close(); final String xml = xmlOutput.getBuffer().toString(); log.debug("marshalled: " + xml); // check unmarshalled person Person unmarshalled = unmarshalPerson(new StringReader(xml)); assertEquals(person, unmarshalled); log.debug(""); } public void testChoice() throws Exception { log.debug("testChoice> started"); long startTime = System.currentTimeMillis(); String xsdUrl = getXsd("xml/choice.xsd"); Root root = newChoiceRoot(); String xml = marshalChoiceRoot(xsdUrl, root); StringReader reader = new StringReader(xml); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Root unmarshalled = (Root)unmarshaller.unmarshal(reader, new MappingObjectModelFactory(), null); assertEquals(root, unmarshalled); log.debug("testChoice> done in " + (System.currentTimeMillis() - startTime)); } public void testImmutable() throws Exception { log.debug("testImmutable> started"); long startTime = System.currentTimeMillis(); String xsd = getXsd("xml/immutable.xsd"); Parent parent = newImmutableParent(); String xml = marshalImmutableParent(xsd, parent); StringReader reader = new StringReader(xml); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Parent unmarshalled = (Parent)unmarshaller.unmarshal(reader, new MappingObjectModelFactory(), null); assertEquals(parent, unmarshalled); log.debug("testImmutable> done in " + (System.currentTimeMillis() - startTime)); } // Private private String marshalImmutableParent(String xsd, Parent parent) throws IOException, SAXException { StringWriter writer = new StringWriter(); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.declareNamespace("imm", "http://www.jboss.org/test/xml/immutable/"); marshaller.marshal(xsd, new MappingObjectModelProvider(), parent, writer ); return writer.getBuffer().toString(); } private Parent newImmutableParent() { Child1 child1 = new Child1("child1"); List child2 = Arrays.asList(new Object[]{new Child2("child2_1"), new Child2("child2_2")}); List others = Arrays.asList(new Object[]{new Child3("child3_1"), new Child3("child3_2"), new Child3("child3_3")}); List choice = Arrays.asList( new Object[]{new ImmutableChoice("choice1"), new ImmutableChoice(new Child1("child1"))} ); Parent parent = new Parent(child1, child2, others, choice); return parent; } private static String getXsd(String path) { URL xsdUrl = Thread.currentThread().getContextClassLoader().getResource(path); if(xsdUrl == null) { throw new IllegalStateException("XSD not found: " + path); } return xsdUrl.getFile(); } private static String marshalChoiceRoot(String xsdUrl, Root root) throws IOException, SAXException { StringWriter writer = new StringWriter(); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.declareNamespace("chs", "http://www.jboss.org/test/xml/choice/"); //marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); marshaller.marshal(xsdUrl, new MappingObjectModelProvider(), root, writer ); return writer.getBuffer().toString(); } private static Root newChoiceRoot() { String a = "a"; String b = "b"; String c = "c"; List choice1 = Arrays.asList(new Choice1[]{new Choice1(a, null), new Choice1(null, b)}); List choice2 = Arrays.asList(new Choice2[]{new Choice2(a, b, null), new Choice2(a, null, c)}); Root root = new Root(); root.setChoice1(choice1); root.setChoice2(choice2); return root; } private Person unmarshalPerson(Reader xmlReader) throws Exception { MappingObjectModelFactory factory = new MappingObjectModelFactory(); factory.mapElementToClass("person", Person.class); factory.mapElementToField("date-of-birth", Person.class, "dateOfBirth", SimpleTypeBindings.JAVA_UTIL_DATE); factory.mapElementToClass("phones", ArrayList.class); factory.mapElementToClass("addresses", ArrayList.class); factory.mapElementToClass("address", Address.class); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.setEntityResolver( new EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if(systemId.endsWith("person.dtd")) { InputStream dtdIs = Thread.currentThread().getContextClassLoader().getResourceAsStream("xml/person.dtd"); if(dtdIs == null) { fail("The person.dtd could not be found."); } return new InputSource(dtdIs); } return null; } } ); return (Person)unmarshaller.unmarshal(xmlReader, factory, null); } private static InputStream getResource(String name) { InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); if(is == null) { throw new IllegalStateException("Resource not found: " + name); } return is; } }libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/loginconfig/0000755000175000017500000000000011620316737030314 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/loginconfig/Users.java0000644000175000017500000001071111062060756032255 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.loginconfig; import java.security.Principal; import java.security.acl.Group; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; /** * The XMLLoginModule users/roles object representation. * * @author Scott.Stark@jboss.org * @version $Revision$ */ public class Users { private HashMap users = new HashMap(); public static class User implements Comparable { private String name; private String password; private String encoding; private HashMap roleGroups = new HashMap(); public User() { } public User(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEncoding() { return encoding; } public void setEncoding(String encoding) { this.encoding = encoding; } @SuppressWarnings("unchecked") public Group[] getRoleSets() { Group[] roleSets = new Group[roleGroups.size()]; roleGroups.values().toArray(roleSets); return roleSets; } public String[] getRoleNames() { return getRoleNames("Roles"); } public String[] getRoleNames(String roleGroup) { Group group = (Group) roleGroups.get(roleGroup); String[] names = {}; if( group != null ) { ArrayList tmp = new ArrayList(); Enumeration iter = group.members(); while( iter.hasMoreElements() ) { Principal p = iter.nextElement(); tmp.add(p.getName()); } names = new String[tmp.size()]; tmp.toArray(names); } return names; } public void addRole(String roleName, String roleGroup) { Group group = (Group) roleGroups.get(roleGroup); if( group == null ) { group = new SimpleGroup(roleGroup); roleGroups.put(roleGroup, group); } SimplePrincipal role = new SimplePrincipal(roleName); group.addMember(role); } public int compareTo(User obj) { return name.compareTo(obj.name); } public String toString() { return "User{" + "name='" + name + "'" + ", password=*" + ", encoding='" + encoding + "'" + ", roleGroups=" + roleGroups + "}"; } } public void addUser(User user) { users.put(user.getName(), user); } public Iterator getUsers() { return users.values().iterator(); } public User getUser(String name) { User find = (User) users.get(name); return find; } public int size() { return users.size(); } public String toString() { return "Users("+System.identityHashCode(this)+"){" + "users=" + users + "}"; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/loginconfig/SimpleGroup.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/loginconfig/SimpleGroup.jav0000644000175000017500000001233711062060756033267 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.loginconfig; import java.security.Principal; import java.security.acl.Group; import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; /** An implementation of Group that manages a collection of Principal objects based on their hashCode() and equals() methods. This class is not thread safe. @author Scott.Stark@jboss.org @version $Revision$ */ public class SimpleGroup extends SimplePrincipal implements Group, Cloneable { /** The serialVersionUID */ private static final long serialVersionUID = 6051859639378507247L; private HashMap members; public SimpleGroup(String groupName) { super(groupName); members = new HashMap(3); } /** Adds the specified member to the group. @param user the principal to add to this group. @return true if the member was successfully added, false if the principal was already a member. */ public boolean addMember(Principal user) { boolean isMember = members.containsKey(user); if( isMember == false ) members.put(user, user); return isMember == false; } /** Returns true if the passed principal is a member of the group. This method does a recursive search, so if a principal belongs to a group which is a member of this group, true is returned. A special check is made to see if the member is an instance of org.jboss.security.AnybodyPrincipal or org.jboss.security.NobodyPrincipal since these classes do not hash to meaningful values. @param member the principal whose membership is to be checked. @return true if the principal is a member of this group, false otherwise. */ public boolean isMember(Principal member) { // First see if there is a key with the member name boolean isMember = members.containsKey(member); /* if( isMember == false ) { // Check the AnybodyPrincipal & NobodyPrincipal special cases isMember = (member instanceof org.jboss.security.AnybodyPrincipal); if( isMember == false ) { if( member instanceof org.jboss.security.NobodyPrincipal ) return false; } } */ if( isMember == false ) { // Check any Groups for membership Collection values = members.values(); Iterator iter = values.iterator(); while( isMember == false && iter.hasNext() ) { Object next = iter.next(); if( next instanceof Group ) { Group group = (Group) next; isMember = group.isMember(member); } } } return isMember; } /** Returns an enumeration of the members in the group. The returned objects can be instances of either Principal or Group (which is a subinterface of Principal). @return an enumeration of the group members. */ public Enumeration members() { return Collections.enumeration(members.values()); } /** Removes the specified member from the group. @param user the principal to remove from this group. @return true if the principal was removed, or false if the principal was not a member. */ public boolean removeMember(Principal user) { Object prev = members.remove(user); return prev != null; } public String toString() { StringBuffer tmp = new StringBuffer(getName()); tmp.append("(members:"); Iterator iter = members.keySet().iterator(); while( iter.hasNext() ) { tmp.append(iter.next()); tmp.append(','); } tmp.setCharAt(tmp.length()-1, ')'); return tmp.toString(); } public synchronized Object clone() throws CloneNotSupportedException { SimpleGroup clone = (SimpleGroup) super.clone(); if(clone != null) clone.members = (HashMap)this.members.clone(); return clone; } }././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/loginconfig/SimplePrincipal.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/loginconfig/SimplePrincipal0000644000175000017500000000430611062060756033332 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.loginconfig; import java.security.Principal; /** A simple String based implementation of Principal. Typically a SimplePrincipal is created given a userID which is used as the Principal name. @author Oleg Nitz @author Scott.Stark@jboss.org */ public class SimplePrincipal implements Principal, java.io.Serializable { private static final long serialVersionUID = 1L; private String name; public SimplePrincipal(String name) { this.name = name; } /** Compare this SimplePrincipal's name against another Principal @return true if name equals another.getName(); */ public boolean equals(Object another) { if( !(another instanceof Principal) ) return false; String anotherName = ((Principal)another).getName(); boolean equals = false; if( name == null ) equals = anotherName == null; else equals = name.equals(anotherName); return equals; } public int hashCode() { return (name == null ? 0 : name.hashCode()); } public String toString() { return name; } public String getName() { return name; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/MiscUnitTestCase.java0000644000175000017500000003704211061473704032053 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.io.StringWriter; import java.net.URL; import java.util.Arrays; import java.util.Calendar; import java.util.List; import org.jboss.test.xml.sandbox.Choice1; import org.jboss.test.xml.sandbox.Choice2; import org.jboss.test.xml.sandbox.Choice3; import org.jboss.test.xml.sandbox.Root; import org.jboss.test.xml.immutable.Child1; import org.jboss.test.xml.immutable.Child2; import org.jboss.test.xml.immutable.Child3; import org.jboss.test.xml.immutable.ImmutableChoice; import org.jboss.test.xml.immutable.Parent; import org.jboss.test.xml.person.Person; import org.jboss.xb.binding.MappingObjectModelFactory; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.AbstractMarshaller; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; /** * Various tests that should later be categorized. * * @author Alexey Loubyansky * @version $Revision: 45498 $ */ public class MiscUnitTestCase extends AbstractJBossXBTest { //private static final Logger log = Logger.getLogger(MiscUnitTestCase.class); public MiscUnitTestCase(String localName) { super(localName); } public void testStringNormalization() throws Exception { String xsd = "" + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "" + "" + ""; String xml = "<>&"'"; String lastName = "<>&\"'"; String firstName = "'\"&><"; SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object unmarshalled = unmarshaller.unmarshal(new StringReader(xml), schema); assertNotNull(unmarshalled); assertTrue(unmarshalled instanceof Person); Person person = (Person)unmarshalled; assertEquals(firstName, person.getFirstName()); assertEquals(lastName, person.getLastName()); StringWriter writer = new StringWriter(); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.marshal(schema, null, person, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(xml, marshalled); } public void testImmutableXerces() throws Exception { immutableTest(new XercesXsMarshaller()); } public void testImmutableSunday() throws Exception { immutableTest(new MarshallerImpl()); } public void testEmptyElements() throws Exception { String xsd = "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + ""; String xml = "" + ""; SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object unmarshalled = unmarshaller.unmarshal(new StringReader(xml), schema); assertNotNull(unmarshalled); assertTrue(unmarshalled instanceof java.util.Date); } public void testBase64BinaryUnmarshalling() throws Exception { String xsd = "" + "" + " " + ""; SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); String xml = "" + ""; Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object result = unmarshaller.unmarshal(new StringReader(xml), schema); assertNull(result); xml = "" + ""; byte[] bytes = (byte[])unmarshaller.unmarshal(new StringReader(xml), schema); assertNotNull(bytes); assertEquals(0, bytes.length); } public void testEmptyStringUnmarshalling() throws Exception { String xsd = "" + "" + " " + ""; SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); String xml = "" + ""; Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); String result = (String)unmarshaller.unmarshal(new StringReader(xml), schema); assertEquals("", result); } public void testNullStringUnmarshalling() throws Exception { String xsd = "" + "" + " " + ""; SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); String xml = "" + ""; Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object result = unmarshaller.unmarshal(new StringReader(xml), schema); assertNull(result); } public void testDateTimeXerces() throws Exception { dateTimeTest(new XercesXsMarshaller()); } public void testDateTimeSunday() throws Exception { dateTimeTest(new MarshallerImpl()); } public void testJavaUtilDateXerces() throws Exception { javaUtilDateTest(new XercesXsMarshaller()); } public void testJavaUtilDateSunday() throws Exception { javaUtilDateTest(new MarshallerImpl()); } // Private private void javaUtilDateTest(AbstractMarshaller marshaller) throws Exception { String xsd = "" + "" + " " + ""; java.util.Date date = java.util.Calendar.getInstance().getTime(); marshaller.declareNamespace(null, "http://www.jboss.org/test/xml/datetime"); MappingObjectModelProvider provider = new MappingObjectModelProvider(); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(xsd), provider, date, writer); String marshalled = writer.getBuffer().toString(); SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Calendar cal = (Calendar)unmarshaller.unmarshal(new StringReader(marshalled), schema); assertEquals(date, cal.getTime()); } private void dateTimeTest(AbstractMarshaller marshaller) throws Exception { String xsd = "" + "" + " " + ""; SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); String xml = "" + "" + "2005-06-24T12:24:43.555+01:00"; Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object result = unmarshaller.unmarshal(new StringReader(xml), schema); marshaller.declareNamespace(null, "http://www.jboss.org/test/xml/datetime"); MappingObjectModelProvider provider = new MappingObjectModelProvider(); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(xsd), provider, result, writer); assertXmlEqual(xml, writer.getBuffer().toString()); } private void immutableTest(AbstractMarshaller marshaller) throws Exception { final URL xsdUrl = getUrl("xml/immutable.xsd"); Child1 child1 = new Child1("child1"); List child2 = Arrays.asList(new Object[]{new Child2("child2_1"), new Child2("child2_2")}); List others = Arrays.asList(new Object[]{new Child3("child3_1"), new Child3("child3_2"), new Child3("child3_3")}); List choice = Arrays.asList( new Object[]{new ImmutableChoice("choice1"), new ImmutableChoice(new Child1("child1"))} ); Parent parent = new Parent(child1, child2, others, choice); StringWriter writer = new StringWriter(); marshaller.declareNamespace("imm", "http://www.jboss.org/test/xml/immutable/"); //marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); marshaller.marshal(xsdUrl.toExternalForm(), new MappingObjectModelProvider(), parent, writer ); String xml = writer.getBuffer().toString(); SchemaBinding schema = XsdBinder.bind(xsdUrl.openStream(), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(xml), schema); assertEquals(parent, o); } private void assertUnmarshalled(Root unmarshalled) { Root root = new Root(); root.setChoiceCollection1( Arrays.asList(new Object[]{new Choice1("choice1_a", null), new Choice1(null, "choice1_b")}) ); root.setChoice2(Arrays.asList(new Object[]{new Choice2("choice2_c", "choice2_d", null), new Choice2(null, "choice2_d", "choice2_e") } ) ); root.setChoice3(Arrays.asList(new Object[]{ new Choice3(Arrays.asList(new Integer[]{new Integer(1), new Integer(2), new Integer(3)}), null), new Choice3(null, Arrays.asList(new String[]{"1", "2", "3"})) } ) ); assertEquals(root, unmarshalled); } private static String getXmlUrl(String name) { return getUrl(name).getFile(); } private static URL getUrl(String name) { URL xmlUrl = Thread.currentThread().getContextClassLoader().getResource(name); if(xmlUrl == null) { throw new IllegalStateException(name + " not found"); } return xmlUrl; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/initializer/0000755000175000017500000000000011620316735030337 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/initializer/Simple.java0000644000175000017500000000253210513427451032433 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.initializer; /** * Simple. * * @author Adrian Brock * @version $Revision: 40492 $ */ public class Simple { private String value; public String getValue() { return value; } public void setValue(String value) { this.value = value; } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/initializer/ContainerInitializer.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/initializer/ContainerInitia0000644000175000017500000000652110513427451033344 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.initializer; import javax.xml.namespace.QName; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.sunday.unmarshalling.DefaultWildcardHandler; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingInitializer; /** * ContainerInitializer. * * @author Adrian Brock * @version $Revision: 40741 $ */ public class ContainerInitializer implements SchemaBindingInitializer { public static final String NS = "dummy://www.jboss.org/container"; private static final QName containerStrictQName = new QName(NS, "containerStrict"); private static final QName containerLaxQName = new QName(NS, "containerLax"); private static final QName containerSkipQName = new QName(NS, "containerSkip"); private static final ContainerWildcardHandler wildcardHandler = new ContainerWildcardHandler(); public SchemaBinding init(SchemaBinding schema) { ClassMetaData classMetaData = new ClassMetaData(); classMetaData.setImpl(Container.class.getName()); PropertyMetaData property = new PropertyMetaData(); property.setName("value"); ElementBinding containerStrict = schema.getElement(containerStrictQName); containerStrict.setClassMetaData(classMetaData); containerStrict.getType().getWildcard().setWildcardHandler(wildcardHandler); ElementBinding containerLax = schema.getElement(containerLaxQName); containerLax.setClassMetaData(classMetaData); containerStrict.getType().getWildcard().setWildcardHandler(wildcardHandler); ElementBinding containerSkip = schema.getElement(containerSkipQName); containerSkip.setClassMetaData(classMetaData); containerStrict.getType().getWildcard().setWildcardHandler(wildcardHandler); return schema; } private static class ContainerWildcardHandler extends DefaultWildcardHandler { public void setParent(Object parent, Object o, QName elementName, ElementBinding element, ElementBinding parentElement) { Container container = (Container) parent; container.setValue(o); } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/initializer/Container.java0000644000175000017500000000254010513427451033123 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.initializer; /** * Container. * * @author Adrian Brock * @version $Revision: 40495 $ */ public class Container { private Object value; public Object getValue() { return value; } public void setValue(Object value) { this.value = value; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/initializer/SimpleInitializer.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/initializer/SimpleInitializ0000644000175000017500000000424310513427451033371 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.initializer; import javax.xml.namespace.QName; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingInitializer; /** * SimpleInitializer. * * @author Adrian Brock * @version $Revision: 41256 $ */ public class SimpleInitializer implements SchemaBindingInitializer { public static final String NS = "dummy://www.jboss.org/simple"; private static final QName testQName = new QName(NS, "test"); public SchemaBinding init(SchemaBinding schema) { ElementBinding test = schema.getElement(testQName); ClassMetaData classMetaData = new ClassMetaData(); classMetaData.setImpl(Simple.class.getName()); test.setClassMetaData(classMetaData); PropertyMetaData propMetaData = new PropertyMetaData(); propMetaData.setName("value"); test.setPropertyMetaData(propMetaData); return schema; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/NamespaceRegistryUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/NamespaceRegistryUnitTestCa0000644000175000017500000000622210513427451033330 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import junit.framework.TestCase; import org.jboss.xb.binding.NamespaceRegistry; /** * * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class NamespaceRegistryUnitTestCase extends TestCase { private String[] prefix = new String[]{"p1", "p2", "p3"}; private String[] uri = new String[]{"http://jboss.org/p1", "http://jboss.org/p2", "http://jboss.org/p3"}; private NamespaceRegistry ctx; public NamespaceRegistryUnitTestCase(String localName) { super(localName); } public void setUp() { ctx = new NamespaceRegistry(); for(int i = 0; i < prefix.length; ++i) { ctx.addPrefixMapping(prefix[i], uri[i]); } } public void testBasic() { for(int i = 0; i < prefix.length; ++i) { assertEquals(uri[i], ctx.getNamespaceURI(prefix[i])); assertEquals(prefix[i], ctx.getPrefix(uri[i])); } } public void testPrefixOverride() { String newUri1 = "http://jboss.org/new_uri_1"; ctx.addPrefixMapping(prefix[0], newUri1); assertEquals(newUri1, ctx.getNamespaceURI(prefix[0])); String newUri2 = "http://jboss.org/new_uri_2"; ctx.addPrefixMapping(prefix[0], newUri2); assertEquals(newUri2, ctx.getNamespaceURI(prefix[0])); ctx.removePrefixMapping(prefix[0]); assertEquals(newUri1, ctx.getNamespaceURI(prefix[0])); ctx.removePrefixMapping(prefix[0]); for(int i = 0; i < prefix.length; ++i) { assertEquals(uri[i], ctx.getNamespaceURI(prefix[i])); assertEquals(prefix[i], ctx.getPrefix(uri[i])); } ctx.removePrefixMapping(prefix[0]); assertNull(ctx.getPrefix(prefix[0])); } public void testDuplicateURIs() { String newPrefix = "p4"; ctx.addPrefixMapping(newPrefix, uri[0]); assertEquals(uri[0], ctx.getNamespaceURI(newPrefix)); for(int i = 0; i < prefix.length; ++i) { assertEquals(uri[i], ctx.getNamespaceURI(prefix[i])); } } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/DuplicateInterceptorUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/DuplicateInterceptorUnitTes0000644000175000017500000000770310527102732033406 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import javax.xml.namespace.QName; import junit.framework.TestSuite; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; /** * DuplicateInterceptorUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class DuplicateInterceptorUnitTestCase extends AbstractJBossXBTest { private static final String NS = "http://www.jboss.org/test/xml/duplicateInterceptor"; public static final TestSuite suite() { return new TestSuite(DuplicateInterceptorUnitTestCase.class); } public DuplicateInterceptorUnitTestCase(String name) { super(name); } public void testDuplicateInterceptor() throws Exception { SchemaBinding schema = bind("DuplicateInterceptor.xsd"); schema.setIgnoreUnresolvedFieldOrClass(false); ClassMetaData classMetaData = new ClassMetaData(); classMetaData.setImpl(Parent1.class.getName()); TypeBinding parent1Type = schema.getType(new QName(NS, "parent1Type")); assertNotNull(parent1Type); parent1Type.setClassMetaData(classMetaData); parent1Type.pushInterceptor(new QName(NS, "child"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName qName) { Parent1 parent1 = (Parent1) parent; Child c = (Child) child; c.string = c.string + "Parent1"; parent1.child = c; } }); classMetaData = new ClassMetaData(); classMetaData.setImpl(Parent2.class.getName()); TypeBinding parent2Type = schema.getType(new QName(NS, "parent2Type")); assertNotNull(parent2Type); parent2Type.setClassMetaData(classMetaData); parent2Type.pushInterceptor(new QName(NS, "child"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName qName) { fail("Should not invoke interceptor added to parent2Type when processing parent1!"); } }); classMetaData = new ClassMetaData(); classMetaData.setImpl(Child.class.getName()); TypeBinding childType = schema.getType(new QName(NS, "childType")); assertNotNull(childType); childType.setClassMetaData(classMetaData); Parent1 parent1 = (Parent1) unmarshal("DuplicateInterceptor.xml", schema, Parent1.class); assertNotNull(parent1.child); assertEquals("HelloParent1", parent1.child.string); } public static class Parent1 { public Child child; } public static class Parent2 { public Child child; } public static class Child { public String string; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AnyUnitTestCase.java0000644000175000017500000001013310513427451031676 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.FileReader; import java.net.URL; import javax.xml.namespace.QName; import org.jboss.test.xml.collections.Collections; import org.jboss.test.xml.any.Container; import org.jboss.test.BaseTestCase; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.w3c.dom.ls.LSInput; /** * @author Alexey Loubyansky * @version $Revision: 38057 $ */ public class AnyUnitTestCase extends BaseTestCase { public AnyUnitTestCase(String localName) { super(localName); } /* public void configureLogging() { enableTrace("org.jboss.xb"); } */ public void testMain() throws Exception { String xsd = getFullPath("xml/any.xsd"); SchemaBinding schema = XsdBinder.bind(xsd); schema.setIgnoreUnresolvedFieldOrClass(false); schema.setSchemaResolver(new SchemaBindingResolver() { public String getBaseURI() { throw new UnsupportedOperationException("getBaseURI is not implemented."); } public void setBaseURI(String baseURI) { throw new UnsupportedOperationException("setBaseURI is not implemented."); } public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation) { SchemaBinding schema = null; String ns = "http://www.jboss.org/test/xml/collections"; if(ns.equals(nsUri)) { String xsd = getFullPath("xml/collections.xsd"); schema = XsdBinder.bind(xsd); QName rootQName = new QName(ns, "collections"); TypeBinding type = schema.getType(rootQName); schema.addElement(rootQName, type); } return schema; } public LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation) { throw new UnsupportedOperationException("resolveResource is not implemented."); } } ); String xml = getFullPath("xml/any.xml"); FileReader xmlReader = new FileReader(xml); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(xmlReader, schema); Container container = new Container(); container.setId("any test"); container.setAnyContent(Collections.getInstance()); assertEquals(container, o); } // Private private String getFullPath(String name) { URL url = Thread.currentThread().getContextClassLoader().getResource(name); if(url == null) { fail("Resource not found: " + name); } return url.getFile(); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SchemaImportUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SchemaImportUnitTestCase.ja0000644000175000017500000001554411061473704033227 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.util.List; import java.util.Collections; import java.io.StringReader; import java.io.StringWriter; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.jboss.xb.binding.sunday.unmarshalling.LSInputAdaptor; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.Marshaller; import org.jboss.xb.binding.AbstractMarshaller; import org.jboss.test.xml.book.Book; import org.w3c.dom.ls.LSInput; /** * @author Alexey Loubyansky * @version $Revision: 45336 $ */ public class SchemaImportUnitTestCase extends AbstractJBossXBTest { private static final String NS = "http://www.jboss.org/test/xml/schema-import"; private static final String XSD = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; private static final String XML = "" + "" + "Ti t le" + "A.U.Thor" + "" + ""; private static final SchemaBindingResolver SCHEMA_RESOLVER = new SchemaBindingResolver() { public String getBaseURI() { throw new UnsupportedOperationException("getBaseURI is not implemented."); } public void setBaseURI(String baseURI) { throw new UnsupportedOperationException("setBaseURI is not implemented."); } public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation) { throw new UnsupportedOperationException("resolve is not implemented."); } public LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation) { if("http://example.org/ns/books/".equals(nsUri)) { return new LSInputAdaptor( Thread.currentThread().getContextClassLoader(). getResourceAsStream("xml/book/annotated_books.xsd"), null); } return null; } }; public SchemaImportUnitTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(XSD), null, SCHEMA_RESOLVER); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML), schema); assertNotNull(o); assertTrue(o instanceof List); List list = (List)o; assertEquals(1, list.size()); o = list.get(0); assertTrue(o instanceof Book); Book book = (Book)o; assertEquals("123", book.getIsbn()); assertEquals("Ti t le", book.getTitle()); assertEquals("A.U.Thor", book.getAuthor()); } public void testMarshallingXerces() throws Exception { Book book = new Book(); book.setIsbn("123"); book.setTitle("Ti t le"); book.setAuthor("A.U.Thor"); String marshalled = marshalXerces(book); assertXmlEqual(XML, marshalled); } public void testMarshallingSunday() throws Exception { Book book = new Book(); book.setIsbn("123"); book.setTitle("Ti t le"); book.setAuthor("A.U.Thor"); String marshalled = marshalSunday(book); assertXmlEqual(XML, marshalled); } private String marshalXerces(Book book) throws Exception { StringWriter writer = new StringWriter(); XercesXsMarshaller marshaller = new XercesXsMarshaller(); initMarshaller(marshaller); marshaller.setSchemaResolver(SCHEMA_RESOLVER); marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), Collections.singleton(book), writer); return writer.getBuffer().toString(); } private String marshalSunday(Book book) throws Exception { StringWriter writer = new StringWriter(); MarshallerImpl marshaller = new MarshallerImpl(); initMarshaller(marshaller); marshaller.setSchemaResolver(SCHEMA_RESOLVER); marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), Collections.singleton(book), writer); return writer.getBuffer().toString(); } private void initMarshaller(AbstractMarshaller marshaller) { marshaller.setProperty(Marshaller.PROP_OUTPUT_XML_VERSION, "false"); marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); marshaller.declareNamespace("", NS); marshaller.declareNamespace("bk", "http://example.org/ns/books/"); marshaller.addRootElement(NS, "", "root"); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/RepeatedElementsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/RepeatedElementsUnitTestCas0000644000175000017500000000432010513703171033305 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import junit.framework.TestSuite; /*** * RepeatedElementUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class RepeatedElementsUnitTestCase extends AbstractJBossXBTest { public static final TestSuite suite() { return new TestSuite(RepeatedElementsUnitTestCase.class); } public RepeatedElementsUnitTestCase(String name) { super(name); } public void testRepeatedElements() throws Exception { Object o = unmarshal(); assertNotNull(o); assertTrue(o instanceof Top); Top top = (Top) o; assertEquals("one", top.one); assertEquals("two", top.two); } public static final class Top { public String one; public String two; public String getChild() { return null; } public void setChild(String string) { if (one == null) one = string; else if (two == null) two = string; else throw new IllegalArgumentException("Too many children"); } } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SimpleTypeBindingUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SimpleTypeBindingUnitTestCa0000644000175000017500000005454711061473704033307 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import junit.framework.TestCase; import org.jboss.xb.binding.SimpleTypeBindings; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Iterator; import java.util.Collections; import java.util.List; import java.util.Arrays; import java.util.TimeZone; import java.math.BigInteger; import java.math.BigDecimal; import java.net.URI; /** * @author Alexey Loubyansky * @version $Revision: 40286 $ */ public class SimpleTypeBindingUnitTestCase extends TestCase { public SimpleTypeBindingUnitTestCase() { } public SimpleTypeBindingUnitTestCase(String localName) { super(localName); } public void testIntUnmarshalling() throws Exception { assertEquals(Integer.MAX_VALUE, ((Integer)SimpleTypeBindings.unmarshal("int", Integer.toString(Integer.MAX_VALUE), null)).intValue() ); assertEquals(Integer.MIN_VALUE, ((Integer)SimpleTypeBindings.unmarshal("int", Integer.toString(Integer.MIN_VALUE), null)).intValue() ); } public void testLongUnmarshalling() throws Exception { assertEquals(Long.MAX_VALUE, ((Long)SimpleTypeBindings.unmarshal("long", Long.toString(Long.MAX_VALUE), null)).longValue() ); assertEquals(Long.MIN_VALUE, ((Long)SimpleTypeBindings.unmarshal("long", Long.toString(Long.MIN_VALUE), null)).longValue() ); } public void testShortUnmarshalling() throws Exception { assertEquals(Short.MAX_VALUE, ((Short)SimpleTypeBindings.unmarshal("short", Short.toString(Short.MAX_VALUE), null)).shortValue() ); assertEquals(Short.MIN_VALUE, ((Short)SimpleTypeBindings.unmarshal("short", Short.toString(Short.MIN_VALUE), null)).shortValue() ); } public void testByteUnmarshalling() throws Exception { assertEquals(Byte.MAX_VALUE, ((Byte)SimpleTypeBindings.unmarshal("byte", Byte.toString(Byte.MAX_VALUE), null)).byteValue() ); assertEquals(Byte.MIN_VALUE, ((Byte)SimpleTypeBindings.unmarshal("byte", Byte.toString(Byte.MIN_VALUE), null)).byteValue() ); } public void testFloatUnmarshalling() throws Exception { assertEquals(Float.MAX_VALUE, ((Float)SimpleTypeBindings.unmarshal("float", Float.toString(Float.MAX_VALUE), null)).floatValue(), 0 ); assertEquals(Float.MIN_VALUE, ((Float)SimpleTypeBindings.unmarshal("float", Float.toString(Float.MIN_VALUE), null)).floatValue(), 0 ); assertEquals(-1E4, ((Float)SimpleTypeBindings.unmarshal("float", "-1E4", null)).floatValue(), 0); assertEquals(1267.43233E12, ((Float)SimpleTypeBindings.unmarshal("float", "1267.43233E12", null)).floatValue(), 1.267432366800896E15 - 1.26743233E15 ); assertEquals(12.78e-2, ((Float)SimpleTypeBindings.unmarshal("float", "12.78e-2", null)).floatValue(), 0.12780000269412994 - 0.1278 ); assertEquals(-0, ((Float)SimpleTypeBindings.unmarshal("float", "-0", null)).floatValue(), 0); assertEquals(Float.POSITIVE_INFINITY, ((Float)SimpleTypeBindings.unmarshal("float", "INF", null)).floatValue(), 0 ); } public void testDoubleUnmarshalling() throws Exception { assertEquals(Double.MAX_VALUE, ((Double)SimpleTypeBindings.unmarshal("double", Double.toString(Double.MAX_VALUE), null)).doubleValue(), 0 ); assertEquals(Double.MIN_VALUE, ((Double)SimpleTypeBindings.unmarshal("double", Double.toString(Double.MIN_VALUE), null)).doubleValue(), 0 ); assertEquals(-1E4, ((Double)SimpleTypeBindings.unmarshal("double", "-1E4", null)).doubleValue(), 0); assertEquals(1267.43233E12, ((Double)SimpleTypeBindings.unmarshal("double", "1267.43233E12", null)).doubleValue(), 1.267432366800896E15 - 1.26743233E15 ); assertEquals(12.78e-2, ((Double)SimpleTypeBindings.unmarshal("double", "12.78e-2", null)).doubleValue(), 0.12780000269412994 - 0.1278 ); assertEquals(-0, ((Double)SimpleTypeBindings.unmarshal("double", "-0", null)).doubleValue(), 0); assertEquals(Double.POSITIVE_INFINITY, ((Double)SimpleTypeBindings.unmarshal("double", "INF", null)).doubleValue(), 0 ); } public void testBooleanUnmarshalling() throws Exception { assertEquals(Boolean.TRUE, SimpleTypeBindings.unmarshal("boolean", "true", null)); assertEquals(Boolean.TRUE, SimpleTypeBindings.unmarshal("boolean", "1", null)); assertEquals(Boolean.FALSE, SimpleTypeBindings.unmarshal("boolean", "false", null)); assertEquals(Boolean.FALSE, SimpleTypeBindings.unmarshal("boolean", "0", null)); } public void testIntegerUnmarshalling() throws Exception { assertEquals(new BigInteger("-1"), SimpleTypeBindings.unmarshal("integer", "-1", null)); assertEquals(new BigInteger("0"), SimpleTypeBindings.unmarshal("integer", "0", null)); assertEquals(new BigInteger("12678967543233"), SimpleTypeBindings.unmarshal("integer", "12678967543233", null)); } public void testDecimalUnmarshalling() throws Exception { assertEquals(new BigDecimal("-1.23"), SimpleTypeBindings.unmarshal("decimal", "-1.23", null)); assertEquals(new BigDecimal("12678967.543233"), SimpleTypeBindings.unmarshal("decimal", "12678967.543233", null) ); } public void testDecimalMarshalling() throws Exception { assertEquals("-1.23",SimpleTypeBindings.marshal("decimal", new BigDecimal("-1.23"), null)); assertEquals("12678967.543233", SimpleTypeBindings.marshal("decimal", new BigDecimal("12678967.543233"), null)); assertEquals("0.0000000001", SimpleTypeBindings.marshal("decimal", new BigDecimal("0.0000000001"), null)); assertEquals("0.000000000001", SimpleTypeBindings.marshal("decimal", new BigDecimal("0.000000000001"), null)); } public void testAnyUriUnmarshalling() throws Exception { assertEquals(new URI("http://jboss.org"), SimpleTypeBindings.unmarshal("anyURI", "http://jboss.org", null)); } public void testUnsignedLongUnmarshalling() throws Exception { assertEquals(new BigInteger("18446744073709551615"), SimpleTypeBindings.unmarshal("unsignedLong", "18446744073709551615", null) ); } public void testUnsignedIntUnmarshalling() throws Exception { assertEquals(new Long(4294967295L), SimpleTypeBindings.unmarshal("unsignedInt", "4294967295", null)); } public void testUnsignedShortUnmarshalling() throws Exception { assertEquals(new Integer(65535), SimpleTypeBindings.unmarshal("unsignedShort", "65535", null)); } public void testUnsignedByteUnmarshalling() throws Exception { assertEquals(Short.valueOf("255"), SimpleTypeBindings.unmarshal("unsignedByte", "255", null)); } public void testNonPositiveIntegerUnmarshalling() throws Exception { assertEquals(new BigInteger("0"), SimpleTypeBindings.unmarshal("nonPositiveInteger", "0", null)); assertEquals(new BigInteger("-12678967543233"), SimpleTypeBindings.unmarshal("nonPositiveInteger", "-12678967543233", null) ); } public void testPositiveIntegerUnmarshalling() throws Exception { assertEquals(new BigInteger("12678967543233"), SimpleTypeBindings.unmarshal("positiveInteger", "12678967543233", null) ); } public void testNonNegativeIntegerUnmarshalling() throws Exception { assertEquals(new BigInteger("0"), SimpleTypeBindings.unmarshal("nonNegativeInteger", "0", null)); assertEquals(new BigInteger("12678967543233"), SimpleTypeBindings.unmarshal("nonNegativeInteger", "12678967543233", null) ); } public void testNegativeIntegerUnmarshalling() throws Exception { assertEquals(new BigInteger("-12678967543233"), SimpleTypeBindings.unmarshal("negativeInteger", "-12678967543233", null) ); } public void testNMTokensUnmarshalling() throws Exception { String[] tokens = SimpleTypeBindings.unmarshalNMTokens("1\n2\n3\n"); assertEquals(3, tokens.length); assertEquals("1", tokens[0]); assertEquals("2", tokens[1]); assertEquals("3", tokens[2]); } public void testGMonthDayUnmarshalling() throws Exception { Calendar cal = SimpleTypeBindings.unmarshalGMonthDay("--12-31-02:00"); assertEquals(1970, cal.get(Calendar.YEAR)); assertEquals(11, cal.get(Calendar.MONTH)); assertEquals(31, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(0, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(0, cal.get(Calendar.MINUTE)); assertEquals(0, cal.get(Calendar.SECOND)); assertEquals(0, cal.get(Calendar.MILLISECOND)); assertEquals("GMT-02:00", cal.getTimeZone().getDisplayName()); cal = SimpleTypeBindings.unmarshalGMonthDay("--12-31"); assertEquals(1970, cal.get(Calendar.YEAR)); assertEquals(11, cal.get(Calendar.MONTH)); assertEquals(31, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(0, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(0, cal.get(Calendar.MINUTE)); assertEquals(0, cal.get(Calendar.SECOND)); assertEquals(0, cal.get(Calendar.MILLISECOND)); } public void testGMonthUnmarshalling() throws Exception { Calendar cal = SimpleTypeBindings.unmarshalGMonth("--12+03:00"); assertEquals(1970, cal.get(Calendar.YEAR)); assertEquals(11, cal.get(Calendar.MONTH)); assertEquals(1, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(0, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(0, cal.get(Calendar.MINUTE)); assertEquals(0, cal.get(Calendar.SECOND)); assertEquals(0, cal.get(Calendar.MILLISECOND)); assertEquals("GMT+03:00", cal.getTimeZone().getDisplayName()); cal = SimpleTypeBindings.unmarshalGMonth("--12"); assertEquals(1970, cal.get(Calendar.YEAR)); assertEquals(11, cal.get(Calendar.MONTH)); assertEquals(1, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(0, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(0, cal.get(Calendar.MINUTE)); assertEquals(0, cal.get(Calendar.SECOND)); assertEquals(0, cal.get(Calendar.MILLISECOND)); } public void testGYearUnmarshalling() throws Exception { Calendar cal = SimpleTypeBindings.unmarshalGYear("1997-03:00"); assertEquals(1997, cal.get(Calendar.YEAR)); assertEquals(0, cal.get(Calendar.MONTH)); assertEquals(1, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(0, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(0, cal.get(Calendar.MINUTE)); assertEquals(0, cal.get(Calendar.SECOND)); assertEquals(0, cal.get(Calendar.MILLISECOND)); assertEquals("GMT-03:00", cal.getTimeZone().getDisplayName()); cal = SimpleTypeBindings.unmarshalGYear("1997"); assertEquals(1997, cal.get(Calendar.YEAR)); assertEquals(0, cal.get(Calendar.MONTH)); assertEquals(1, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(0, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(0, cal.get(Calendar.MINUTE)); assertEquals(0, cal.get(Calendar.SECOND)); assertEquals(0, cal.get(Calendar.MILLISECOND)); } public void testGYearMonthUnmarshalling() throws Exception { Calendar cal = SimpleTypeBindings.unmarshalGYearMonth("1995-04+01:00"); assertEquals(1995, cal.get(Calendar.YEAR)); assertEquals(3, cal.get(Calendar.MONTH)); assertEquals(1, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(0, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(0, cal.get(Calendar.MINUTE)); assertEquals(0, cal.get(Calendar.SECOND)); assertEquals(0, cal.get(Calendar.MILLISECOND)); assertEquals("GMT+01:00", cal.getTimeZone().getDisplayName()); cal = SimpleTypeBindings.unmarshalGYearMonth("1995-04"); assertEquals(1995, cal.get(Calendar.YEAR)); assertEquals(3, cal.get(Calendar.MONTH)); assertEquals(1, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(0, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(0, cal.get(Calendar.MINUTE)); assertEquals(0, cal.get(Calendar.SECOND)); assertEquals(0, cal.get(Calendar.MILLISECOND)); } public void testDatetimeUnmarshalling() throws Exception { Calendar cal = SimpleTypeBindings.unmarshalDateTime("1980-02-19T03:22:17.333+02:00"); assertEquals(1980, cal.get(Calendar.YEAR)); assertEquals(1, cal.get(Calendar.MONTH)); assertEquals(19, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(3, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(22, cal.get(Calendar.MINUTE)); assertEquals(17, cal.get(Calendar.SECOND)); assertEquals(333, cal.get(Calendar.MILLISECOND)); assertEquals("GMT+02:00", cal.getTimeZone().getDisplayName()); } public void testTimeUnmarshalling() throws Exception { String value = "23:32:28.123+01:00"; Calendar cal = SimpleTypeBindings.unmarshalTime(value); assertEquals(1970, cal.get(Calendar.YEAR)); assertEquals(0, cal.get(Calendar.MONTH)); assertEquals(1, cal.get(Calendar.DAY_OF_MONTH)); assertEquals("GMT+01:00", cal.getTimeZone().getDisplayName()); assertEquals(23, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(32, cal.get(Calendar.MINUTE)); assertEquals(28, cal.get(Calendar.SECOND)); assertEquals(123, cal.get(Calendar.MILLISECOND)); value = "23:32:28.123+01:00"; cal = SimpleTypeBindings.unmarshalTime(value); assertEquals(1970, cal.get(Calendar.YEAR)); assertEquals(0, cal.get(Calendar.MONTH)); assertEquals(1, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(23, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(32, cal.get(Calendar.MINUTE)); assertEquals(28, cal.get(Calendar.SECOND)); assertEquals(123, cal.get(Calendar.MILLISECOND)); } public void testDateUnmarshalling() throws Exception { String value = "2004-12-01+01:00"; Calendar cal = SimpleTypeBindings.unmarshalDate(value); assertEquals(2004, cal.get(Calendar.YEAR)); assertEquals(11, cal.get(Calendar.MONTH)); assertEquals(1, cal.get(Calendar.DAY_OF_MONTH)); assertEquals("GMT+01:00", cal.getTimeZone().getDisplayName()); assertEquals(0, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(0, cal.get(Calendar.MINUTE)); assertEquals(0, cal.get(Calendar.SECOND)); assertEquals(0, cal.get(Calendar.MILLISECOND)); value = "2004-12-01"; cal = SimpleTypeBindings.unmarshalDate(value); assertEquals(2004, cal.get(Calendar.YEAR)); assertEquals(11, cal.get(Calendar.MONTH)); assertEquals(1, cal.get(Calendar.DAY_OF_MONTH)); assertEquals(0, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(0, cal.get(Calendar.MINUTE)); assertEquals(0, cal.get(Calendar.SECOND)); assertEquals(0, cal.get(Calendar.MILLISECOND)); value = "-2004-12-01+01:00"; cal = SimpleTypeBindings.unmarshalDate(value); assertEquals(2004, cal.get(Calendar.YEAR)); assertEquals(11, cal.get(Calendar.MONTH)); assertEquals(1, cal.get(Calendar.DAY_OF_MONTH)); assertEquals("GMT+01:00", cal.getTimeZone().getDisplayName()); assertEquals(0, cal.get(Calendar.HOUR_OF_DAY)); assertEquals(0, cal.get(Calendar.MINUTE)); assertEquals(0, cal.get(Calendar.SECOND)); assertEquals(0, cal.get(Calendar.MILLISECOND)); } public void testDateMarshalling() throws Exception { Calendar c = new GregorianCalendar(6,5,1,10,0,0); c.setTimeZone(TimeZone.getTimeZone("GMT")); String marshalled = SimpleTypeBindings.marshalDate(c); assertEquals("0006-06-01Z", marshalled); } public void testHexBinary() throws Exception { String s = "kloop"; String marshalled = SimpleTypeBindings.marshal("hexBinary", s.getBytes(), null); byte[] bytes = (byte[])SimpleTypeBindings.unmarshal("hexBinary", marshalled, null); String unmarshalled = new String(bytes); assertEquals(s, unmarshalled); } public void testQName() throws Exception { final String ns = "http://jboss.org/test/simple/bindings"; String local = "test1"; final String prefix = "p1"; QName qName = new QName(ns, local, prefix); NamespaceContext nsCtx = new NamespaceContext() { public String getNamespaceURI(String p) { if(!prefix.equals(p)) { throw new IllegalStateException("The only supported prefix is " + prefix + " but got " + p); } return ns; } public String getPrefix(String namespaceURI) { if(!ns.equals(namespaceURI)) { throw new IllegalStateException("The only supported uri is " + ns + " but got " + namespaceURI); } return prefix; } public Iterator getPrefixes(String namespaceURI) { if(!ns.equals(namespaceURI)) { throw new IllegalStateException("The only supported uri is " + ns + " but got " + namespaceURI); } return Collections.singletonList(prefix).iterator(); } }; String marshalled = SimpleTypeBindings.marshal(SimpleTypeBindings.XS_QNAME_NAME, qName, nsCtx); assertEquals(prefix + ":" + local, marshalled); QName unmarshalled = (QName)SimpleTypeBindings.unmarshal(SimpleTypeBindings.XS_QNAME_NAME, marshalled, nsCtx); assertEquals(qName.getPrefix(), unmarshalled.getPrefix()); assertEquals(qName.getNamespaceURI(), unmarshalled.getNamespaceURI()); assertEquals(qName.getLocalPart(), unmarshalled.getLocalPart()); } public void testNoPrefixQName() throws Exception { final String ns = "http://jboss.org/test/simple/bindings"; String local = "test1"; QName qName = new QName(ns, local); NamespaceContext nsCtx = new NamespaceContext() { public String getNamespaceURI(String p) { return null; } public String getPrefix(String namespaceURI) { return null; } public Iterator getPrefixes(String namespaceURI) { return Collections.emptyList().iterator(); } }; String marshalled = SimpleTypeBindings.marshal(SimpleTypeBindings.XS_QNAME_NAME, qName, nsCtx); assertEquals('{' + ns + '}' + local, marshalled); QName unmarshalled = (QName)SimpleTypeBindings.unmarshal(SimpleTypeBindings.XS_QNAME_NAME, marshalled, nsCtx); assertEquals(qName.getPrefix(), unmarshalled.getPrefix()); assertEquals(qName.getNamespaceURI(), unmarshalled.getNamespaceURI()); assertEquals(qName.getLocalPart(), unmarshalled.getLocalPart()); } public void testBooleanListUnmarshalling() throws Exception { List booleans = SimpleTypeBindings.unmarshalList( SimpleTypeBindings.XS_BOOLEAN_NAME, " 1 1 0 true true false ", null ); assertNotNull(booleans); assertEquals(6, booleans.size()); int i = 0; Boolean item = (Boolean)booleans.get(i++); assertNotNull(item); assertTrue(item.booleanValue()); item = (Boolean)booleans.get(i++); assertNotNull(item); assertTrue(item.booleanValue()); item = (Boolean)booleans.get(i++); assertNotNull(item); assertFalse(item.booleanValue()); item = (Boolean)booleans.get(i++); assertNotNull(item); assertTrue(item.booleanValue()); item = (Boolean)booleans.get(i++); assertNotNull(item); assertTrue(item.booleanValue()); item = (Boolean)booleans.get(i++); assertNotNull(item); assertFalse(item.booleanValue()); } public void testBooleanListMarshalling() throws Exception { String marshalled = SimpleTypeBindings.marshalList( SimpleTypeBindings.XS_BOOLEAN_NAME, Arrays.asList(new Boolean[]{Boolean.TRUE, Boolean.TRUE, Boolean.FALSE, Boolean.TRUE}), null ); assertNotNull(marshalled); assertEquals("true true false true", marshalled); } public void testBase64BinaryUnmarshalling() throws Exception { byte[] unmarshalled = (byte[]) SimpleTypeBindings.unmarshal("base64Binary", "VGVzdCBNZXNzYWdl", null); assertEquals("Test Message", new String(unmarshalled)); } public void testBase64BinaryGZippedUnmarshalling() throws Exception { // GZipped content should NOT be automatically unzipped. byte[] unmarshalled = (byte[]) SimpleTypeBindings.unmarshal("base64Binary", "H4sIAAAAAAAAAAtJLS5R8E0tLk5MTwUA74UAyAwAAAA=", null); assertEquals(32, unmarshalled.length); assertFalse("Test Message".equals(new String(unmarshalled))); } public void testBase64BinaryMarshalling() throws Exception { String marshalled = SimpleTypeBindings.marshal("base64Binary", "Test Message".getBytes(), null); assertEquals("VGVzdCBNZXNzYWdl", marshalled); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AnyTypeDomBindingUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AnyTypeDomBindingUnitTestCa0000644000175000017500000001217410605210763033230 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringWriter; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.w3c.dom.Element; /** * @author Alexey Loubyansky * @version $Revision: 46112 $ */ public class AnyTypeDomBindingUnitTestCase extends AbstractJBossXBTest { public AnyTypeDomBindingUnitTestCase(String name) { super(name); } public void testComplexContentUnmarshalling() throws Exception { SchemaBinding schema = bindSchema(); Object unmarshalled = unmarshal(rootName + "_complexContent.xml", schema); assertNotNull(unmarshalled); assertTrue(unmarshalled instanceof MyType); MyType mt = (MyType) unmarshalled; assertNotNull(mt.anything); assertTrue(mt.anything.toString(), mt.anything instanceof Element); Element dom = (Element) mt.anything; assertEquals("dom", dom.getLocalName()); assertEquals(null, dom.getNamespaceURI()); assertEquals("test", dom.getTextContent()); } public void testSimpleContentUnmarshalling() throws Exception { SchemaBinding schema = bindSchema(); Object unmarshalled = unmarshal(rootName + "_simpleContent.xml", schema); assertNotNull(unmarshalled); assertTrue(unmarshalled instanceof MyType); MyType mt = (MyType) unmarshalled; assertNotNull(mt.anything); assertTrue(mt.anything instanceof String); assertEquals("test", mt.anything); } public void testComplexContentMarshalling() throws Exception { SchemaBinding schema = bindSchema(); DocumentBuilder domBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Element dom = domBuilder.newDocument().createElement("dom"); dom.setTextContent("test"); MyType root = new MyType(); root.anything = dom; MarshallerImpl marshaller = new MarshallerImpl(); StringWriter writer = new StringWriter(); marshaller.marshal(schema, null, root, writer); assertXmlFileContent(rootName + "_complexContent.xml", writer.getBuffer().toString()); } public void testSimpleContentMarshalling() throws Exception { SchemaBinding schema = bindSchema(); DocumentBuilder domBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Element dom = domBuilder.newDocument().createElementNS("http://ns1", "dom"); dom.setTextContent("test"); MyType root = new MyType(); root.anything = "test"; MarshallerImpl marshaller = new MarshallerImpl(); StringWriter writer = new StringWriter(); marshaller.marshal(schema, null, root, writer); assertXmlFileContent(rootName + "_simpleContent.xml", writer.getBuffer().toString()); } private SchemaBinding bindSchema() throws Exception { SchemaBinding schema = bind(rootName + ".xsd"); schema.setIgnoreUnresolvedFieldOrClass(false); //schema.setUnresolvedContentBoundToDOM(true); // is true by default and equivalent to /* TypeBinding myType = schema.getType(new QName("http://www.jboss.org/xb/test/any", "myType")); SequenceBinding seq = (SequenceBinding)myType.getParticle().getTerm(); ElementBinding anything = (ElementBinding)((ParticleBinding)seq.getParticles().iterator().next()).getTerm(); TypeBinding anyType = anything.getType(); WildcardBinding wc = anyType.getWildcard(); wc.setUnresolvedElementHandler(DomParticleHandler.INSTANCE); wc.setUnresolvedCharactersHandler(DomCharactersHandler.INSTANCE); wc.setUnresolvedMarshaller(DomLocalMarshaller.INSTANCE); */ assertTrue(schema.isUnresolvedContentBoundToDOM()); return schema; } public static class MyType { public Object anything; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/MultispacedUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/MultispacedUnitTestCase.jav0000644000175000017500000002442011061473704033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import junit.framework.TestCase; import java.io.InputStream; import java.io.Reader; import java.io.InputStreamReader; import java.io.StringWriter; import java.io.StringReader; import java.util.List; import java.net.URL; import org.jboss.xb.binding.Marshaller; import org.jboss.xb.binding.ObjectModelProvider; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.AbstractMarshaller; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.test.xml.multispaced.pm.jdbc.JDBCPmMetaDataFactory; import org.jboss.test.xml.multispaced.pm.jdbc.JDBCPm; import org.jboss.test.xml.multispaced.pm.jdbc.JDBCPmMetaDataProvider; import org.jboss.test.xml.multispaced.XMBeanMetaData; import org.jboss.test.xml.multispaced.XMBeanMetaDataFactory; import org.jboss.test.xml.multispaced.XMBeanMetaDataProvider; import org.jboss.test.xml.multispaced.XMBeanOperationMetaData; import org.jboss.test.xml.multispaced.XMBeanAttributeMetaData; import org.jboss.test.xml.multispaced.XMBeanConstructorMetaData; import org.jboss.test.xml.multispaced.XMBeanNotificationMetaData; import org.jboss.logging.Logger; /** * @author Alexey Loubyansky * @version $Revision: 45336 $ */ public class MultispacedUnitTestCase extends TestCase { private static final Logger log = Logger.getLogger(MultispacedUnitTestCase.class); public MultispacedUnitTestCase() { } public MultispacedUnitTestCase(String name) { super(name); } public void testMultispacedUnmarshalling() throws Exception { log.debug("--- " + getName()); InputStream xmlIs = getResource("xml/multispaced/xmbean.xml"); InputStreamReader xmlReader = new InputStreamReader(xmlIs); XMBeanMetaData xmbean = unmarshalXMBean(xmlReader); xmlReader.close(); checkUnmarshalledXMBean(xmbean); } public void testMultispacedUnmarshalling2() throws Exception { log.debug("--- " + getName()); InputStream xmlIs = getResource("xml/multispaced/xmbean-localns.xml"); InputStreamReader xmlReader = new InputStreamReader(xmlIs); XMBeanMetaData xmbean = unmarshalXMBean(xmlReader); xmlReader.close(); checkUnmarshalledXMBean(xmbean); } public void testMarshallingXerces() throws Exception { log.debug("--- " + getName()); System.setProperty(Marshaller.PROP_MARSHALLER, XercesXsMarshaller.class.getName()); marshallingTest(); } public void testMarshallingSunday() throws Exception { log.debug("--- " + getName()); System.setProperty(Marshaller.PROP_MARSHALLER, MarshallerImpl.class.getName()); marshallingTest(); } // Private private void marshallingTest() throws Exception { StringWriter strWriter = new StringWriter(); AbstractMarshaller marshaller = (AbstractMarshaller)Marshaller.FACTORY.getInstance(); marshaller.addRootElement("http://jboss.org/xmbean", "xmbean", "mbean"); marshaller.declareNamespace("xmbean", "http://jboss.org/xmbean"); marshaller.declareNamespace("jdbcpm", "http://jboss.org/xmbean/persistence/jdbc"); XMBeanMetaData xmbean = createXMBeanMetaData(); ObjectModelProvider provider = XMBeanMetaDataProvider.INSTANCE; ObjectModelProvider jdbcPmProvider = new JDBCPmMetaDataProvider((JDBCPm)xmbean.getPersistenceManager()); marshaller.mapClassToGlobalElement(JDBCPm.class, "persistence-manager", "http://jboss.org/xmbean/persistence/jdbc", getResourceUrl("xml/multispaced/jdbcpm.xsd").toString(), jdbcPmProvider ); marshaller.marshal(getResourceUrl("xml/multispaced/xmbean.xsd").toString(), provider, xmbean, strWriter); final String xml = strWriter.getBuffer().toString(); log.debug("marshalled with " + marshaller.getClass().getName() + ": " + xml); StringReader xmlReader = new StringReader(xml); XMBeanMetaData unmarshalled = unmarshalXMBean(xmlReader); assertEquals(xmbean, unmarshalled); } private XMBeanMetaData unmarshalXMBean(Reader xmlReader) throws Exception { XMBeanMetaData xmbean = new XMBeanMetaData(); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.mapFactoryToNamespace(JDBCPmMetaDataFactory.INSTANCE, "http://jboss.org/xmbean/persistence/jdbc"); unmarshaller.unmarshal(xmlReader, XMBeanMetaDataFactory.INSTANCE, xmbean); return xmbean; } private void checkUnmarshalledXMBean(XMBeanMetaData xmbean) { log.debug("xmbean: " + xmbean); assertEquals("The JBoss XMBean version of the monitor server", xmbean.getDescription()); assertEquals("monitor.MonitorPOJO", xmbean.getMbeanClass()); final List constructors = xmbean.getConstructors(); assertEquals(1, constructors.size()); XMBeanConstructorMetaData constructor = constructors.get(0); assertEquals("The no-arg constructor", constructor.getDescription()); assertEquals("monitor.MonitorPOJO", constructor.getName()); final List attributes = xmbean.getAttributes(); assertEquals(1, attributes.size()); XMBeanAttributeMetaData attribute = attributes.get(0); assertEquals("read-write", attribute.getAccess()); assertEquals("getInterval", attribute.getGetMethod()); assertEquals("setInterval", attribute.getSetMethod()); assertEquals("The interval in milliseconds between checks of VM memory and threads", attribute.getDescription()); assertEquals("Interval", attribute.getName()); assertEquals("int", attribute.getType()); final List operations = xmbean.getOperations(); assertEquals(1, operations.size()); XMBeanOperationMetaData operation = operations.get(0); assertEquals("Access the last HistoryLength monitor reports", operation.getDescription()); assertEquals("history", operation.getName()); assertEquals("java.lang.String", operation.getReturnType()); final List notifications = xmbean.getNotifications(); assertEquals(1, notifications.size()); XMBeanNotificationMetaData notification = notifications.get(0); assertEquals("A notification sent when the monitor interval expires", notification.getDescription()); assertEquals("javax.management.Notification", notification.getName()); assertEquals("monitor.IntervalElapsed", notification.getNotificationType()); final JDBCPm pm = (JDBCPm)xmbean.getPersistenceManager(); if(pm == null) { fail("persistence-manager is null."); } assertEquals("java:/DefaultDS", pm.getDatasource()); assertEquals("xmbeans", pm.getTable()); } private XMBeanMetaData createXMBeanMetaData() { XMBeanMetaData xmbean = new XMBeanMetaData(); xmbean.setDescription("The JBoss XMBean version of the monitor server"); xmbean.setMbeanClass("monitor.MonitorPOJO"); XMBeanConstructorMetaData constructor = new XMBeanConstructorMetaData(); constructor.setDescription("The no-arg constructor"); constructor.setName("monitor.MonitorPOJO"); xmbean.addConstructor(constructor); XMBeanAttributeMetaData attribute = new XMBeanAttributeMetaData(); attribute.setAccess("read-write"); attribute.setGetMethod("getInterval"); attribute.setSetMethod("setInterval"); attribute.setDescription("The interval in milliseconds between checks of VM memory and threads"); attribute.setName("Interval"); attribute.setType("int"); xmbean.addAttribute(attribute); XMBeanOperationMetaData operation = new XMBeanOperationMetaData(); operation.setDescription("Access the last HistoryLength monitor reports"); operation.setName("history"); operation.setReturnType("java.lang.String"); xmbean.addOperation(operation); XMBeanNotificationMetaData notification = new XMBeanNotificationMetaData(); notification.setDescription("A notification sent when the monitor interval expires"); notification.setName("javax.management.Notification"); notification.setNotificationType("monitor.IntervalElapsed"); xmbean.addNotification(notification); JDBCPm pm = new JDBCPm(); pm.setDatasource("java:/DefaultDS"); pm.setTable("xmbeans"); xmbean.setPersistenceManager(pm); return xmbean; } private static InputStream getResource(String name) { InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name); if(is == null) { throw new IllegalStateException("Resource not found: " + name); } return is; } private static URL getResourceUrl(String name) { URL url = Thread.currentThread().getContextClassLoader().getResource(name); if(url == null) { throw new IllegalStateException("Resource not found: " + name); } return url; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/Validator.java0000644000175000017500000001076510530335325030610 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.StringReader; import javax.xml.parsers.SAXParserFactory; import javax.xml.parsers.SAXParser; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.InputSource; import org.xml.sax.EntityResolver; import org.xml.sax.helpers.DefaultHandler; import org.jboss.xb.binding.JBossXBRuntimeException; /** * @author Alexey Loubyansky * @version $Revision: 45119 $ */ public class Validator { public static void assertValidXml(final String xsd, String xml) { assertValidXml(xsd, xml, null); } public static void assertValidXml(String xml, final EntityResolver resolver) { assertValidXml(null, xml, resolver); } public static void assertValidXml(InputStream xml, final EntityResolver resolver) { parse(xml, null, resolver); } private static void assertValidXml(final String xsd, String xml, final EntityResolver resolver) { ByteArrayInputStream xmlIs = new ByteArrayInputStream(xml.getBytes()); parse(xmlIs, xsd, resolver); } private static void parse(InputStream xmlIs, final String xsd, final EntityResolver resolver) { SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(true); factory.setNamespaceAware(true); SAXParser parser = null; try { parser = factory.newSAXParser(); } catch (Exception e) { throw new IllegalStateException("Failed to instantiate a SAX parser: " + e.getMessage()); } try { parser.getXMLReader().setFeature("http://apache.org/xml/features/validation/schema", true); } catch (SAXException e) { throw new IllegalStateException("Schema validation feature is not supported by the parser: " + e.getMessage()); } try { parser.parse(xmlIs, new DefaultHandler() { public void warning(SAXParseException e) { } public void error(SAXParseException e) { throw new JBossXBRuntimeException("Error", e); } public void fatalError(SAXParseException e) { throw new JBossXBRuntimeException("Fatal error", e); } public InputSource resolveEntity(String publicId, String systemId) { if (resolver != null) { try { InputSource resolveEntity = resolver.resolveEntity(publicId, systemId); return resolveEntity; } catch (Exception e) { throw new IllegalStateException("Failed to resolveEntity " + systemId + ": " + systemId); } } else { return new InputSource(new StringReader(xsd)); } } }); } catch(JBossXBRuntimeException e) { throw e; } catch (SAXException e) { throw new JBossXBRuntimeException("Parsing failed.", e); } catch (IOException e) { throw new JBossXBRuntimeException("Parsing failed.", e); } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SimpleTestCase.java0000644000175000017500000003502411061473704031547 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.net.URL; import java.util.Calendar; import java.util.Iterator; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.jboss.logging.Logger; import org.jboss.test.xml.book.Book; import org.jboss.test.xml.book.BookCharacter; import org.jboss.test.xml.book.BookGenericObjectModelFactory; import org.jboss.test.xml.book.BookGenericObjectModelProvider; import org.jboss.test.xml.book.BookObjectFactory; import org.jboss.test.xml.book.BookObjectProvider; import org.jboss.xb.binding.AbstractMarshaller; import org.jboss.xb.binding.DtdMarshaller; import org.jboss.xb.binding.GenericObjectModelFactory; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.Marshaller; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.ObjectModelProvider; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.TypeBinding; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.XercesXsMarshaller; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import org.xml.sax.helpers.DefaultHandler; /** * @author Alexey Loubyansky * @author Scott.Stark@jboss.org * @version $Revision: 43309 $ */ public class SimpleTestCase extends AbstractJBossXBTest { private static final Logger log = Logger.getLogger(SimpleTestCase.class); public SimpleTestCase(String name) { super(name); } public void testUnmarshalBookDtd() throws Exception { // create an object model factory ObjectModelFactory factory = new BookObjectFactory(); unmarshalBook("book-dtd.xml", factory); } /** * Test that parser validation can be disabled to parse a non-conforming doc * @throws Exception */ public void testParserValidationFeature() throws Exception { SAXParserFactory saxFactory = SAXParserFactory.newInstance(); saxFactory.setValidating(true); saxFactory.setNamespaceAware(true); saxFactory.setXIncludeAware(true); // SAXParser parser = saxFactory.newSAXParser(); log.debug("Created parser: "+parser + ", isNamespaceAware: "+parser.isNamespaceAware() + ", isValidating: "+parser.isValidating() + ", isXIncludeAware: "+parser.isXIncludeAware() ); XMLReader reader = parser.getXMLReader(); // Both these features need to be false reader.setFeature(Unmarshaller.VALIDATION, false); reader.setFeature(Unmarshaller.DYNAMIC_VALIDATION, false); reader.setEntityResolver(new BooksEntityResolver()); assertFalse(parser.isValidating()); URL xmlUrl = getResource("/xml/book/books2-dtd.xml"); log.debug("parsing: "+xmlUrl); parser.parse(xmlUrl.openStream(), new DefaultHandler() { public void error(SAXParseException e) throws SAXException { throw e; } public void fatalError(SAXParseException e) throws SAXException { throw e; } } ); } /** * Test that one can disable validation to parse a doc that does not * conform to its dtd * @throws Exception */ public void testUnmarshalBooks2Dtd() throws Exception { // create an object model factory String xmlSource = "books2-dtd.xml"; ObjectModelFactory factory = new BookObjectFactory(); log.debug("'); // get the XML stream URL xmlUrl = getResource("/xml/book/" + xmlSource); // create unmarshaller Unmarshaller unmarshaller = getBookUnmarshaller(); unmarshaller.setValidation(false); // let the object model factory to create an instance of Book and populate it with data from XML Book book = (Book)unmarshaller.unmarshal(xmlUrl.openStream(), factory, null); checkUnmarshalledBook(book); log.debug("'); } public void testUnmarshalBookXs() throws Exception { // create an object model factory ObjectModelFactory factory = new BookObjectFactory(); unmarshalBook("book-xs.xml", factory); } public void testUnmarshalBookXsGenericFactory() throws Exception { // create an object model factory GenericObjectModelFactory factory = new BookGenericObjectModelFactory(); unmarshalBook("book-xs.xml", factory); } public void testMarshallBookDtd() throws Exception { log.debug("--- " + getName()); // obtain an instance of Book to marshal Book book = createBook(); // get the output writter to write the XML content StringWriter xmlOutput = new StringWriter(); // get the DTD source URL dtdURL = getResource("/xml/book/books.dtd"); InputStream is = dtdURL.openStream(); Reader dtdReader = new InputStreamReader(is); // create an instance of DTD marshaller DtdMarshaller marshaller = new DtdMarshaller(); marshaller.addBinding("since", new TypeBinding() { public Object unmarshal(String value) { // todo: implement unmarshal throw new UnsupportedOperationException("unmarshal is not implemented."); } public String marshal(Object value) { return SimpleTypeBindings.marshalDate((Calendar)value); } } ); // map publicId to systemId as it should appear in the resulting XML file marshaller.mapPublicIdToSystemId("-//DTD Books//EN", "resources/xml/book/books.dtd"); // create an instance of ObjectModelProvider with the book instance to be marshalled ObjectModelProvider provider = new BookObjectProvider(); // marshal the book marshaller.marshal(dtdReader, provider, book, xmlOutput); // close DTD reader dtdReader.close(); String xml = xmlOutput.getBuffer().toString(); checkMarshalledBook(xml, book); } public void testMarshallBookXercesXs() throws Exception { log.debug("--- " + getName()); System.setProperty(Marshaller.PROP_MARSHALLER, XercesXsMarshaller.class.getName()); marshallingTest(); } public void testMarshallBookDtdGeneric() throws Exception { log.debug("--- " + getName()); // obtain an instance of Book to marshal Book book = createBook(); // get the output writter to write the XML content StringWriter xmlOutput = new StringWriter(); // get the DTD source URL dtdURL = getResource("/xml/book/books.dtd"); InputStream is = dtdURL.openStream(); Reader dtdReader = new InputStreamReader(is); // create an instance of DTD marshaller Marshaller marshaller = new DtdMarshaller(); // map publicId to systemId as it should appear in the resulting XML file marshaller.mapPublicIdToSystemId("-//DTD Books//EN", "resources/xml/book/books.dtd"); // create an instance of ObjectModelProvider with the book instance to be marshalled ObjectModelProvider provider = new BookGenericObjectModelProvider(); // marshal the book marshaller.marshal(dtdReader, provider, book, xmlOutput); // close DTD reader dtdReader.close(); String xml = xmlOutput.getBuffer().toString(); if(log.isTraceEnabled()) { log.trace("marshalled with dtd: " + xml); } checkMarshalledBook(xml, book); } // Private private void marshallingTest() throws Exception { // obtain an instance of Book to marshal Book book = createBook(); // get the output writter to write the XML content StringWriter xmlOutput = new StringWriter(); // create an instance of XML Schema marshaller AbstractMarshaller marshaller = (AbstractMarshaller)Marshaller.FACTORY.getInstance(); // we need to specify what elements are top most (roots) providing namespace URI, prefix and local name marshaller.addRootElement("http://example.org/ns/books/", "", "book"); // declare default namespace marshaller.declareNamespace(null, "http://example.org/ns/books/"); // add schema location by declaring xsi namespace and adding xsi:schemaReader attribute marshaller.declareNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance"); marshaller.addAttribute("xsi", "schemaReader", "string", "http://example.org/ns/books/ resources/book/books.xsd" ); // create an instance of Object Model Provider with no book ObjectModelProvider provider = new BookObjectProvider(); // marshall Book instance passing it as an argument instead of using the one that is returned by the BookObjectProvider marshaller.marshal(getResource("/xml/book/books.xsd").toString(), provider, book, xmlOutput); String xml = xmlOutput.getBuffer().toString(); if(log.isTraceEnabled()) { log.debug("marshalled with " + marshaller.getClass().getName() + ": " + xml); } checkMarshalledBook(xml, book); } private void unmarshalBook(String xmlSource, ObjectModelFactory factory) throws Exception { log.debug("'); // get the XML stream URL xmlUrl = getResource("/xml/book/" + xmlSource); // create unmarshaller Unmarshaller unmarshaller = getBookUnmarshaller(); // let the object model factory to create an instance of Book and populate it with data from XML Book book = (Book)unmarshaller.unmarshal(xmlUrl.openStream(), factory, null); checkUnmarshalledBook(book); log.debug("'); } private void checkMarshalledBook(String content, Book book) throws Exception { Book unmarshalled = new Book(); ObjectModelFactory factory = new BookObjectFactory(); Unmarshaller unmarshaller = getBookUnmarshaller(); StringReader strReader = new StringReader(content); unmarshaller.unmarshal(strReader, factory, unmarshalled); strReader.close(); assertEquals(book, unmarshalled); } private void checkUnmarshalledBook(Book book) { log.debug("unmarshalled book: " + book); assertEquals("Being a Dog Is a Full-Time Job", book.getTitle()); assertEquals("Charles M. Schulz", book.getAuthor()); assertEquals("0836217462", book.getIsbn()); assertEquals(book.getCharactersTotal(), 2); for(Iterator iter = book.getCharacters().iterator(); iter.hasNext();) { BookCharacter character = iter.next(); final String name = character.getName(); if(name.equals("Snoopy")) { assertEquals(character.getFriendOf(), "Peppermint Patty"); assertEquals(character.getSince(), "1950-10-04"); assertEquals(character.getQualification(), "extroverted beagle"); } else if(name.equals("Peppermint Patty")) { assertEquals(character.getFriendOf(), null); assertEquals(character.getSince(), "1966-08-22"); assertEquals(character.getQualification(), "bold, brash and tomboyish"); } } } private static Unmarshaller getBookUnmarshaller() throws JBossXBException { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.setEntityResolver(new BooksEntityResolver()); return unmarshaller; } private static Book createBook() { Book book = new Book(); book.setIsbn("0836217462"); book.setTitle("Being a Dog Is a Full-Time Job"); book.setAuthor("Charles M. Schulz"); BookCharacter character = new BookCharacter(); character.setName("Snoopy"); character.setFriendOf("Peppermint Patty"); character.setSince("1950-10-04"); character.setQualification("extroverted beagle"); book.addCharacter(character); character = new BookCharacter(); character.setName("Peppermint Patty"); character.setSince("1966-08-22"); character.setQualification("bold, brash and tomboyish"); book.addCharacter(character); return book; } private static InputStream getResourceStream(String name) throws IOException { URL resURL = findResource(SimpleTestCase.class, name); return resURL.openStream(); } private static class BooksEntityResolver implements EntityResolver { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { log.debug("resolveEntity, publicId: "+publicId+", systemId: "+systemId); if(systemId.endsWith("books.dtd")) { return new InputSource(getResourceStream("/xml/book/books.dtd")); } if(systemId.endsWith("books2.dtd")) { return new InputSource(getResourceStream("/xml/book/books2.dtd")); } return null; } } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AnnotatedPojoServerUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AnnotatedPojoServerUnitTest0000644000175000017500000002515610513427451033402 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; /** * @author Alexey Loubyansky * @version $Revision: 37728 $ */ public class AnnotatedPojoServerUnitTestCase extends PojoServerTestBase { public AnnotatedPojoServerUnitTestCase(String localName) { super(localName); } protected SchemaBinding getSchemaBinding() { SchemaBinding cursor = readXsd(); /** TODO TypeBinding namedValueType = cursor.getType(namedValueTypeQName); TypeBinding valueWithClassType = cursor.getType(valueWithClassTypeQName); TypeBinding listType = cursor.getType(listTypeQName); TypeBinding mapType = cursor.getType(mapTypeQName); TypeBinding propsType = cursor.getType(propsTypeQName); // // add handlers // namedValueType.setSimpleType(new CharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, org.jboss.xb.binding.metadata.ValueMetaData valueMetaData, String value) { return value == null ? null : new StringValueMetaData(value); } public void setValue(QName qName, ElementBinding element, Object owner, Object value) { AbstractPropertyMetaData prop = (AbstractPropertyMetaData)owner; prop.setValue((ValueMetaData)value); } } ); namedValueType.pushInterceptor(parameterQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { // todo how to add? //AbstractPropertyMetaData prop = (AbstractPropertyMetaData)parent; //AbstractParameterMetaData param = (AbstractParameterMetaData)child; //prop.setValue(param.getType(), param); } } ); namedValueType.pushInterceptor(propertyQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { // todo how to add? AbstractPropertyMetaData propParent = (AbstractPropertyMetaData)parent; AbstractPropertyMetaData propChild = (AbstractPropertyMetaData)child; propParent.setValue(propChild.getName(), propChild); } } ); namedValueType.pushInterceptor(dependencyQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractPropertyMetaData prop = (AbstractPropertyMetaData)parent; AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)child; prop.setValue(dependency); } } ); namedValueType.pushInterceptor(beanQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { // todo how to add? AbstractPropertyMetaData prop = (AbstractPropertyMetaData)parent; AbstractBeanMetaData bean = (AbstractBeanMetaData)child; prop.setValue(bean.getName(), bean); } } ); namedValueType.pushInterceptor(listQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName qName) { AbstractPropertyMetaData prop = (AbstractPropertyMetaData)parent; AbstractListMetaData list = (AbstractListMetaData)child; prop.setValue(list); } } ); namedValueType.pushInterceptor(setQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName qName) { AbstractPropertyMetaData prop = (AbstractPropertyMetaData)parent; AbstractSetMetaData set = (AbstractSetMetaData)child; prop.setValue(set); } } ); namedValueType.pushInterceptor(mapQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName qName) { AbstractPropertyMetaData prop = (AbstractPropertyMetaData)parent; AbstractMapMetaData map = (AbstractMapMetaData)child; prop.setValue(map); } } ); namedValueType.pushInterceptor(propsQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName qName) { AbstractPropertyMetaData prop = (AbstractPropertyMetaData)parent; Map children = (Map)child; for(Iterator i = children.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry)i.next(); prop.setValue((String)entry.getKey(), entry.getValue()); } } } ); valueWithClassType.setSimpleType(new CharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, org.jboss.xb.binding.metadata.ValueMetaData valueMetaData, String value) { return value == null ? null : new StringValueMetaData(value); } public void setValue(QName qName, ElementBinding element, Object owner, Object value) { AbstractParameterMetaData param = (AbstractParameterMetaData)owner; param.setValue((ValueMetaData)value); } } ); valueWithClassType.pushInterceptor(dependencyQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName qName) { AbstractParameterMetaData param = (AbstractParameterMetaData)parent; AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)child; param.setValue(dependency); } } ); listType.setHandler(new DefaultElementHandler() { public Object startElement(Object root, QName qName, ElementBinding element) { AbstractCollectionMetaData col; if("set".equals(qName.getLocalPart())) { col = new AbstractSetMetaData(); } else { col = new AbstractListMetaData(); } return col; } public void attributes(Object o, QName qName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { AbstractCollectionMetaData col = (AbstractCollectionMetaData)o; for(int i = 0; i < attrs.getLength(); ++i) { String lName = attrs.getLocalName(i); if("class".equals(lName)) { // todo what should I do with this? } } } } ); listType.pushInterceptor(valueQName, new DefaultElementInterceptor() { public void characters(Object o, QName qName, TypeBinding type, NamespaceContext nsCtx, String text) { AbstractCollectionMetaData col = (AbstractCollectionMetaData)o; col.add(text); } } ); propsType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new HashMap(); } } ); propsType.pushInterceptor(propsEntryQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { Map map = (Map)parent; Object[] arr = (Object[])child; map.put(arr[0], arr[1]); } } ); propsType.pushInterceptor(propsEntryQName, new DefaultElementInterceptor() { public Object startElement(Object parent, QName qName, TypeBinding type) { return new Object[2]; } public void attributes(Object o, QName name, TypeBinding type, Attributes attrs, NamespaceContext nsCtx) { Object[] arr = (Object[])o; for(int i = 0; i < attrs.getLength(); ++i) { if("name".equals(attrs.getLocalName(i))) { arr[0] = attrs.getValue(i); } } } public void characters(Object o, QName name, TypeBinding type, NamespaceContext nsCtx, String text) { Object[] arr = (Object[])o; arr[1] = text; } } ); mapType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new AbstractMapMetaData(); } } ); mapType.pushInterceptor(mapEntryQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractMapMetaData map = (AbstractMapMetaData)parent; AbstractPropertyMetaData prop = (AbstractPropertyMetaData)child; map.put(prop.getName(), prop); } } ); */ return cursor; } protected String getXsd() { return "xml/annotated-bean-deployer_1_0.xsd"; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/PojoServerUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/PojoServerUnitTestCase.java0000644000175000017500000012446111061473704033260 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.test.xml.pojoserver.deployment.AbstractKernelDeployment; import org.jboss.test.xml.pojoserver.metadata.AbstractArrayMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractBeanMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractCollectionMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractConstructorMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractDemandMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractDependencyMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractDependencyValueMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractLifecycleMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractListMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractMapMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractParameterMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractPropertyMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractSetMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractSupplyMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractValueMetaData; import org.jboss.test.xml.pojoserver.metadata.ControllerMode; import org.jboss.test.xml.pojoserver.metadata.ControllerState; import org.jboss.test.xml.pojoserver.metadata.GenericBeanFactory; import org.jboss.test.xml.pojoserver.metadata.StringValueMetaData; import org.jboss.test.xml.pojoserver.metadata.ValueMetaData; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 57581 $ */ public class PojoServerUnitTestCase extends PojoServerTestBase { public PojoServerUnitTestCase(String localName) { super(localName); } public void testXsdBinder() throws Exception { SchemaBinding doc = readXsd(); /* TODO assertSchemaBinding(doc); */ } public void testManualBinding() throws Exception { SchemaBinding doc = createBinding(); /* TODO assertSchemaBinding(doc); */ } protected SchemaBinding getSchemaBinding() { if (schemaBinding != null) return schemaBinding; long start = System.currentTimeMillis(); schemaBinding = readXsd(); long now = System.currentTimeMillis(); log.debug("Reading xsd took " + (now - start) + " milliseconds"); // deployment binding TypeBinding deploymentType = schemaBinding.getType(deploymentTypeQName); deploymentType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new AbstractKernelDeployment(); } }); // deployment has a list beans deploymentType.pushInterceptor(beanQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractKernelDeployment deployment = (AbstractKernelDeployment) parent; AbstractBeanMetaData bean = (AbstractBeanMetaData) child; List beans = deployment.getBeans(); if (beans == null) { beans = new ArrayList(); deployment.setBeans(beans); } beans.add(bean); } }); // deployment has a list beanfactorys deploymentType.pushInterceptor(beanFactoryQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractKernelDeployment deployment = (AbstractKernelDeployment) parent; AbstractBeanMetaData bean = (AbstractBeanMetaData) child; List beans = deployment.getBeans(); if (beans == null) { beans = new ArrayList(); deployment.setBeans(beans); } beans.add(bean); } }); // bean binding TypeBinding beanType = schemaBinding.getType(beanTypeQName); beanType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new AbstractBeanMetaData(); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { AbstractBeanMetaData bean = (AbstractBeanMetaData) o; for (int i = 0; i < attrs.getLength(); ++i) { String localName = attrs.getLocalName(i); if ("name".equals(localName)) bean.setName(attrs.getValue(i)); else if ("class".equals(localName)) bean.setBean(attrs.getValue(i)); else if ("mode".equals(localName)) bean.setMode(new ControllerMode(attrs.getValue(i))); } } }); // beanfactory binding TypeBinding beanFactoryType = schemaBinding.getType(beanFactoryTypeQName); beanFactoryType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { AbstractBeanMetaData beanMetaData = new AbstractBeanMetaData(); beanMetaData.setBean(GenericBeanFactory.class.getName()); beanMetaData.setProperties(new HashSet()); return beanMetaData; } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { AbstractBeanMetaData bean = (AbstractBeanMetaData) o; Set properties = bean.getProperties(); for (int i = 0; i < attrs.getLength(); ++i) { String localName = attrs.getLocalName(i); if ("name".equals(localName)) bean.setName(attrs.getValue(i)); else if ("class".equals(localName)) properties.add(new AbstractPropertyMetaData("bean", attrs.getValue(i))); } } }); // bean has a constructor beanType.pushInterceptor(constructorQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractBeanMetaData bean = (AbstractBeanMetaData) parent; AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) child; bean.setConstructor(constructor); } }); // beanfactory has a constructor beanFactoryType.pushInterceptor(constructorQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractBeanMetaData bean = (AbstractBeanMetaData) parent; AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) child; Set properties = bean.getProperties(); properties.add(new AbstractPropertyMetaData("constructor", new AbstractValueMetaData(constructor))); } }); // constructor binding TypeBinding constructorType = schemaBinding.getType(constructorTypeQName); constructorType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new AbstractConstructorMetaData(); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) o; for (int i = 0; i < attrs.getLength(); ++i) { String localName = attrs.getLocalName(i); if ("factoryClass".equals(localName)) constructor.setFactoryClass(attrs.getValue(i)); else if ("factoryMethod".equals(localName)) constructor.setFactoryMethod(attrs.getValue(i)); } } }); // constructor has a factory constructorType.pushInterceptor(factoryQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) parent; AbstractDependencyValueMetaData factory = (AbstractDependencyValueMetaData) child; constructor.setFactory(factory); } }); // constructor has a list parameters constructorType.pushInterceptor(parameterQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractConstructorMetaData constructor = (AbstractConstructorMetaData) parent; AbstractParameterMetaData parameter = (AbstractParameterMetaData) child; List parameters = constructor.getParameters(); if (parameters == null) { parameters = new ArrayList(); constructor.setParameters(parameters); } parameters.add(parameter); } }); ModelGroupBinding valueGroup = schemaBinding.getGroup(valueGroupQName); for(Iterator i = valueGroup.getParticles().iterator(); i.hasNext();) { TermBinding term = ((ParticleBinding)i.next()).getTerm(); if(!term.isWildcard()) { ElementBinding e = (ElementBinding) term; if(e.getQName().equals(nullQName)) { e.pushInterceptor(NULLVALUES); } else { e.pushInterceptor(VALUES); } } } // parameter binding TypeBinding parameterType = schemaBinding.getType(parameterTypeQName); parameterType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new AbstractParameterMetaData(); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { AbstractParameterMetaData parameter = (AbstractParameterMetaData) o; for (int i = 0; i < attrs.getLength(); ++i) { String localName = attrs.getLocalName(i); if ("class".equals(localName)) parameter.setType(attrs.getValue(i)); } } }); // parameter can take a value parameterType.setSimpleType(new CharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, org.jboss.xb.binding.metadata.ValueMetaData valueMetaData, String value) { return new StringValueMetaData(value); } public void setValue(QName qName, ElementBinding element, Object owner, Object value) { AbstractParameterMetaData parameter = (AbstractParameterMetaData) owner; parameter.setValue((StringValueMetaData) value); } }); // bean has a create beanType.pushInterceptor(createQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractBeanMetaData bean = (AbstractBeanMetaData) parent; AbstractLifecycleMetaData lifecycle = (AbstractLifecycleMetaData) child; bean.setCreate(lifecycle); } }); // bean has a start beanType.pushInterceptor(startQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractBeanMetaData bean = (AbstractBeanMetaData) parent; AbstractLifecycleMetaData lifecycle = (AbstractLifecycleMetaData) child; bean.setStart(lifecycle); } }); // bean has a stop beanType.pushInterceptor(stopQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractBeanMetaData bean = (AbstractBeanMetaData) parent; AbstractLifecycleMetaData lifecycle = (AbstractLifecycleMetaData) child; bean.setStop(lifecycle); } }); // bean has a destroy beanType.pushInterceptor(destroyQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractBeanMetaData bean = (AbstractBeanMetaData) parent; AbstractLifecycleMetaData lifecycle = (AbstractLifecycleMetaData) child; bean.setDestroy(lifecycle); } }); // lifecycle binding TypeBinding lifecycleType = schemaBinding.getType(lifecycleTypeQName); lifecycleType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new AbstractLifecycleMetaData(); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { AbstractLifecycleMetaData lifecycle = (AbstractLifecycleMetaData) o; for (int i = 0; i < attrs.getLength(); ++i) { String localName = attrs.getLocalName(i); if ("method".equals(localName)) lifecycle.setMethodName(attrs.getValue(i)); } } }); // lifecycle has a list parameters lifecycleType.pushInterceptor(parameterQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractLifecycleMetaData lifecycle = (AbstractLifecycleMetaData) parent; AbstractParameterMetaData parameter = (AbstractParameterMetaData) child; List parameters = lifecycle.getParameters(); if (parameters == null) { parameters = new ArrayList(); lifecycle.setParameters(parameters); } parameters.add(parameter); } }); // bean has a set of properties beanType.pushInterceptor(propertyQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractBeanMetaData bean = (AbstractBeanMetaData) parent; AbstractPropertyMetaData property = (AbstractPropertyMetaData) child; Set properties = bean.getProperties(); if (properties == null) { properties = new HashSet(); bean.setProperties(properties); } properties.add(property); } }); // beanfactory has a set of properties beanFactoryType.pushInterceptor(propertyQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractBeanMetaData bean = (AbstractBeanMetaData) parent; Set properties = bean.getProperties(); AbstractPropertyMetaData props = null; for (Iterator i = properties.iterator(); i.hasNext();) { AbstractPropertyMetaData prop = i.next(); if ("properties".equals(prop.getName())) { props = prop; break; } } AbstractMapMetaData map = null; if (props == null) { map = new AbstractMapMetaData(); props = new AbstractPropertyMetaData("properties", map); properties.add(props); } else { map = (AbstractMapMetaData) props.getValue(); } AbstractPropertyMetaData property = (AbstractPropertyMetaData) child; ValueMetaData valueMetaData = property.getValue(); valueMetaData = new AbstractValueMetaData(valueMetaData); map.put(new AbstractValueMetaData(property.getName()), valueMetaData); } }); // bean has a set of depends beanType.pushInterceptor(dependsQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractBeanMetaData bean = (AbstractBeanMetaData) parent; AbstractDependencyMetaData dependency = (AbstractDependencyMetaData) child; Set demands = bean.getDemands(); if (demands == null) { demands = new HashSet(); bean.setDemands(demands); } demands.add(dependency); } }); // bean has a set of demands beanType.pushInterceptor(demandQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractBeanMetaData bean = (AbstractBeanMetaData) parent; AbstractDemandMetaData demand = (AbstractDemandMetaData) child; Set demands = bean.getDemands(); if (demands == null) { demands = new HashSet(); bean.setDemands(demands); } demands.add(demand); } }); // bean has a set of supplies beanType.pushInterceptor(supplyQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractBeanMetaData bean = (AbstractBeanMetaData) parent; AbstractSupplyMetaData supply = (AbstractSupplyMetaData) child; Set supplies = bean.getSupplies(); if (supplies == null) { supplies = new HashSet(); bean.setSupplies(supplies); } supplies.add(supply); } }); // property binding TypeBinding propertyType = schemaBinding.getType(propertyTypeQName); propertyType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new AbstractPropertyMetaData(); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { AbstractPropertyMetaData property = (AbstractPropertyMetaData) o; for (int i = 0; i < attrs.getLength(); ++i) { String localName = attrs.getLocalName(i); if ("name".equals(localName)) property.setName(attrs.getValue(i)); else if ("class".equals(localName)) { StringValueMetaData svmd = new StringValueMetaData(); svmd.setType(attrs.getValue(i)); property.setValue(svmd); } } } public Object endElement(Object o, QName qName, ElementBinding element) { AbstractPropertyMetaData x = (AbstractPropertyMetaData) o; String name = x.getName(); if (name == null || name.trim().length() == 0) throw new IllegalArgumentException("Null or empty property name."); return o; } }); // property can take a value propertyType.setSimpleType(new CharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, org.jboss.xb.binding.metadata.ValueMetaData valueMetaData, String value) { return new StringValueMetaData(value); } public void setValue(QName qName, ElementBinding element, Object owner, Object value) { AbstractPropertyMetaData property = (AbstractPropertyMetaData) owner; StringValueMetaData svmd = (StringValueMetaData) value; ValueMetaData vmd = property.getValue(); if (vmd != null && vmd instanceof StringValueMetaData) { StringValueMetaData previous = (StringValueMetaData) vmd; String type = previous.getType(); if (type != null) svmd.setType(type); } property.setValue(svmd); } }); // dependency binding TypeBinding dependsType = schemaBinding.getType(dependsTypeQName); dependsType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new AbstractDependencyMetaData(); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { } public Object endElement(Object o, QName qName, ElementBinding element) { AbstractDependencyMetaData x = (AbstractDependencyMetaData) o; String name = (String) x.getDependency(); if (name == null || name.trim().length() == 0) throw new IllegalArgumentException("Null or empty dependency."); return o; } }); // depends can take a value dependsType.setSimpleType(new CharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, org.jboss.xb.binding.metadata.ValueMetaData valueMetaData, String value) { return value; } public void setValue(QName qname, ElementBinding element, Object owner, Object value) { AbstractDependencyMetaData depends = (AbstractDependencyMetaData) owner; depends.setDependency(value); } }); // demand binding TypeBinding demandType = schemaBinding.getType(demandTypeQName); demandType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new AbstractDemandMetaData(); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { AbstractDemandMetaData demand = (AbstractDemandMetaData) o; for (int i = 0; i < attrs.getLength(); ++i) { String localName = attrs.getLocalName(i); if ("state".equals(localName)) demand.setWhenRequired(new ControllerState(attrs.getValue(i))); } } public Object endElement(Object o, QName qName, ElementBinding element) { AbstractDemandMetaData x = (AbstractDemandMetaData) o; String name = (String) x.getDemand(); if (name == null || name.trim().length() == 0) throw new IllegalArgumentException("Null or empty demand."); return o; } }); // demand can take a value demandType.setSimpleType(new CharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, org.jboss.xb.binding.metadata.ValueMetaData valueMetaData, String value) { return value; } public void setValue(QName qname, ElementBinding element, Object owner, Object value) { AbstractDemandMetaData demand = (AbstractDemandMetaData) owner; demand.setDemand(value); } }); // supply binding TypeBinding supplyType = schemaBinding.getType(supplyTypeQName); supplyType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new AbstractSupplyMetaData(); } public Object endElement(Object o, QName qName, ElementBinding element) { AbstractSupplyMetaData x = (AbstractSupplyMetaData) o; String name = (String) x.getSupply(); if (name == null || name.trim().length() == 0) throw new IllegalArgumentException("Null or empty supply."); return o; } }); // supply can take a value supplyType.setSimpleType(new CharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, org.jboss.xb.binding.metadata.ValueMetaData valueMetaData, String value) { return value; } public void setValue(QName qName, ElementBinding element, Object owner, Object value) { AbstractSupplyMetaData supply = (AbstractSupplyMetaData) owner; supply.setSupply(value); } }); // dependency binding TypeBinding dependencyType = schemaBinding.getType(dependencyTypeQName); dependencyType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new AbstractDependencyValueMetaData(); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData) o; for (int i = 0; i < attrs.getLength(); ++i) { String localName = attrs.getLocalName(i); if ("bean".equals(localName)) dependency.setValue(attrs.getValue(i)); else if ("property".equals(localName)) dependency.setProperty(attrs.getValue(i)); else if ("state".equals(localName)) dependency.setDependentState(new ControllerState(attrs.getValue(i))); } } public Object endElement(Object o, QName qName, ElementBinding element) { AbstractDependencyValueMetaData x = (AbstractDependencyValueMetaData) o; String name = (String) x.getUnderlyingValue(); if (name == null || name.trim().length() == 0) throw new IllegalArgumentException("Null or empty bean in injection/factory."); return o; } }); // value binding TypeBinding plainValueType = schemaBinding.getType(plainValueTypeQName); plainValueType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new StringValueMetaData(); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { StringValueMetaData value = (StringValueMetaData) o; for (int i = 0; i < attrs.getLength(); ++i) { String localName = attrs.getLocalName(i); if ("class".equals(localName)) value.setType(attrs.getValue(i)); } } }); // value can take a value plainValueType.setSimpleType(new CharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, org.jboss.xb.binding.metadata.ValueMetaData valueMetaData, String value) { return value; } public void setValue(QName qName, ElementBinding element, Object owner, Object value) { StringValueMetaData valueMetaData = (StringValueMetaData) owner; valueMetaData.setValue(value); } }); // value binding TypeBinding valueType = schemaBinding.getType(valueTypeQName); valueType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new AbstractValueMetaData(new StringValueMetaData()); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { AbstractValueMetaData value = (AbstractValueMetaData) o; StringValueMetaData string = (StringValueMetaData) value.getValue(); for (int i = 0; i < attrs.getLength(); ++i) { String localName = attrs.getLocalName(i); if ("class".equals(localName)) string.setType(attrs.getValue(i)); } } }); // value can take a value valueType.setSimpleType(new CharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, org.jboss.xb.binding.metadata.ValueMetaData valueMetaData, String value) { return value; } public void setValue(QName qName, ElementBinding element, Object owner, Object value) { AbstractValueMetaData valueMetaData = (AbstractValueMetaData) owner; StringValueMetaData string = (StringValueMetaData) valueMetaData.getValue(); string.setValue(value); } }); // collection binding configureCollection(collectionTypeQName); // list binding configureCollection(listTypeQName); // set binding configureCollection(setTypeQName); // array binding configureCollection(arrayTypeQName); // map binding TypeBinding mapType = schemaBinding.getType(mapTypeQName); mapType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new AbstractMapMetaData(); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { AbstractMapMetaData collection = (AbstractMapMetaData) o; for (int i = 0; i < attrs.getLength(); ++i) { String localName = attrs.getLocalName(i); if ("class".equals(localName)) collection.setType(attrs.getValue(i)); else if ("keyClass".equals(localName)) collection.setKeyType(attrs.getValue(i)); else if ("valueClass".equals(localName)) collection.setValueType(attrs.getValue(i)); } } }); // map has a map entries mapType.pushInterceptor(entryQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { AbstractMapMetaData map = (AbstractMapMetaData) parent; MapEntry entry = (MapEntry) child; AbstractValueMetaData entryKey = (AbstractValueMetaData) entry.key; if (entryKey == null) throw new IllegalArgumentException("No key in map entry"); AbstractValueMetaData entryValue = (AbstractValueMetaData) entry.value; if (entryValue == null) throw new IllegalArgumentException("No value in map entry"); map.put(entryKey.getValue(), entryValue.getValue()); } }); // entry binding TypeBinding entryType = schemaBinding.getType(entryTypeQName); entryType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new MapEntry(); } }); // entry has a key entryType.pushInterceptor(keyQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { MapEntry entry = (MapEntry) parent; ValueMetaData value = (ValueMetaData) child; entry.key = value; } }); // entry has a value entryType.pushInterceptor(valueQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { MapEntry entry = (MapEntry) parent; ValueMetaData value = (ValueMetaData) child; entry.value = value; } }); now = System.currentTimeMillis(); log.debug("Creating schema binding took " + (now - start) + " milliseconds"); return schemaBinding; } protected String getXsd() { return "xml/bean-deployer_1_0.xsd"; } // Private private static SchemaBinding createBinding() { SchemaBinding cursor = new SchemaBinding(); // // Declare all the types // /* TODO TypeBinding kernelControllerStateType = new TypeBinding(kernelControllerStateTypeQName); cursor.addType(kernelControllerStateType); TypeBinding classNameType = new TypeBinding(classNameTypeQName); cursor.addType(classNameType); TypeBinding deploymentType = new TypeBinding(deploymentTypeQName); cursor.addType(deploymentType); TypeBinding beanType = new TypeBinding(beanTypeQName); cursor.addType(beanType); TypeBinding annotationType = new TypeBinding(annotationTypeQName); cursor.addType(annotationType); TypeBinding constructorType = new TypeBinding(constructorTypeQName); cursor.addType(constructorType); TypeBinding namedValueType = new TypeBinding(namedValueTypeQName); cursor.addType(namedValueType); TypeBinding demandType = new TypeBinding(demandTypeQName); cursor.addType(demandType); TypeBinding stringType = new TypeBinding(Constants.QNAME_STRING); cursor.addType(stringType); TypeBinding tokenType = new TypeBinding(Constants.QNAME_TOKEN); cursor.addType(tokenType); TypeBinding factoryType = new TypeBinding(factoryTypeQName); cursor.addType(factoryType); TypeBinding valueWithClassType = new TypeBinding(valueWithClassTypeQName); cursor.addType(valueWithClassType); TypeBinding dependencyType = new TypeBinding(); TypeBinding listType = new TypeBinding(listTypeQName); cursor.addType(listType); TypeBinding mapType = new TypeBinding(mapTypeQName); cursor.addType(mapType); TypeBinding propsType = new TypeBinding(propsTypeQName); cursor.addType(propsType); TypeBinding mixedValueType = new TypeBinding(mixedValueTypeQName); cursor.addType(mixedValueType); TypeBinding valueType = new TypeBinding(valueTypeQName); cursor.addType(valueType); TypeBinding nullType = new TypeBinding(); TypeBinding annotationAttributeType = new TypeBinding(annotationAttributeTypeQName); cursor.addType(annotationAttributeType); // // Assemble schema // deploymentType.addElement(beanQName, beanType); beanType.addElement(annotationQName, annotationType); beanType.addElement(constructorQName, constructorType); beanType.addElement(propertyQName, namedValueType); beanType.addElement(demandQName, demandType); beanType.addElement(supplyQName, stringType); beanType.addAttribute(nameAttrQName, stringType, AttributeHandler.NOOP); beanType.addAttribute(classAttrQName, tokenType, AttributeHandler.NOOP); constructorType.addElement(annotationQName, annotationType); constructorType.addElement(factoryQName, factoryType); constructorType.addElement(parameterQName, valueWithClassType); constructorType.addAttribute(factoryClassAttrQName, classNameType, AttributeHandler.NOOP); constructorType.addAttribute(factoryMethodAttrQName, tokenType, AttributeHandler.NOOP); // valueGroup Map valueGroup = new HashMap(); valueGroup.put(listQName, listType); valueGroup.put(setQName, listType); valueGroup.put(listQName, listType); valueGroup.put(mapQName, mapType); valueGroup.put(propsQName, propsType); valueGroup.put(dependencyQName, dependencyType); valueGroup.put(parameterQName, valueWithClassType); valueGroup.put(propertyQName, namedValueType); valueGroup.put(nullQName, nullType); mixedValueType.addGroup(valueGroup); mixedValueType.addElement(beanQName, beanType); // todo type extensions namedValueType.addGroup(valueGroup); namedValueType.addElement(beanQName, beanType); namedValueType.addElement(annotationQName, annotationType); namedValueType.addAttribute(nameAttrQName, stringType, AttributeHandler.NOOP); valueType.addGroup(valueGroup); valueType.addElement(beanQName, beanType); valueWithClassType.addGroup(valueGroup); valueWithClassType.addElement(beanQName, beanType); valueWithClassType.addAttribute(classAttrQName, classNameType, AttributeHandler.NOOP); listType.addElement(valueQName, mixedValueType); listType.addAttribute(classAttrQName, classNameType, AttributeHandler.NOOP); mapType.addElement(mapEntryQName, namedValueType); mapType.addAttribute(classAttrQName, classNameType, AttributeHandler.NOOP); TypeBinding propsEntryType = new TypeBinding(); propsType.addElement(propsEntryQName, propsEntryType); propsEntryType.addAttribute(nameAttrQName, stringType, AttributeHandler.NOOP); factoryType.addAttribute(beanAttrQName, stringType, AttributeHandler.NOOP); demandType.addAttribute(whenRequiredAttrQName, kernelControllerStateType, AttributeHandler.NOOP); annotationType.addElement(attributeQName, annotationAttributeType); annotationType.addAttribute(nameAttrQName, stringType, AttributeHandler.NOOP); annotationAttributeType.addAttribute(nameAttrQName, stringType, AttributeHandler.NOOP); annotationAttributeType.addAttribute(valueAttrQName, stringType, AttributeHandler.NOOP); dependencyType.addAttribute(valueAttrQName, stringType, AttributeHandler.NOOP); dependencyType.addAttribute(stateAttrQName, kernelControllerStateType, AttributeHandler.NOOP); // global elements cursor.addElement(deploymentQName, deploymentType); */ return cursor; } /** * Configure a collection. */ private static void configureCollection(QName qname) { TypeBinding collectionType = schemaBinding.getType(qname); collectionType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { if (collectionQName.equals(name)) return new AbstractCollectionMetaData(); else if (listQName.equals(name)) return new AbstractListMetaData(); else if (setQName.equals(name)) return new AbstractSetMetaData(); else if (arrayQName.equals(name)) return new AbstractArrayMetaData(); else throw new IllegalArgumentException("Unknown collection qname=" + name); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { AbstractCollectionMetaData collection = (AbstractCollectionMetaData) o; for (int i = 0; i < attrs.getLength(); ++i) { String localName = attrs.getLocalName(i); if ("class".equals(localName)) collection.setType(attrs.getValue(i)); else if ("elementClass".equals(localName)) collection.setElementType(attrs.getValue(i)); } } }); } private static class MapEntry { public Object key; public Object value; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/config/0000755000175000017500000000000011620316741027256 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/config/Config.java0000644000175000017500000002645511061473704031344 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.config; import java.util.HashMap; import java.util.Map; import java.util.LinkedList; import java.util.List; import java.util.ArrayList; import java.util.Collection; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Config { public static Config getInstance() { Config config = new Config(); Config.ConfigAttr.ConfigAttrDataValue defValue = new Config.ConfigAttr.ConfigAttrDataValue(); defValue.setData("default value"); config.getAttrs().add(new Config.ConfigAttr(defValue)); Config.ConfigAttr.ConfigAttrValue1 value1 = new Config.ConfigAttr.ConfigAttrValue1(); value1.setProperty("value1"); config.getAttrs().add(new Config.ConfigAttr(value1)); Config.ConfigAttr.ConfigAttrValue2 value2 = new Config.ConfigAttr.ConfigAttrValue2(); value2.setValue2("value2"); config.getAttrs().add(new Config.ConfigAttr(value2)); config.beans = new ArrayList(); config.beans.add(new Config.Bean("A")); config.beans.add(new Config.Bean("B")); config.list = new LinkedList(); config.list.add(new Config.ListValue("some.type", "foo")); config.list.add(new Config.Depends("SomeBean")); List sublist = new LinkedList(); sublist.add(new Config.ListValue("another.type", "bar")); sublist.add(new Config.Depends("AnotherBean")); config.list.add(sublist); config.map = new HashMap(); config.map.put("key1", "value1"); config.map.put("key2", "value2"); config.map.put("key3", "value3"); config.map.put("key4", "value4"); Map submap = new HashMap(); submap.put("submapKey3", "submapValue3"); config.map.put("submap", submap); return config; } private Collection attrs = new ArrayList(); public Collection beans; public Collection list; public Map map; public Collection getAttrs() { return attrs; } public void setAttrs(Collection attrs) { this.attrs = attrs; } public String toString() { return "[config attrs=" + attrs + (beans == null ? ", no beans" : ", beans{" + beans.getClass() + "}=" + beans) + (list == null ? ", no list" : ", list{" + list.getClass() + "}=" + list) + (map == null ? ", no map" : ", map{" + map.getClass() + "}=" + map) + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Config)) { return false; } final Config config = (Config)o; if(attrs != null ? !attrs.equals(config.attrs) : config.attrs != null) { return false; } if(beans != null ? !beans.equals(config.beans) : config.beans != null) { return false; } if(list != null ? !list.equals(config.list) : config.list != null) { return false; } if(map != null ? !map.equals(config.map) : config.map != null) { return false; } return true; } public int hashCode() { int result; result = (attrs != null ? attrs.hashCode() : 0); result = 29 * result + (beans != null ? beans.hashCode() : 0); result = 29 * result + (list != null ? list.hashCode() : 0); result = 29 * result + (map != null ? map.hashCode() : 0); return result; } // Inner public static class ListValue { public String type; public String value; public ListValue(String type, String value) { this.type = type; this.value = value; } public String toString() { return "[list-value type=" + type + ", value=" + value + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof ListValue)) { return false; } final ListValue listValue = (ListValue)o; if(type != null ? !type.equals(listValue.type) : listValue.type != null) { return false; } if(value != null ? !value.equals(listValue.value) : listValue.value != null) { return false; } return true; } public int hashCode() { int result; result = (type != null ? type.hashCode() : 0); result = 29 * result + (value != null ? value.hashCode() : 0); return result; } } public static class Depends { public String value; public Depends(String value) { this.value = value; } public String toString() { return "[depends value=" + value + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Depends)) { return false; } final Depends depends = (Depends)o; if(value != null ? !value.equals(depends.value) : depends.value != null) { return false; } return true; } public int hashCode() { return (value != null ? value.hashCode() : 0); } } public static class Bean { public String name; public Bean(String name) { this.name = name; } public String toString() { return "[bean " + name + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Bean)) { return false; } final Bean bean = (Bean)o; if(name != null ? !name.equals(bean.name) : bean.name != null) { return false; } return true; } public int hashCode() { return (name != null ? name.hashCode() : 0); } } public static class ConfigAttr { private ConfigAttrValue value; public ConfigAttr(ConfigAttrValue value) { this.value = value; } public ConfigAttrValue getValue() { return value; } public String toString() { return "[config-attr " + value + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof ConfigAttr)) { return false; } final ConfigAttr configAttr = (ConfigAttr)o; if(!value.equals(configAttr.value)) { return false; } return true; } public int hashCode() { return value.hashCode(); } // Inner public static abstract class ConfigAttrValue { } public static class ConfigAttrDataValue extends ConfigAttrValue { private String data; public String getData() { return data; } public void setData(String data) { this.data = data; } public String toString() { return "[" + getClass().getName() + ": " + data + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof ConfigAttrDataValue)) { return false; } final ConfigAttrDataValue configAttrDefaultValue = (ConfigAttrDataValue)o; if(!data.equals(configAttrDefaultValue.data)) { return false; } return true; } public int hashCode() { return data.hashCode(); } } public static class ConfigAttrValue1 extends ConfigAttrValue { private String property; public String getProperty() { return property; } public void setProperty(String property) { this.property = property; } public String toString() { return "[" + getClass().getName() + ": " + property + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof ConfigAttrValue1)) { return false; } final ConfigAttrValue1 configAttrValue1 = (ConfigAttrValue1)o; if(!property.equals(configAttrValue1.property)) { return false; } return true; } public int hashCode() { return property.hashCode(); } } public static class ConfigAttrValue2 extends ConfigAttrValue { private String value2; public String getValue2() { return value2; } public void setValue2(String value2) { this.value2 = value2; } public String toString() { return "[" + getClass().getName() + ": " + value2 + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof ConfigAttrValue2)) { return false; } final ConfigAttrValue2 configAttrValue2 = (ConfigAttrValue2)o; if(!value2.equals(configAttrValue2.value2)) { return false; } return true; } public int hashCode() { return value2.hashCode(); } } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SimpleContentUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SimpleContentUnitTestCase.j0000644000175000017500000000661311061473704033254 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.util.LinkedList; import java.util.List; import javax.xml.namespace.QName; import junit.framework.TestSuite; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; /** * SimpleContentUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class SimpleContentUnitTestCase extends AbstractJBossXBTest { private static final String NS = "http://www.jboss.org/test/xml/simpleContent"; public static final TestSuite suite() { return new TestSuite(SimpleContentUnitTestCase.class); } public SimpleContentUnitTestCase(String name) { super(name); } public void testCollectionOverrideProperty() throws Exception { //enableTrace("org.jboss.xb"); SchemaBinding schema = bind("SimpleContent.xsd"); schema.setIgnoreUnresolvedFieldOrClass(false); ClassMetaData classMetaData = new ClassMetaData(); classMetaData.setImpl(Top.class.getName()); ElementBinding element = schema.getElement(new QName(NS, "top")); assertNotNull(element); element.setClassMetaData(classMetaData); //TypeBinding type = schema.getType(new QName(NS, "myString")); //type.setStartElementCreatesObject(false); element.getType().pushInterceptor(new QName(NS, "child"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName qName) { getLog().debug("Add " + parent + " " + child); Top p = (Top) parent; if (p.string == null) p.string = new LinkedList(); p.string.add(child); } }); Top top = (Top) unmarshal("SimpleContent.xml", schema, Top.class); assertNotNull(top.getString()); assertEquals("Hello", top.getString().get(0)); } public static class Top { public List string; public List getString() { return string; } public void setString(List string) { this.string = string; } } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/TopLevelValueAdapterUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/TopLevelValueAdapterUnitTes0000644000175000017500000000510411061473704033302 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import javax.xml.namespace.QName; import junit.framework.TestSuite; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; /** * AnyComplexTypeUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class TopLevelValueAdapterUnitTestCase extends AbstractJBossXBTest { private static final String NS = "http://www.jboss.org/test/xml/topLevelValueAdapter"; public static final TestSuite suite() { return new TestSuite(TopLevelValueAdapterUnitTestCase.class); } public TopLevelValueAdapterUnitTestCase(String name) { super(name); } public void testTopLevelValueAdapter() throws Exception { SchemaBinding schema = bind("TopLevelValueAdapter.xsd"); schema.setIgnoreUnresolvedFieldOrClass(false); ElementBinding element = schema.getElement(new QName(NS, "top")); TypeBinding type = element.getType(); type.setValueAdapter(new ValueAdapter() { public Object cast(Object o, Class c) { String string = (String) o; return string + "..."; } }); String string = (String) unmarshal("TopLevelValueAdapter.xml", schema, String.class); assertEquals("string...", string); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/BasicArraysUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/BasicArraysUnitTestCase.jav0000644000175000017500000005015710513427451033223 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.io.StringWriter; import javax.xml.namespace.QName; import org.jboss.xb.binding.AbstractMarshaller; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.Marshaller; import org.jboss.xb.binding.ObjectModelProvider; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * @author Alexey Loubyansky * @version $Revision: 46059 $ */ public class BasicArraysUnitTestCase extends AbstractJBossXBTest { private static final String NS = "http://www.jboss.org/test/xml/longarr"; private static final long[] PRIMITIVES = new long[]{-1, 0, 1}; private static final String PRIMITIVES_XML = "" + " -1" + " 0" + " 1" + ""; private static final Long[] WRAPPERS = new Long[]{new Long(-1), new Long(0), new Long(1), null}; private static final String WRAPPERS_XML = "" + " -1" + " 0" + " 1" + " " + ""; private static final String WRAPPERS_NULL_ITEM_XML = "" + " " + ""; private static final String EMPTY_ARRAY_XML = ""; public BasicArraysUnitTestCase(String name) { super(name); } public void testUnmarshalEmptyPrimitiveArray() throws Exception { String xsd = getArrayOfLongXsd(false, false); SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object unmarshalled = unmarshaller.unmarshal(new StringReader(EMPTY_ARRAY_XML), schema); assertNotNull(unmarshalled); assertTrue(unmarshalled instanceof long[]); long[] arr = (long[])unmarshalled; assertEquals(0, arr.length); } public void testMarshalEmptyPrimitiveArrayXerces() throws Exception { marshallingTest(new XercesXsMarshaller(), getProvider(), getArrayOfLongXsd(false, false), new long[0], EMPTY_ARRAY_XML ); } public void testMarshalEmptyPrimitiveArraySunday() throws Exception { marshallingTest(new MarshallerImpl(), null, getArrayOfLongXsd(false, false), new long[0], EMPTY_ARRAY_XML); } public void testUnmarshalEmptyArrayOfWrappers() throws Exception { String xsd = getArrayOfLongXsd(true, false); SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object unmarshalled = unmarshaller.unmarshal(new StringReader(EMPTY_ARRAY_XML), schema); assertNotNull(unmarshalled); assertTrue(unmarshalled instanceof Long[]); Long[] arr = (Long[])unmarshalled; assertEquals(0, arr.length); } public void testMarshalEmptyArrayOfWrappersXerces() throws Exception { marshallingTest(new XercesXsMarshaller(), getProvider(), getArrayOfLongXsd(true, false), new Long[0], EMPTY_ARRAY_XML ); } public void testMarshalEmptyArrayOfWrappersSunday() throws Exception { marshallingTest(new MarshallerImpl(), null, getArrayOfLongXsd(true, false), new Long[0], EMPTY_ARRAY_XML); } public void testUnmarshalEmptyAnnotatedPrimitiveArray() throws Exception { String xsd = getArrayOfLongXsd(false, true); SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object unmarshalled = unmarshaller.unmarshal(new StringReader(EMPTY_ARRAY_XML), schema); assertNotNull(unmarshalled); assertTrue(unmarshalled instanceof ArrayWrapper); long[] arr = ((ArrayWrapper)unmarshalled).primitives; assertNotNull(arr); assertEquals(0, arr.length); } public void testMarshalEmptyAnnotatedPrimitiveArrayXerces() throws Exception { MappingObjectModelProvider provider = getProvider(); provider.mapClassToElement(ArrayWrapper.class, NS, "longArray", null); provider.mapFieldToElement(ArrayWrapper.class, "primitives", NS, "item", null); marshallingTest(new XercesXsMarshaller(), provider, getArrayOfLongXsd(false, true), new ArrayWrapper(new long[0]), EMPTY_ARRAY_XML ); } public void testMarshalEmptyAnnotatedPrimitiveArraySunday() throws Exception { marshallingTest(new MarshallerImpl(), null, getArrayOfLongXsd(false, true), new ArrayWrapper(new long[0]), EMPTY_ARRAY_XML); } public void testUnmarshalEmptyAnnotatedArrayOfWrappers() throws Exception { String xsd = getArrayOfLongXsd(true, true); SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object unmarshalled = unmarshaller.unmarshal(new StringReader(EMPTY_ARRAY_XML), schema); assertNotNull(unmarshalled); assertTrue(unmarshalled instanceof ArrayWrapper); Long[] arr = ((ArrayWrapper)unmarshalled).wrappers; assertNotNull(arr); assertEquals(0, arr.length); } public void testMarshalEmptyAnnotatedArrayOfWrappersXerces() throws Exception { MappingObjectModelProvider provider = getProvider(); provider.mapClassToElement(ArrayWrapper.class, NS, "longArray", null); provider.mapFieldToElement(ArrayWrapper.class, "wrappers", NS, "item", null); marshallingTest(new XercesXsMarshaller(), provider, getArrayOfLongXsd(true, true), new ArrayWrapper(new Long[0]), EMPTY_ARRAY_XML ); } public void testMarshalEmptyAnnotatedArrayOfWrappersSunday() throws Exception { marshallingTest(new MarshallerImpl(), null, getArrayOfLongXsd(true, true), new ArrayWrapper(new Long[0]), EMPTY_ARRAY_XML); } public void testUnmarshalPrimitiveArray() throws Exception { String xsd = getArrayOfLongXsd(false, false); SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object unmarshalled = unmarshaller.unmarshal(new StringReader(PRIMITIVES_XML), schema); assertNotNull(unmarshalled); assertTrue(unmarshalled instanceof long[]); long[] arr = (long[])unmarshalled; assertPrimitiveArray(arr); } public void testMarshalPrimitiveArrayXerces() throws Exception { marshallingTest(new XercesXsMarshaller(), getProvider(), getArrayOfLongXsd(false, false), PRIMITIVES, PRIMITIVES_XML ); } public void testMarshalPrimitiveArraySunday() throws Exception { marshallingTest(new MarshallerImpl(), null, getArrayOfLongXsd(false, false), PRIMITIVES, PRIMITIVES_XML); } public void testUnmarshalAnnotatedPrimtiveArray() throws Exception { String xsd = getArrayOfLongXsd(false, true); SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object unmarshalled = unmarshaller.unmarshal(new StringReader(PRIMITIVES_XML), schema); assertNotNull(unmarshalled); assertTrue(unmarshalled instanceof ArrayWrapper); long[] arr = ((ArrayWrapper)unmarshalled).primitives; assertPrimitiveArray(arr); } public void testMarshalAnnotatedPrimtiveArrayXerces() throws Exception { MappingObjectModelProvider provider = getProvider(); provider.mapClassToElement(ArrayWrapper.class, NS, "longArray", null); provider.mapFieldToElement(ArrayWrapper.class, "primitives", NS, "item", null); marshallingTest(new XercesXsMarshaller(), provider, getArrayOfLongXsd(false, true), new ArrayWrapper(PRIMITIVES), PRIMITIVES_XML ); } public void testMarshalAnnotatedPrimtiveArraySunday() throws Exception { marshallingTest(new MarshallerImpl(), null, getArrayOfLongXsd(false, true), new ArrayWrapper(PRIMITIVES), PRIMITIVES_XML ); } public void testArrayOfWrappersXerces() throws Exception { XercesXsMarshaller marshaller = new XercesXsMarshaller(); arrayOfWrappersTest(marshaller); } public void testArrayOfWrappersSunday() throws Exception { MarshallerImpl marshaller = new MarshallerImpl(); arrayOfWrappersTest(marshaller); } public void testQNameArrayWithPrefixesXerces() throws Exception { qNameArrayWithPrefixesTest(new XercesXsMarshaller()); } public void testQNameArrayWithPrefixesSunday() throws Exception { qNameArrayWithPrefixesTest(new MarshallerImpl()); } public void testQNameArrayWithoutPrefixesXerces() throws Exception { qNameArrayWithoutPrefixesTest(new XercesXsMarshaller()); } public void testQNameArrayWithoutPrefixesSunday() throws Exception { qNameArrayWithoutPrefixesTest(new MarshallerImpl()); } // Private private MappingObjectModelProvider getProvider() { MappingObjectModelProvider provider = new MappingObjectModelProvider(); provider.setIgnoreNotFoundField(false); return provider; } private void marshallingTest(AbstractMarshaller marshaller, ObjectModelProvider provider, String xsd, Object o, String expectedXml) throws Exception { StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(xsd), provider, o, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(expectedXml, marshalled); } private void assertPrimitiveArray(long[] arr) { assertEquals(3, arr.length); assertEquals(-1, arr[0]); assertEquals(0, arr[1]); assertEquals(1, arr[2]); } private void arrayOfWrappersTest(AbstractMarshaller marshaller) throws Exception { String xsd = getArrayOfLongXsd(true, false); arrayOfWrappersTest(xsd, WRAPPERS_XML, WRAPPERS, marshaller); arrayOfWrappersTest(xsd, WRAPPERS_NULL_ITEM_XML, new Long[]{null}, marshaller); } private void arrayOfWrappersTest(String xsd, String xml, Object[] expected, AbstractMarshaller marshaller) throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object unmarshalled = unmarshaller.unmarshal(new StringReader(xml), schema); assertNotNull(unmarshalled); assertTrue(unmarshalled instanceof Long[]); Long[] arr = (Long[])unmarshalled; if(expected != null) { assertNotNull(arr); assertEquals(expected.length, arr.length); for(int i = 0; i < expected.length; ++i) { if(expected[i] != null) { assertEquals(expected[i], arr[i]); } else { assertNull(arr[i]); } } } else { assertNull(arr); } StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(xsd), getProvider(), unmarshalled, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(xml, marshalled); } private String getArrayOfLongXsd(boolean nillableItems, boolean annotations) { StringBuffer buf = new StringBuffer(); buf.append("") .append(""); if(annotations) { buf.append("") .append(" ") .append(" ") .append(" ") .append(""); } buf.append(" ") .append(" "); if(annotations) { buf.append("") .append(" ") .append(" ") .append(" ") .append(""); } buf.append(" ") .append(" ") .append("") .append("") .append(""); return buf.toString(); } private void qNameArrayWithoutPrefixesTest(AbstractMarshaller marshaller) throws Exception { QName[] arr = new QName[]{ new QName("http://some-ns1", "lp1"), new QName("http://some-ns2", "lp2"), new QName("http://some-ns3", "lp3") }; String xsd = "" + "" + "" + "" + "" + "" + "" + "" + "" + ""; SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); String xml = "" + ""; for(int i = 0; i < arr.length; ++i) { String prefix = arr[i].getLocalPart() + "_ns"; xml += "" + prefix + ":" + arr[i].getLocalPart() + ""; } xml += ""; Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); QName[] unmarshalled = (QName[])unmarshaller.unmarshal(new StringReader(xml), schema); assertNotNull(unmarshalled); assertEquals(arr.length, unmarshalled.length); for(int i = 0; i < arr.length; ++i) { assertEquals(arr[i], unmarshalled[i]); } marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); marshaller.declareNamespace("", "http://www.jboss.org/test/xml/qname"); MappingObjectModelProvider provider = getProvider(); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(xsd), provider, arr, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(xml, marshalled); } private void qNameArrayWithPrefixesTest(AbstractMarshaller marshaller) throws Exception { QName[] arr = new QName[]{ new QName("http://some-ns1", "lp1", "ns1"), new QName("http://some-ns2", "lp2", "ns2"), new QName("http://some-ns3", "lp3", "ns3") }; String xsd = "" + "" + "" + "" + "" + "" + "" + "" + "" + ""; SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null); String xml = "" + ""; for(int i = 0; i < arr.length; ++i) { xml += "" + arr[i].getPrefix() + ":" + arr[i].getLocalPart() + ""; } xml += ""; Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); QName[] unmarshalled = (QName[])unmarshaller.unmarshal(new StringReader(xml), schema); assertNotNull(unmarshalled); assertEquals(arr.length, unmarshalled.length); for(int i = 0; i < arr.length; ++i) { assertEquals(arr[i], unmarshalled[i]); } marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); marshaller.declareNamespace(null, "http://www.jboss.org/test/xml/qname"); MappingObjectModelProvider provider = getProvider(); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(xsd), provider, unmarshalled, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(xml, marshalled); } // Inner public static class ArrayWrapper { public long[] primitives; public Long[] wrappers; public ArrayWrapper() { } public ArrayWrapper(long[] primitives) { this.primitives = primitives; } public ArrayWrapper(Long[] wrappers) { this.wrappers = wrappers; } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/elementorder/0000755000175000017500000000000011620316741030476 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/elementorder/test/0000755000175000017500000000000011620316741031455 5ustar twernertwerner././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/elementorder/test/ElementOrderUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/elementorder/test/ElementOr0000644000175000017500000001203111153522526033270 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.elementorder.test; import java.util.List; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xml.elementorder.support.ABSequence; import org.jboss.test.xml.elementorder.support.CDSequence; import org.jboss.test.xml.elementorder.support.ElementOrderRoot; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.builder.JBossXBBuilder; /** * A ElementOrderUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ElementOrderUnitTestCase extends AbstractBuilderTest { public ElementOrderUnitTestCase(String name) { super(name); } private boolean defaultSequence; protected void setUp() throws Exception { super.setUp(); defaultSequence = JBossXBBuilder.isUseUnorderedSequence(); JBossXBBuilder.setUseUnorderedSequence(false); } protected void tearDown() throws Exception { super.tearDown(); JBossXBBuilder.setUseUnorderedSequence(defaultSequence); } public void testValidOneTwoOrder() throws Exception { ElementOrderRoot o = (ElementOrderRoot) unmarshalObject(ElementOrderRoot.class); assertEquals("one", o.getFrist()); assertEquals("two", o.getSecond()); } public void testWrongOneTwoOrder() throws Exception { try { unmarshalObject(ElementOrderRoot.class); fail("Element first cannot appear in this position (possibly child elements of root are in the wrong order)"); } catch(JBossXBException e) { JBossXBRuntimeException re = (JBossXBRuntimeException) e.getCause(); assertEquals("first cannot appear in this position. Expected content of root is sequence: first? second? {sequence abSequence}? {sequence cdSequence}*", re.getMessage()); } } public void testValidABSequence() throws Exception { ElementOrderRoot o = (ElementOrderRoot) unmarshalObject(ElementOrderRoot.class); ABSequence ab = o.getABSequence(); assertNotNull(ab); assertEquals("a", ab.getA()); assertEquals("b", ab.getB()); } public void testWrongABSequence() throws Exception { try { unmarshalObject(ElementOrderRoot.class); fail("Element a cannot appear in this position (possibly child elements of root are in the wrong order)"); } catch(JBossXBException e) { JBossXBRuntimeException re = (JBossXBRuntimeException) e.getCause(); assertEquals("a cannot appear in this position. Expected content of root is sequence: first? second? {sequence abSequence}? {sequence cdSequence}*", re.getMessage()); } } public void testValidRepeatedCD() throws Exception { ElementOrderRoot o = (ElementOrderRoot) unmarshalObject(ElementOrderRoot.class); List repeatedCD = o.getRepeatedCD(); assertNotNull(repeatedCD); assertEquals(2, repeatedCD.size()); CDSequence cd = repeatedCD.get(0); assertNotNull(cd); assertEquals("c1", cd.getC()); assertEquals("d1", cd.getD()); cd = repeatedCD.get(1); assertNotNull(cd); assertEquals("c2", cd.getC()); assertEquals("d2", cd.getD()); } // TODO this is a known failure // the impl doesn't check XmlElement.required=true and since the sequence is repeatable, the test passes public void testWrongRepeatedCD() throws Exception { try { unmarshalObject(ElementOrderRoot.class); fail("Element d cannot appear in this position (possibly child elements of root are in the wrong order)"); } catch(JBossXBException e) { JBossXBRuntimeException re = (JBossXBRuntimeException) e.getCause(); assertEquals("d not found as a child of root in sequence: first? second? {sequence abSequence}? {sequence cdSequence}*", re.getMessage()); } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/elementorder/support/0000755000175000017500000000000011620316741032212 5ustar twernertwerner././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/elementorder/support/CDSequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/elementorder/support/CDSequ0000644000175000017500000000347611143235515033272 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.elementorder.support; import javax.xml.bind.annotation.XmlElement; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; /** * A ABSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlModelGroup(name="cdSequence", kind=JBossXmlConstants.MODEL_GROUP_SEQUENCE, propOrder={"c", "d"}) public class CDSequence { private String c; private String d; @XmlElement(required=true) public String getC() { return c; } public void setC(String c) { this.c = c; } @XmlElement(required=true) public String getD() { return d; } public void setD(String d) { this.d = d; } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/elementorder/support/ElementOrderRoot.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/elementorder/support/Elemen0000644000175000017500000000436411143235515033350 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.elementorder.support; import java.util.List; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A ElementOrderRoot. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"first", "second", "ABSequence", "repeatedCD"}) public class ElementOrderRoot { private String first; private String second; private ABSequence abSequence; private List repeatedCD; public String getFrist() { return first; } public void setFirst(String first) { this.first = first; } public String getSecond() { return second; } public void setSecond(String second) { this.second = second; } public ABSequence getABSequence() { return abSequence; } public void setABSequence(ABSequence abSequence) { this.abSequence = abSequence; } public List getRepeatedCD() { return repeatedCD; } public void setRepeatedCD(List repeatedCD) { this.repeatedCD = repeatedCD; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/elementorder/support/ABSequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/elementorder/support/ABSequ0000644000175000017500000000332211151050602033243 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.elementorder.support; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; /** * A ABSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlModelGroup(name="abSequence", kind=JBossXmlConstants.MODEL_GROUP_SEQUENCE, propOrder={"a", "b"}) public class ABSequence { private String a; private String b; public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/ListValueUnitTestCase.java0000644000175000017500000000627411171577572033105 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.util.List; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlValue; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A ListValueUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ListValueUnitTestCase extends AbstractJBossXBTest { public ListValueUnitTestCase(String name) { super(name); } public void testCtor() throws Exception { //SchemaBinding schema = JBossXBBuilder.build(Root.class); //Object o = unmarshal("ListValueUnitTestCase_" + getName() + ".xml", schema); Object o = unmarshal(); assertNotNull(o); assertTrue(o instanceof Root); Root root = (Root) o; assertEquals("attr", root.getAttr()); int[] ints = root.getInts(); assertNotNull(ints); assertEquals(2, ints.length); assertEquals(1, ints[0]); assertEquals(2, ints[1]); List strs = root.getStrs(); assertNotNull(strs); assertEquals(2, strs.size()); assertEquals("item1", strs.get(0)); assertEquals("item2", strs.get(1)); } public static class Root { private String attr; private int[] ints; private List strs; public Root(String attr, List items, int[] ints) { this.attr = attr; this.ints = ints; this.strs = items; } public String getAttr() { return attr; } public void setAttr(String attr) { this.attr = attr; } public int[] getInts() { return ints; } public void setInts(int[] ints) { this.ints = ints; } public List getStrs() { return strs; } public void setStrs(List items) { this.strs = items; } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/XOPUnitTestCase.java0000644000175000017500000005376011154172516031633 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBeforeSetParentCallback; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnmarshallingContext; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.xop.XOPMarshaller; import org.jboss.xb.binding.sunday.xop.XOPObject; import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller; import org.jboss.xb.binding.sunday.xop.SimpleDataSource; import org.xml.sax.SAXException; import javax.xml.transform.Source; import javax.xml.namespace.QName; import javax.activation.DataSource; import java.awt.Graphics; import java.awt.Image; import java.awt.image.ImageObserver; import java.awt.image.ImageProducer; import java.io.FileInputStream; import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; import java.util.Arrays; import java.util.Iterator; import junit.framework.TestSuite; /** * @author Alexey Loubyansky * @version $Revision: 3021 $ */ public class XOPUnitTestCase extends AbstractJBossXBTest { public static final TestSuite suite() { return new TestSuite(XOPUnitTestCase.class); } public XOPUnitTestCase(String name) { super(name); } private static final XOPMarshaller XOP_ENABLED_MARSH = new XOPMarshaller() { public boolean isXOPPackage() { return true; } public String addMtomAttachment(byte[] data, String elementNamespace, String elementName) { return "cid:" + elementName; } public String addMtomAttachment(XOPObject dataHandler, String elementNamespace, String elementName) { return "cid:" + elementName; } }; private static final XOPMarshaller XOP_DISABLED_MARSH = new XOPMarshaller() { public boolean isXOPPackage() { return false; } public String addMtomAttachment(byte[] data, String elementNamespace, String elementName) { return "cid:" + elementName; } public String addMtomAttachment(XOPObject dataHandler, String elementNamespace, String elementName) { return "cid:" + elementName; } }; private static final Image AWT_IMAGE = new Image() { private final int width = 5; private final int height = 7; public int getWidth(ImageObserver observer) { return width; } public int getHeight(ImageObserver observer) { return height; } public ImageProducer getSource() { throw new UnsupportedOperationException("getSource is not implemented."); } public Graphics getGraphics() { throw new UnsupportedOperationException("getGraphics is not implemented."); } public Object getProperty(String name, ImageObserver observer) { throw new UnsupportedOperationException("getProperty is not implemented."); } public void flush() { throw new UnsupportedOperationException("flush is not implemented."); } }; private static final Source SOURCE = new Source() { private String systemId = "http://www.jboss.org/test/xml/xop"; public void setSystemId(String systemId) { this.systemId = systemId; } public String getSystemId() { return systemId; } }; private static final XOPUnmarshaller XOP_ENABLED_UNMARSH = new XOPUnmarshaller() { public boolean isXOPPackage() { return true; } public XOPObject getAttachmentAsDataHandler(String cid) { XOPObject xopObject; if(cid.endsWith("awtImage")) { xopObject = new XOPObject(AWT_IMAGE); xopObject.setContentType("image/jpeg"); } else if(cid.endsWith("source")) { xopObject = new XOPObject(SOURCE); xopObject.setContentType("application/xml"); } else if(cid.endsWith("string")) { xopObject = new XOPObject("string"); xopObject.setContentType("text/xml"); } else if(cid.endsWith("octets")) { xopObject = new XOPObject("octets".getBytes()); xopObject.setContentType("application/octet-stream"); } else if(cid.endsWith("xopContent")) { // The XOPUnmarshaller returns an object // that doesn't match that actual java property xopObject = new XOPObject("xopContent".getBytes()); xopObject.setContentType("application/octet-stream"); } else { try { DataSource ds = new SimpleDataSource(cid.substring(4).getBytes(), "application/octet-stream"); xopObject = new XOPObject(ds.getInputStream()); xopObject.setContentType("application/octet-stream"); } catch (IOException e) { throw new IllegalStateException(e.getMessage()); } } return xopObject; } public byte[] getAttachmentAsByteArray(String cid) { return cid.substring(4).getBytes(); } }; private static final XOPUnmarshaller XOP_DISABLED_UNMARSH = new XOPUnmarshaller() { public boolean isXOPPackage() { return false; } public XOPObject getAttachmentAsDataHandler(String cid) { throw new UnsupportedOperationException("getAttachmentAsDataHandler is not implemented."); } public byte[] getAttachmentAsByteArray(String cid) { throw new UnsupportedOperationException("getAttachmentAsByteArray is not implemented."); } }; private static SchemaBinding SCHEMA; private static String NON_OPT_XML; protected void setUp() throws Exception { super.setUp(); if(SCHEMA == null) { String testXsd = findXML(rootName + ".xsd"); MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); String xmimeXsd = getSchemaLocation(getClass(), "xmlmime.xsd"); resolver.mapSchemaLocation("http://www.w3.org/2005/05/xmlmime", xmimeXsd); SCHEMA = XsdBinder.bind(testXsd, resolver); SCHEMA.setIgnoreUnresolvedFieldOrClass(false); TermBeforeSetParentCallback callback = new TermBeforeSetParentCallback() { public Object beforeSetParent(Object o, UnmarshallingContext ctx) { ElementBinding e = (ElementBinding) ctx.getParticle().getTerm(); Class propType = ctx.resolvePropertyType(); String localPart = e.getQName().getLocalPart(); if("image".equals(localPart) || "sig".equals(localPart) || "imageWithContentType".equals(localPart) || "octets".equals(localPart) || "jpeg".equals(localPart)) { assertEquals("expected " + byte[].class + " for " + localPart, byte[].class, propType); } else if("awtImage".equals(localPart)) { assertEquals(java.awt.Image.class, propType); } else if("string".equals(localPart)) { assertEquals(String.class, propType); } else if("source".equals(localPart)) { assertEquals(javax.xml.transform.Source.class, propType); } else { fail("unexpected element: " + e.getQName()); } return o; } }; ElementBinding e = SCHEMA.getElement(new javax.xml.namespace.QName("http://www.jboss.org/xml/test/xop", "e")); SequenceBinding seq = (SequenceBinding) e.getType().getParticle().getTerm(); for(Iterator i = seq.getParticles().iterator(); i.hasNext();) { ParticleBinding particle = (ParticleBinding) i.next(); ElementBinding child = (ElementBinding) particle.getTerm(); if(! "xopContent".equals( child.getQName().getLocalPart())) child.setBeforeSetParentCallback(callback); } TermBeforeSetParentCallback xmimeBase64Callback = new TermBeforeSetParentCallback() { public Object beforeSetParent(Object o, UnmarshallingContext ctx) { ElementBinding e = (ElementBinding) ctx.getParticle().getTerm(); Class propType = ctx.resolvePropertyType(); assertNotNull("Failed to resolve property type for "+e.getQName(), propType); String localPart = e.getQName().getLocalPart(); if("xopContent".equals(localPart)) { assertEquals(String.class, propType); if(propType.equals(String.class)) { o = new String( (byte[])o); } } /* alexey: this is never the case else if("Include".equals(localPart)) { assertEquals(String.class, propType); assertTrue( (o instanceof byte[])); // Type conversion required if(propType.equals(String.class)) o = new String( (byte[])o); } */ return o; } }; // xmime complex types TypeBinding xmimeBase64Type = SCHEMA.getType(new QName("http://www.w3.org/2005/05/xmlmime", "base64Binary")); if(xmimeBase64Type!=null) { xmimeBase64Type.setBeforeSetParentCallback( xmimeBase64Callback ); // alexey: the following shouldn't be used. // callbacks should be set on the types and/or elements // that can have xop:Include as their content // xop:Include // Uncomment the following lines in order to intercept the // XOPUnmarshaller result _before_ the actual setter is invoked /* ModelGroupBinding modelGroup = (ModelGroupBinding)xmimeBase64Type.getParticle().getTerm(); ParticleBinding particle = (ParticleBinding)modelGroup.getParticles().iterator().next(); ElementBinding xopInclude = (ElementBinding)particle.getTerm(); if(! xopInclude.getQName().equals(new QName("http://www.w3.org/2004/08/xop/include", "Include"))) throw new RuntimeException("Looks like the JBossXB XOP implementation has changed, please open a JIRA issue"); xopInclude.setBeforeSetParentCallback(interceptXOPUnmarshallerResults); */ } } if(NON_OPT_XML == null) { NON_OPT_XML = readXml(rootName + ".xml"); } } public void testUnmarshalNonOptimized() throws Exception { SCHEMA.setXopUnmarshaller(XOP_DISABLED_UNMARSH); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(NON_OPT_XML), SCHEMA); assertNotNull(o); assertTrue(o instanceof E); E e = (E)o; assertNotNull(e.image); assertEquals("image", new String(e.image)); assertNotNull(e.sig); assertEquals("sig", new String(e.sig)); } public void testMarshalWithDisabledXop() throws Exception { assertXmlEqual(NON_OPT_XML, marshal(XOP_DISABLED_MARSH)); } public void testUnmarshalOptimized() throws Exception { SCHEMA.setXopUnmarshaller(XOP_ENABLED_UNMARSH); String xml = readXml(rootName + "Optimized.xml"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(xml), SCHEMA); assertNotNull(o); assertTrue(o instanceof E); E e = (E)o; assertNotNull(e.image); assertEquals("image", new String(e.image)); assertNotNull(e.sig); assertEquals("sig", new String(e.sig)); } public void testMarshalWithEnabledXop() throws Exception { String xml = readXml(rootName + "Optimized.xml"); assertXmlEqual(xml, marshal(XOP_ENABLED_MARSH)); } public void testUnmarshalImageWithOptimized() throws Exception { SCHEMA.setXopUnmarshaller(XOP_ENABLED_UNMARSH); String xml = readXml(rootName + "ImageWithContentType.xml"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(xml), SCHEMA); assertNotNull(o); assertTrue(o instanceof E); E e = (E)o; assertNotNull(e.imageWithContentType); assertEquals("imageWithContentType", new String(e.imageWithContentType)); } public void testMarshalImageWithContentType() throws Exception { String xml = readXml(rootName + "ImageWithContentType.xml"); E e = new E(); e.imageWithContentType = "imageWithContentType".getBytes(); String marshalled = marshal(XOP_ENABLED_MARSH, e); assertXmlEqual(xml, marshalled); } public void testUnmarshalJpegOptimized() throws Exception { SCHEMA.setXopUnmarshaller(XOP_ENABLED_UNMARSH); String xml = readXml(rootName + "Jpeg.xml"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(xml), SCHEMA); assertNotNull(o); assertTrue(o instanceof E); E e = (E)o; assertNotNull(e.jpeg); assertEquals("jpeg", new String(e.jpeg)); } public void testMarshalJpeg() throws Exception { String xml = readXml(rootName + "Jpeg.xml"); E e = new E(); e.jpeg = "jpeg".getBytes(); String marshalled = marshal(XOP_ENABLED_MARSH, e); assertXmlEqual(xml, marshalled); } public void testMarshalAWTImage() throws Exception { E e = new E(); e.awtImage = AWT_IMAGE; String marshalled = marshal(XOP_ENABLED_MARSH, e); assertXmlEqual(getOptimizedXml("awtImage"), marshalled); } public void testUnmarshalAwtImage() throws Exception { SCHEMA.setXopUnmarshaller(XOP_ENABLED_UNMARSH); String xml = getOptimizedXml("awtImage"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(xml), SCHEMA); assertNotNull(o); assertTrue(o instanceof E); E e = (E)o; assertNotNull(e.awtImage); assertEquals(5, e.awtImage.getWidth(null)); assertEquals(7, e.awtImage.getHeight(null)); } public void testMarshalSource() throws Exception { E e = new E(); e.source = SOURCE; String marshalled = marshal(XOP_ENABLED_MARSH, e); assertXmlEqual(getOptimizedXml("source"), marshalled); } public void testUnmarshalSource() throws Exception { SCHEMA.setXopUnmarshaller(XOP_ENABLED_UNMARSH); String xml = getOptimizedXml("source"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(xml), SCHEMA); assertNotNull(o); assertTrue(o instanceof E); E e = (E)o; assertNotNull(e.source); assertEquals("http://www.jboss.org/test/xml/xop", e.source.getSystemId()); } public void testMarshalString() throws Exception { E e = new E(); e.string = "string"; String marshalled = marshal(XOP_ENABLED_MARSH, e); assertXmlEqual(getOptimizedXml("string"), marshalled); } /** * Test a simple xsd:base64Binary declaration */ public void testMarshalOctets() throws Exception { E e = new E(); e.octets = "octets".getBytes(); String marshalled = marshal(XOP_ENABLED_MARSH, e); assertXmlEqual(getOptimizedXml("octets"), marshalled); } /** * Test unmarshalling of a simple xsd:base64Binary declaration */ public void testUnmarshalOctets() throws Exception { SCHEMA.setXopUnmarshaller(XOP_ENABLED_UNMARSH); String xml = getOptimizedXml("octets"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(xml), SCHEMA); assertNotNull(o); assertTrue(o instanceof E); E e = (E)o; assertNotNull(e.octets); assertEquals("octets", new String(e.octets)); } public void testUnmarshalString() throws Exception { SCHEMA.setXopUnmarshaller(XOP_ENABLED_UNMARSH); String xml = getOptimizedXml("string"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(xml), SCHEMA); assertNotNull(o); assertTrue(o instanceof E); E e = (E)o; assertNotNull(e.string); assertEquals("string", e.string); } public void testUnmarshalStringWithTypeConversion() throws Exception { SCHEMA.setXopUnmarshaller(XOP_ENABLED_UNMARSH); String xml = getOptimizedXml("xopContent"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(xml), SCHEMA); assertNotNull(o); assertTrue(o instanceof E); E e = (E)o; assertNotNull(e.xopContent); assertEquals("xopContent", e.xopContent); } public void testTopLevelUnmarshalling() throws Exception { String xsd = "" + " " + " " + ""; MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); String xmimeXsd = getSchemaLocation(getClass(), "xmlmime.xsd"); resolver.mapSchemaLocation("http://www.w3.org/2005/05/xmlmime", xmimeXsd); SchemaBinding schema = XsdBinder.bind(new StringReader(xsd), null, resolver); schema.setIgnoreUnresolvedFieldOrClass(false); schema.setXopUnmarshaller(XOP_ENABLED_UNMARSH); String xml = "" + " " + ""; Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(xml), schema); assertNotNull(o); assertTrue(o instanceof byte[]); assertTrue(Arrays.equals("applxml".getBytes(), (byte[])o)); } // Private private String readXml(String name) throws IOException { String testXml = getResource(name).getFile(); FileInputStream fis = new FileInputStream(testXml); byte[] bytes = new byte[fis.available()]; fis.read(bytes); fis.close(); return new String(bytes); } private static String marshal(XOPMarshaller xopMarshaller) throws IOException, SAXException { E e = new E(); e.image = "image".getBytes(); e.sig = "sig".getBytes(); return marshal(xopMarshaller, e); } private static String marshal(XOPMarshaller xopMarshaller, E e) throws IOException, SAXException { SCHEMA.setXopMarshaller(xopMarshaller); StringWriter writer = new StringWriter(); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.marshal(SCHEMA, null, e, writer); return writer.getBuffer().toString(); } private static String getOptimizedXml(String elementName) { return "" + " <" + elementName + ">" + " " + " " + ""; } // Inner public static class E { public byte[] image; public byte[] sig; public byte[] imageWithContentType; public byte[] jpeg; public Image awtImage; public Source source; public String string; public byte[] octets; public String xopContent; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/collections/0000755000175000017500000000000011620316741030327 5ustar twernertwerner././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/collections/Collections.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/collections/Collections.jav0000644000175000017500000001104211061473704033307 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.collections; import java.util.Arrays; import java.util.Collection; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Collections { public static Collections getInstance() { Collections c = new Collections(); c.stringArray = new String[]{"str1", "str2", "str3"}; c.intCol = Arrays.asList(new Integer[]{new Integer(1), new Integer(2), new Integer(3)}); c.itemArray = new String[]{"item1", "item2", "item3"}; c.itemCol = Arrays.asList(new String[]{"item4", "item5", "item6"}); c.intArray = new int[3]; c.intArray[0] = 1; c.intArray[1] = 0; c.intArray[2] = -1; return c; } private String[] stringArray; private Collection intCol; private String[] itemArray; private Collection itemCol; private int[] intArray; public String[] getStringArray() { return stringArray; } public void setStringArray(String[] stringArray) { this.stringArray = stringArray; } public Collection getIntCol() { return intCol; } public void setIntCol(Collection intCol) { this.intCol = intCol; } public String[] getItemArray() { return itemArray; } public void setItemArray(String[] itemArray) { this.itemArray = itemArray; } public Collection getItemCol() { return itemCol; } public void setItemCol(Collection itemCol) { this.itemCol = itemCol; } public int[] getIntArray() { return intArray; } public void setIntArray(int[] intArray) { this.intArray = intArray; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Collections)) { return false; } final Collections collections = (Collections)o; if(!Arrays.equals(intArray, collections.intArray)) { return false; } if(intCol != null ? !intCol.equals(collections.intCol) : collections.intCol != null) { return false; } if(!Arrays.equals(itemArray, collections.itemArray)) { return false; } if(itemCol != null ? !itemCol.equals(collections.itemCol) : collections.itemCol != null) { return false; } if(!Arrays.equals(stringArray, collections.stringArray)) { return false; } return true; } public int hashCode() { int result; result = (intCol != null ? intCol.hashCode() : 0); result = 29 * result + (itemCol != null ? itemCol.hashCode() : 0); return result; } public String toString() { Integer[] ia = intArray == null ? null : new Integer[intArray.length]; if(ia != null) { for(int i = 0; i < intArray.length; ++i) { ia[i] = new Integer(intArray[i]); } } return "[collections stringArray=" + (stringArray == null ? "null" : Arrays.asList(stringArray).toString()) + ", intCol=" + intCol + ", itemArray=" + (itemArray == null ? "null" : Arrays.asList(itemArray).toString()) + ", itemCol=" + itemCol + ", intArray=" + (ia == null ? "null" : Arrays.asList(ia).toString()) + "]"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/PojoServerTestBase.java0000644000175000017500000012346211061473704032417 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.net.URL; import java.util.Iterator; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.test.BaseTestCase; import org.jboss.test.xml.pojoserver.deployment.AbstractKernelDeployment; import org.jboss.test.xml.pojoserver.metadata.AbstractBeanMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractCollectionMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractDemandMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractDependencyValueMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractListMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractMapMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractParameterMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractPropertyMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractSetMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractSupplyMetaData; import org.jboss.test.xml.pojoserver.metadata.AbstractValueMetaData; import org.jboss.test.xml.pojoserver.metadata.ConstructorMetaData; import org.jboss.test.xml.pojoserver.metadata.ControllerState; import org.jboss.test.xml.pojoserver.metadata.GenericBeanFactory; import org.jboss.test.xml.pojoserver.metadata.StringValueMetaData; import org.jboss.test.xml.pojoserver.metadata.ValueMetaData; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * @author Alexey Loubyansky * @version $Revision: 57517 $ */ public abstract class PojoServerTestBase extends BaseTestCase { /** The schema name */ protected static final String SCHEMA_NAME = "/xml/bean-deployer_1_0.xsd"; /** The namespace */ protected static final String BEAN_DEPLOYER_NS = "urn:jboss:bean-deployer"; /** The deployment binding */ protected static final QName deploymentTypeQName = new QName(BEAN_DEPLOYER_NS, "deploymentType"); /** The bean binding */ protected static final QName beanTypeQName = new QName(BEAN_DEPLOYER_NS, "beanType"); /** The bean element name */ protected static final QName beanQName = new QName(BEAN_DEPLOYER_NS, "bean"); /** The beanfactory binding */ protected static final QName beanFactoryTypeQName = new QName(BEAN_DEPLOYER_NS, "beanfactoryType"); /** The beanfactory element name */ protected static final QName beanFactoryQName = new QName(BEAN_DEPLOYER_NS, "beanfactory"); /** The constructor binding */ protected static final QName constructorTypeQName = new QName(BEAN_DEPLOYER_NS, "constructorType"); /** The constructor element name */ protected static final QName constructorQName = new QName(BEAN_DEPLOYER_NS, "constructor"); /** The factory element name */ protected static final QName factoryQName = new QName(BEAN_DEPLOYER_NS, "factory"); /** The parameter binding */ protected static final QName parameterTypeQName = new QName(BEAN_DEPLOYER_NS, "parameterType"); /** The parameter element name */ protected static final QName parameterQName = new QName(BEAN_DEPLOYER_NS, "parameter"); /** The lifecycle binding */ protected static final QName lifecycleTypeQName = new QName(BEAN_DEPLOYER_NS, "lifecycleType"); /** The create element name */ protected static final QName createQName = new QName(BEAN_DEPLOYER_NS, "create"); /** The start element name */ protected static final QName startQName = new QName(BEAN_DEPLOYER_NS, "start"); /** The stop element name */ protected static final QName stopQName = new QName(BEAN_DEPLOYER_NS, "stop"); /** The destroy element name */ protected static final QName destroyQName = new QName(BEAN_DEPLOYER_NS, "destroy"); /** The property binding */ protected static final QName propertyTypeQName = new QName(BEAN_DEPLOYER_NS, "propertyType"); /** The property element name */ protected static final QName propertyQName = new QName(BEAN_DEPLOYER_NS, "property"); /** The depends binding */ protected static final QName dependsTypeQName = new QName(BEAN_DEPLOYER_NS, "dependsType"); /** The depends element name */ protected static final QName dependsQName = new QName(BEAN_DEPLOYER_NS, "depends"); /** The demand binding */ protected static final QName demandTypeQName = new QName(BEAN_DEPLOYER_NS, "demandType"); /** The demand element name */ protected static final QName demandQName = new QName(BEAN_DEPLOYER_NS, "demand"); /** The supply binding */ protected static final QName supplyTypeQName = new QName(BEAN_DEPLOYER_NS, "supplyType"); /** The supply element name */ protected static final QName supplyQName = new QName(BEAN_DEPLOYER_NS, "supply"); /** The dependency binding */ protected static final QName dependencyTypeQName = new QName(BEAN_DEPLOYER_NS, "dependencyType"); /** The inject element name */ protected static final QName injectQName = new QName(BEAN_DEPLOYER_NS, "inject"); /** The plain value binding */ protected static final QName plainValueTypeQName = new QName(BEAN_DEPLOYER_NS, "plainValueType"); /** The value binding */ protected static final QName valueTypeQName = new QName(BEAN_DEPLOYER_NS, "valueType"); /** The value element name */ protected static final QName valueQName = new QName(BEAN_DEPLOYER_NS, "value"); /** The null element name */ protected static final QName nullQName = new QName(BEAN_DEPLOYER_NS, "null"); /** The collection binding */ protected static final QName collectionTypeQName = new QName(BEAN_DEPLOYER_NS, "collectionType"); /** The collection element name */ protected static final QName collectionQName = new QName(BEAN_DEPLOYER_NS, "collection"); /** The list binding */ protected static final QName listTypeQName = new QName(BEAN_DEPLOYER_NS, "listType"); /** The list element name */ protected static final QName listQName = new QName(BEAN_DEPLOYER_NS, "list"); /** The set binding */ protected static final QName setTypeQName = new QName(BEAN_DEPLOYER_NS, "setType"); /** The set element name */ protected static final QName setQName = new QName(BEAN_DEPLOYER_NS, "set"); /** The array binding */ protected static final QName arrayTypeQName = new QName(BEAN_DEPLOYER_NS, "arrayType"); /** The array element name */ protected static final QName arrayQName = new QName(BEAN_DEPLOYER_NS, "array"); /** The map binding */ protected static final QName mapTypeQName = new QName(BEAN_DEPLOYER_NS, "mapType"); /** The map element name */ protected static final QName mapQName = new QName(BEAN_DEPLOYER_NS, "map"); /** The entry binding */ protected static final QName entryTypeQName = new QName(BEAN_DEPLOYER_NS, "entryType"); /** The entry element name */ protected static final QName entryQName = new QName(BEAN_DEPLOYER_NS, "entry"); /** The key element name */ protected static final QName keyQName = new QName(BEAN_DEPLOYER_NS, "key"); /** The valueGroup name */ protected static final QName valueGroupQName = new QName(BEAN_DEPLOYER_NS, "valueGroup"); /** The schema binding */ protected static SchemaBinding schemaBinding; /** The value handler */ protected static ValueMetaDataElementInterceptor VALUES = new ValueMetaDataElementInterceptor(); /** The null handler */ protected static NullValueElementInterceptor NULLVALUES = new NullValueElementInterceptor(); public PojoServerTestBase(String localName) { super(localName); } public void setUp() throws Exception { super.setUp(); if (schemaBinding == null) { log.debug("================ Getting Schema Binding"); long start = System.currentTimeMillis(); schemaBinding = getSchemaBinding(); log.debug("================ Got Schema Binding in " + (System.currentTimeMillis() - start) + "ms"); /** TODO assertSchemaBinding(SCHEMA); */ } } public void configureLogging() { //enableTrace("org.jboss.xb"); } /* public void testGenericBeanFactory() throws Exception { AbstractKernelDeployment deployment = unmarshal(); assertNotNull(deployment); assertEquals(2, deployment.getBeans().size()); AbstractBeanMetaData genericBeanFactory = (AbstractBeanMetaData)deployment.getBeans().get(0); assertNotNull(genericBeanFactory); assertEquals("GenericBeanFactory", genericBeanFactory.getName()); assertEquals(GenericBeanFactory.class.getName(), genericBeanFactory.getBean()); assertNotNull(genericBeanFactory.getProperties()); assertEquals(3, genericBeanFactory.getProperties().size()); AbstractPropertyMetaData beanProp = null; AbstractPropertyMetaData ctorProp = null; AbstractPropertyMetaData propsProp = null; for(Iterator i = genericBeanFactory.getProperties().iterator(); i.hasNext();) { AbstractPropertyMetaData prop = (AbstractPropertyMetaData)i.next(); if("bean".equals(prop.getName())) { beanProp = prop; } else if("constructor".equals(prop.getName())) { ctorProp = prop; } else if("properties".equals(prop.getName())) { propsProp = prop; } else { fail("Unexpected property: " + prop.getName()); } } assertEquals("bean", beanProp.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", beanProp.getValue().getUnderlyingValue()); // todo validation of property/parameter assertEquals("constructor", ctorProp.getName()); assertEquals("properties", propsProp.getName()); AbstractMapMetaData beanProps = (AbstractMapMetaData) propsProp.getValue(); assertNotNull(beanProps); assertEquals(1, beanProps.size()); Map.Entry entry = (Map.Entry) beanProps.entrySet().iterator().next(); AbstractValueMetaData otherKey = (AbstractValueMetaData) entry.getKey(); assertNotNull(otherKey); assertEquals("other", otherKey.getValue()); AbstractValueMetaData otherValue = (AbstractValueMetaData) entry.getValue(); assertNotNull(otherValue); AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)otherValue.getValue(); assertNotNull(dependency); assertEquals("SimpleBean2", dependency.getValue()); AbstractBeanMetaData simpleBean2 = (AbstractBeanMetaData)deployment.getBeans().get(1); assertEquals("SimpleBean2", simpleBean2.getName()); assertEquals("org.jboss.test.kernel.xml.support.SimpleBeanImpl", simpleBean2.getBean()); ConstructorMetaData ctor = simpleBean2.getConstructor(); assertNotNull(ctor); assertNotNull(ctor.getParameters()); assertEquals(1, ctor.getParameters().size()); AbstractParameterMetaData param = (AbstractParameterMetaData)ctor.getParameters().get(0); assertEquals(String.class.getName(), param.getType()); assertEquals("Bean2", param.getValue().getUnderlyingValue()); } */ public void testAttributeDependency() throws Exception { AbstractKernelDeployment deployment = unmarshal(); assertNotNull(deployment.getBeans()); assertEquals(2, deployment.getBeans().size()); AbstractBeanMetaData bean = deployment.getBeans().get(0); assertEquals("SimpleBean1", bean.getName()); assertEquals("org.jboss.test.kernel.xml.support.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getProperties()); assertEquals(1, bean.getProperties().size()); AbstractPropertyMetaData prop = bean.getProperties().iterator().next(); assertNotNull(prop); assertEquals("other", prop.getName()); assertTrue(prop.getValue() instanceof AbstractDependencyValueMetaData); AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)prop.getValue(); assertEquals("SimpleBean2", dependency.getValue()); bean = deployment.getBeans().get(1); assertEquals("SimpleBean2", bean.getName()); assertEquals("org.jboss.test.kernel.xml.support.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getConstructor()); ConstructorMetaData ctor = bean.getConstructor(); assertNotNull(ctor.getParameters()); assertEquals(1, ctor.getParameters().size()); AbstractParameterMetaData param = ctor.getParameters().get(0); assertEquals("java.lang.String", param.getType()); assertEquals("Bean2", param.getValue().getUnderlyingValue()); } public void testAttributeDependencyDependentState() throws Exception { AbstractKernelDeployment deployment = unmarshal(); assertNotNull(deployment.getBeans()); assertEquals(2, deployment.getBeans().size()); AbstractBeanMetaData bean = deployment.getBeans().get(0); assertEquals("SimpleBean1", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getProperties()); assertEquals(1, bean.getProperties().size()); AbstractPropertyMetaData prop = bean.getProperties().iterator().next(); assertNotNull(prop); assertEquals("other", prop.getName()); assertTrue(prop.getValue() instanceof AbstractDependencyValueMetaData); AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)prop.getValue(); assertEquals("SimpleBean2", dependency.getValue()); bean = deployment.getBeans().get(1); assertEquals("SimpleBean2", bean.getName()); assertEquals("org.jboss.test.kernel.xml.support.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getConstructor()); ConstructorMetaData ctor = bean.getConstructor(); assertNotNull(ctor.getParameters()); assertEquals(1, ctor.getParameters().size()); AbstractParameterMetaData param = ctor.getParameters().get(0); assertEquals("java.lang.String", param.getType()); assertEquals("Bean2", param.getValue().getUnderlyingValue()); } public void testConfigure() throws Exception { AbstractKernelDeployment deployment = unmarshal(); assertNotNull(deployment.getBeans()); assertEquals(1, deployment.getBeans().size()); AbstractBeanMetaData bean = deployment.getBeans().get(0); assertEquals("SimpleBean1", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getProperties()); assertEquals(18, bean.getProperties().size()); for(Iterator i = bean.getProperties().iterator(); i.hasNext();) { AbstractPropertyMetaData prop = i.next(); String name = prop.getName(); Object value = prop.getValue().getUnderlyingValue(); assertConfigureProperty(name, value); } } public void testConfigureNested() throws Exception { AbstractKernelDeployment deployment = unmarshal(); assertNotNull(deployment.getBeans()); assertEquals(1, deployment.getBeans().size()); AbstractBeanMetaData bean = deployment.getBeans().get(0); assertEquals("SimpleBean1", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getProperties()); assertEquals(19, bean.getProperties().size()); for(Iterator i = bean.getProperties().iterator(); i.hasNext();) { AbstractPropertyMetaData prop = i.next(); String name = prop.getName(); if("other".equals(name)) { /** TODO AbstractBeanMetaData nested = (AbstractBeanMetaData)prop.getValue("NestedSimpleBean1"); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); assertNotNull(nested); assertNotNull(bean.getProperties()); assertEquals(19, bean.getProperties().size()); for(Iterator j = nested.getProperties().iterator(); j.hasNext();) { AbstractPropertyMetaData nestedProp = (AbstractPropertyMetaData)j.next(); String nestedName = nestedProp.getName(); if("other".equals(nestedName)) { assertNull(nestedProp.getValue()); } else { Object value = nestedProp.getValue().getUnderlyingValue(); assertConfigureProperty(nestedName, value); } } */ } else { Object value = prop.getValue().getUnderlyingValue(); assertConfigureProperty(name, value); } } } public void testConstructorDependency() throws Exception { AbstractKernelDeployment deployment = unmarshal(); assertNotNull(deployment.getBeans()); assertEquals(2, deployment.getBeans().size()); AbstractBeanMetaData bean = deployment.getBeans().get(0); assertEquals("SimpleBean1", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getConstructor()); ConstructorMetaData ctor = bean.getConstructor(); assertNotNull(ctor.getParameters()); assertEquals(1, ctor.getParameters().size()); Object obj = ctor.getParameters().get(0); assertNotNull(obj); assertTrue(obj instanceof AbstractParameterMetaData); AbstractParameterMetaData param = (AbstractParameterMetaData) obj; assertEquals("org.jboss.test.kernel.xml.support.SimpleBean", param.getType()); assertTrue(param.getValue() instanceof AbstractDependencyValueMetaData); AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)param.getValue(); assertEquals("SimpleBean2", dependency.getValue()); bean = deployment.getBeans().get(1); assertEquals("SimpleBean2", bean.getName()); assertEquals("org.jboss.test.kernel.xml.support.SimpleBeanImpl", bean.getBean()); } /* public void testDemandSupply() throws Exception { AbstractKernelDeployment deployment = unmarshal(); assertNotNull(deployment); assertNotNull(deployment.getBeans()); assertEquals(3, deployment.getBeans().size()); AbstractBeanMetaData bean = (AbstractBeanMetaData)deployment.getBeans().get(0); assertEquals("SimpleBean1", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getDemands()); assertEquals(2, bean.getDemands().size()); for(Iterator i = bean.getDemands().iterator(); i.hasNext();) { Object object = i.next(); assertTrue(object instanceof AbstractDemandMetaData); AbstractDemandMetaData demand = (AbstractDemandMetaData) object; Object value = demand.getDemand(); if(!"SimpleBean2".equals(value) && !"XYZZY".equals(value)) { fail("expected SimpleBean2 or XYZZY but got " + value); } } bean = (AbstractBeanMetaData)deployment.getBeans().get(1); assertEquals("SimpleBean2", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); bean = (AbstractBeanMetaData)deployment.getBeans().get(2); assertEquals("SimpleBean3", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getSupplies()); assertEquals(1, bean.getSupplies().size()); AbstractSupplyMetaData supply = (AbstractSupplyMetaData)bean.getSupplies().iterator().next(); assertEquals("XYZZY", supply.getSupply()); } public void testDemandSupplyWhenRequired() throws Exception { AbstractKernelDeployment deployment = unmarshal(); assertNotNull(deployment); assertNotNull(deployment.getBeans()); assertEquals(2, deployment.getBeans().size()); AbstractBeanMetaData bean = (AbstractBeanMetaData)deployment.getBeans().get(0); assertEquals("SimpleBean1", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getDemands()); assertEquals(1, bean.getDemands().size()); Object object = bean.getDemands().iterator().next(); assertTrue(object instanceof AbstractDemandMetaData); AbstractDemandMetaData demand = (AbstractDemandMetaData) object; assertEquals("SimpleBean2", demand.getDemand()); bean = (AbstractBeanMetaData)deployment.getBeans().get(1); assertEquals("SimpleBean2", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getConstructor()); ConstructorMetaData ctor = bean.getConstructor(); assertNotNull(ctor.getParameters()); assertEquals(1, ctor.getParameters().size()); AbstractParameterMetaData param = (AbstractParameterMetaData)ctor.getParameters().get(0); assertEquals("java.lang.String", param.getType()); assertEquals("whenRequired", param.getValue().getUnderlyingValue()); } */ public void testFactoryDependency() throws Exception { AbstractKernelDeployment deployment = unmarshal(); assertNotNull(deployment); assertNotNull(deployment.getBeans()); assertEquals(3, deployment.getBeans().size()); AbstractBeanMetaData bean = deployment.getBeans().get(0); assertEquals("SimpleBean1", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getConstructor()); ConstructorMetaData ctor = bean.getConstructor(); assertEquals("createSimpleBean", ctor.getFactoryMethod()); assertNotNull(ctor.getFactory()); assertEquals("SimpleBeanFactory", ctor.getFactory().getUnderlyingValue()); assertNotNull(ctor.getParameters()); assertEquals(1, ctor.getParameters().size()); AbstractParameterMetaData param = ctor.getParameters().get(0); assertEquals("org.jboss.test.xml.pojoserver.SimpleBean", param.getType()); assertTrue(param.getValue() instanceof AbstractDependencyValueMetaData); AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)param.getValue(); assertEquals("SimpleBean2", dependency.getValue()); bean = deployment.getBeans().get(1); assertEquals("SimpleBean2", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); bean = deployment.getBeans().get(2); assertEquals("SimpleBeanFactory", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanFactory", bean.getBean()); } /* public void testSimpleCollection() throws Exception { AbstractKernelDeployment deployment = unmarshal(); assertNotNull(deployment); assertNotNull(deployment.getBeans()); assertEquals(1, deployment.getBeans().size()); AbstractBeanMetaData bean = (AbstractBeanMetaData)deployment.getBeans().get(0); assertEquals("SimpleBean1", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getProperties()); assertEquals(4, bean.getProperties().size()); for(Iterator i = bean.getProperties().iterator(); i.hasNext();) { AbstractPropertyMetaData prop = (AbstractPropertyMetaData)i.next(); String name = prop.getName(); if("aList".equals(name)) { AbstractListMetaData list = (AbstractListMetaData) prop.getValue(); assertNotNull(list); assertEquals(2, list.size()); assertEquals("value0", ((StringValueMetaData) list.get(0)).getValue()); assertEquals("value1", ((StringValueMetaData) list.get(1)).getValue()); } else if("aSet".equals(name)) { AbstractSetMetaData set = (AbstractSetMetaData) prop.getValue(); assertNotNull(set); assertEquals(2, set.size()); boolean found0 = false; boolean found1 = false; for (Iterator j = set.iterator(); j.hasNext();) { StringValueMetaData value = (StringValueMetaData) j.next(); assertNull(value.getType()); String stringValue = (String) value.getValue(); if ("value0".equals(stringValue)) found0 = true; else if ("value1".equals(stringValue)) found1 = true; else fail("Unexpected value " + stringValue); } assertTrue(found0); assertTrue(found1); } else if("aMap".equals(name)) { AbstractMapMetaData map = (AbstractMapMetaData) prop.getValue(); assertNotNull(map); assertEquals("testMapClass", map.getType()); assertEquals("testKeyClass", map.getKeyType()); assertEquals("testValueClass", map.getValueType()); assertEquals(2, map.size()); for (Iterator j = map.entrySet().iterator(); j.hasNext();) { Map.Entry entry = (Map.Entry) j.next(); Object key = entry.getKey(); assertTrue(key.getClass().getName(), key instanceof StringValueMetaData); StringValueMetaData keyValue = (StringValueMetaData) key; assertNull(keyValue.getType()); String realKey = (String) keyValue.getValue(); if ("nullKey".equals(realKey)) { Object value = entry.getValue(); assertTrue(value instanceof AbstractValueMetaData); AbstractValueMetaData valueValue = (AbstractValueMetaData) value; assertNull(valueValue.getValue()); } else if ("other".equals(realKey)) { Object value = entry.getValue(); assertTrue(value instanceof AbstractDependencyValueMetaData); AbstractDependencyValueMetaData valueValue = (AbstractDependencyValueMetaData) value; assertEquals("SimpleBean2", valueValue.getValue()); assertEquals(ControllerState.INSTALLED, valueValue.getDependentState()); } else fail("Unexpected key " + realKey); } } else if("props".equals(name)) { AbstractMapMetaData map = (AbstractMapMetaData) prop.getValue(); assertNotNull(map); assertEquals("java.util.Properties", map.getType()); assertEquals("java.lang.String", map.getKeyType()); assertEquals("java.lang.String", map.getValueType()); assertEquals(2, map.size()); for (Iterator j = map.entrySet().iterator(); j.hasNext();) { Map.Entry entry = (Map.Entry) j.next(); Object key = entry.getKey(); assertTrue(key.getClass().getName(), key instanceof StringValueMetaData); StringValueMetaData keyValue = (StringValueMetaData) key; assertNull(keyValue.getType()); String realKey = (String) keyValue.getValue(); String expectedValue = null; if ("prop0".equals(realKey)) expectedValue = "value0"; else if ("prop1".equals(realKey)) expectedValue = "value1"; else fail("Unexpected key " + realKey); Object value = entry.getValue(); assertTrue(value instanceof StringValueMetaData); StringValueMetaData valueValue = (StringValueMetaData) value; assertNull(valueValue.getType()); String realValue = (String) valueValue.getValue(); assertEquals(expectedValue, realValue); } } else { fail("Unexpected property: expected aList, aSet, collection or props but got " + name); } } } */ public void testStaticFactoryDependency() throws Exception { AbstractKernelDeployment deployment = unmarshal(); assertNotNull(deployment); assertNotNull(deployment.getBeans()); assertEquals(2, deployment.getBeans().size()); AbstractBeanMetaData bean = deployment.getBeans().get(0); assertEquals("SimpleBean1", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); assertNotNull(bean.getConstructor()); ConstructorMetaData ctor = bean.getConstructor(); assertEquals("org.jboss.test.kernel.xml.support.SimpleBeanFactory", ctor.getFactoryClass()); assertEquals("staticCreateSimpleBean", ctor.getFactoryMethod()); assertNotNull(ctor.getParameters()); assertEquals(1, ctor.getParameters().size()); AbstractParameterMetaData param = ctor.getParameters().get(0); assertNotNull(param); assertEquals("org.jboss.test.kernel.xml.support.SimpleBean", param.getType()); assertNotNull(param.getValue()); assertTrue(param.getValue() instanceof AbstractDependencyValueMetaData); AbstractDependencyValueMetaData dependency = (AbstractDependencyValueMetaData)param.getValue(); assertEquals("SimpleBean2", dependency.getValue()); bean = deployment.getBeans().get(1); assertEquals("SimpleBean2", bean.getName()); assertEquals("org.jboss.test.xml.pojoserver.SimpleBeanImpl", bean.getBean()); } /** TODO protected static void assertSchemaBinding(SchemaBinding doc) { // types assertNotNull(doc.getType(classNameTypeQName)); assertNotNull(doc.getType(kernelControllerStateTypeQName)); TypeBinding deploymentType = doc.getType(deploymentTypeQName); assertNotNull(deploymentType); assertHasElement(deploymentType, beanQName, beanTypeQName); TypeBinding valueType = doc.getType(valueTypeQName); assertNotNull(valueType); assertHasElement(valueType, beanQName, beanTypeQName); assertValueGroupBinding(valueType); TypeBinding mixedValueType = doc.getType(mixedValueTypeQName); assertNotNull(mixedValueType); assertHasElement(mixedValueType, beanQName, beanTypeQName); assertValueGroupBinding(mixedValueType); TypeBinding namedValueType = doc.getType(namedValueTypeQName); assertNotNull(namedValueType); assertHasElement(namedValueType, beanQName, beanTypeQName); assertHasElement(namedValueType, annotationQName, annotationTypeQName); assertHasAttribute(namedValueType, nameAttrQName, Constants.QNAME_STRING); assertValueGroupBinding(namedValueType); TypeBinding valueWithClassType = doc.getType(valueWithClassTypeQName); assertNotNull(valueWithClassType); assertHasElement(valueWithClassType, beanQName, beanTypeQName); assertHasAttribute(valueWithClassType, classAttrQName, classNameTypeQName); assertValueGroupBinding(valueWithClassType); TypeBinding listType = doc.getType(listTypeQName); assertNotNull(listType); assertHasElement(listType, valueQName, mixedValueTypeQName); assertHasAttribute(listType, classAttrQName, classNameTypeQName); TypeBinding mapType = doc.getType(mapTypeQName); assertNotNull(mapType); assertHasElement(mapType, mapEntryQName, namedValueTypeQName); assertHasAttribute(mapType, classAttrQName, classNameTypeQName); TypeBinding propsType = doc.getType(propsTypeQName); assertNotNull(propsType); assertHasElement(propsType, propsEntryQName, null); TypeBinding propsEntryType = propsType.getElement(propsEntryQName).getType(); assertHasAttribute(propsEntryType, nameAttrQName, Constants.QNAME_STRING); TypeBinding constructorType = doc.getType(constructorTypeQName); assertNotNull(constructorType); assertHasElement(constructorType, annotationQName, annotationTypeQName); assertHasElement(constructorType, factoryQName, factoryTypeQName); assertHasElement(constructorType, parameterQName, valueWithClassTypeQName); assertHasAttribute(constructorType, factoryClassAttrQName, classNameTypeQName); assertHasAttribute(constructorType, factoryMethodAttrQName, Constants.QNAME_TOKEN); TypeBinding factoryType = doc.getType(factoryTypeQName); assertNotNull(factoryType); assertHasAttribute(factoryType, beanAttrQName, Constants.QNAME_STRING); TypeBinding demandType = doc.getType(demandTypeQName); assertNotNull(demandType); assertHasAttribute(demandType, whenRequiredAttrQName, kernelControllerStateTypeQName); TypeBinding beanType = doc.getType(beanTypeQName); assertNotNull(beanType); assertHasElement(beanType, annotationQName, annotationTypeQName); assertHasElement(beanType, constructorQName, constructorTypeQName); assertHasElement(beanType, propertyQName, namedValueTypeQName); assertHasElement(beanType, demandQName, demandTypeQName); assertHasElement(beanType, supplyQName, Constants.QNAME_STRING); assertHasAttribute(beanType, nameAttrQName, Constants.QNAME_STRING); assertHasAttribute(beanType, classAttrQName, Constants.QNAME_TOKEN); TypeBinding annotationType = doc.getType(annotationTypeQName); assertNotNull(annotationType); assertHasElement(annotationType, attributeQName, annotationAttributeTypeQName); assertHasAttribute(annotationType, nameAttrQName, Constants.QNAME_STRING); TypeBinding annotAttrType = doc.getType(annotationAttributeTypeQName); assertNotNull(annotAttrType); assertHasAttribute(annotAttrType, nameAttrQName, Constants.QNAME_STRING); assertHasAttribute(annotAttrType, valueAttrQName, Constants.QNAME_STRING); // elements ElementBinding deployment = doc.getElement(deploymentQName); assertNotNull(deployment); assertNotNull(deployment.getType()); assertEquals(deploymentTypeQName, deployment.getType().getQName()); } private static void assertHasElement(TypeBinding type, QName elementQName, QName typeQName) { ElementBinding element = type.getElement(elementQName); assertNotNull(element); assertNotNull(element.getType()); assertEquals(typeQName, element.getType().getQName()); } private static void assertHasAttribute(TypeBinding type, QName attrQName, QName typeQName) { AttributeBinding attr = type.getAttribute(attrQName); assertNotNull(attr); assertNotNull(attr.getType()); assertEquals(typeQName, attr.getType().getQName()); } private static void assertValueGroupBinding(TypeBinding valueType) { assertNotNull(valueType.getElement(listQName)); assertNotNull(valueType.getElement(setQName)); assertNotNull(valueType.getElement(mapQName)); assertNotNull(valueType.getElement(propsQName)); assertNotNull(valueType.getElement(nullQName)); ElementBinding dependency = valueType.getElement(dependencyQName); assertNotNull(dependency); TypeBinding dependencyType = dependency.getType(); assertNotNull(dependencyType); assertHasAttribute(dependencyType, valueAttrQName, Constants.QNAME_STRING); assertHasAttribute(dependencyType, stateAttrQName, kernelControllerStateTypeQName); assertNotNull(valueType.getElement(parameterQName)); assertNotNull(valueType.getElement(propertyQName)); } */ private void assertConfigureProperty(String name, Object value) { if("aString".equals(name)) { assertEquals("StringValue", value); } else if("aByte".equals(name)) { assertEquals("12", value); } else if("aBoolean".equals(name)) { assertEquals("true", value); } else if("aShort".equals(name)) { assertEquals("123", value); } else if("anInt".equals(name)) { assertEquals("1234", value); } else if("aLong".equals(name)) { assertEquals("12345", value); } else if("aFloat".equals(name)) { assertEquals("3.14", value); } else if("aDouble".equals(name)) { assertEquals("3.14e12", value); } else if("aDate".equals(name)) { assertEquals("12/12/12", value); } else if("aBigDecimal".equals(name)) { assertEquals("12e4", value); } else if("aBigInteger".equals(name)) { assertEquals("123456", value); } else if("abyte".equals(name)) { assertEquals("12", value); } else if("aboolean".equals(name)) { assertEquals("true", value); } else if("ashort".equals(name)) { assertEquals("123", value); } else if("anint".equals(name)) { assertEquals("1234", value); } else if("along".equals(name)) { assertEquals("12345", value); } else if("afloat".equals(name)) { assertEquals("3.14", value); } else if("adouble".equals(name)) { assertEquals("3.14e12", value); } else { fail("Unexpected property: " + name + "=" + value); } } private AbstractKernelDeployment unmarshal() throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); return (AbstractKernelDeployment)unmarshaller.unmarshal(getXmlUrl("xml/pojoserver/" + getName() + ".xml"), schemaBinding ); } protected abstract SchemaBinding getSchemaBinding(); protected abstract String getXsd(); protected SchemaBinding readXsd() { return XsdBinder.bind(getXmlUrl(getXsd())); } private static String getXmlUrl(String name) { URL xmlUrl = Thread.currentThread().getContextClassLoader().getResource(name); if(xmlUrl == null) { throw new IllegalStateException(name + " not found"); } return xmlUrl.getFile(); } private static class NullValueElementInterceptor extends DefaultElementInterceptor { public void add(Object parent, Object child, QName name) { if (parent instanceof AbstractCollectionMetaData) { AbstractCollectionMetaData collection = (AbstractCollectionMetaData) parent; collection.add(new AbstractValueMetaData()); } else if (parent instanceof AbstractParameterMetaData) { AbstractParameterMetaData valueMetaData = (AbstractParameterMetaData) parent; valueMetaData.setValue(new AbstractValueMetaData()); } else if (parent instanceof AbstractPropertyMetaData) { AbstractPropertyMetaData valueMetaData = (AbstractPropertyMetaData) parent; valueMetaData.setValue(new AbstractValueMetaData()); } else { AbstractValueMetaData valueMetaData = (AbstractValueMetaData) parent; valueMetaData.setValue(new AbstractValueMetaData()); } } } private static class ValueMetaDataElementInterceptor extends DefaultElementInterceptor { public void add(Object parent, Object child, QName name) { if (parent instanceof AbstractCollectionMetaData) { AbstractCollectionMetaData collection = (AbstractCollectionMetaData) parent; ValueMetaData value = (ValueMetaData) child; collection.add(value); } else if (parent instanceof AbstractParameterMetaData) { AbstractParameterMetaData valueMetaData = (AbstractParameterMetaData) parent; ValueMetaData value = (ValueMetaData) child; valueMetaData.setValue(value); } else if (parent instanceof AbstractPropertyMetaData) { AbstractPropertyMetaData valueMetaData = (AbstractPropertyMetaData) parent; ValueMetaData value = (ValueMetaData) child; valueMetaData.setValue(value); } else { AbstractValueMetaData valueMetaData = (AbstractValueMetaData) parent; ValueMetaData value = (ValueMetaData) child; valueMetaData.setValue(value); } } } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/WarnOnParserErrorsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/WarnOnParserErrorsUnitTestC0000644000175000017500000001221511477442270033325 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.IOException; import java.io.StringReader; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** * @author Alexey Loubyansky * @version $Revision: 45337 $ */ public class WarnOnParserErrorsUnitTestCase extends AbstractJBossXBTest { private static final String XSD = "" + "" + " " + " " + " " + " " + " " + " " + "" + ""; private static final String XML = "" + "2" + "1" + ""; public WarnOnParserErrorsUnitTestCase(String name) { super(name); } private boolean useUnorderedSequence; public void setUp() throws Exception { super.setUp(); useUnorderedSequence = JBossXBBuilder.isUseUnorderedSequence(); JBossXBBuilder.setUseUnorderedSequence(true); } public void tearDown() throws Exception { super.tearDown(); JBossXBBuilder.setUseUnorderedSequence(useUnorderedSequence); } public void testWarn() throws Exception { SchemaBinding schema = JBossXBBuilder.build(E.class, true); EntityResolver resolver = new EntityResolver(){ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { return new InputSource(new StringReader(XSD)); }}; UnmarshallerFactory factory = UnmarshallerFactory.newInstance(); Unmarshaller unmarshaller = factory.newUnmarshaller(); unmarshaller.setSchemaValidation(true); unmarshaller.setEntityResolver(resolver); unmarshaller.setWarnOnParserErrors(true); Object o = unmarshaller.unmarshal(new StringReader(XML), schema); assertNotNull(o); assertTrue(o instanceof E); E e = (E)o; assertEquals("1", e.getValue1()); assertEquals("2", e.getValue2()); } public void testError() throws Exception { SchemaBinding schema = JBossXBBuilder.build(E.class, true); EntityResolver resolver = new EntityResolver(){ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { return new InputSource(new StringReader(XSD)); }}; UnmarshallerFactory factory = UnmarshallerFactory.newInstance(); Unmarshaller unmarshaller = factory.newUnmarshaller(); unmarshaller.setSchemaValidation(true); unmarshaller.setEntityResolver(resolver); unmarshaller.setWarnOnParserErrors(false); try { unmarshaller.unmarshal(new StringReader(XML), schema); fail("validation should have failed"); } catch(JBossXBException e) { } } // Inner @XmlRootElement(name="e") public static final class E { private String value1; private String value2; public String getValue1() { return value1; } public void setValue1(String value) { this.value1 = value; } public String getValue2() { return value2; } public void setValue2(String value) { this.value2 = value; } } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AnyComplexTypeUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AnyComplexTypeUnitTestCase.0000644000175000017500000004102510535763506033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import junit.framework.TestSuite; import org.jboss.util.Strings; import org.jboss.util.xml.DOMWriter; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor; import org.jboss.xb.binding.sunday.unmarshalling.DefaultHandlers; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.xml.sax.Attributes; /** * AnyComplexTypeUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class AnyComplexTypeUnitTestCase extends AbstractJBossXBTest { private static final String NS = "http://www.jboss.org/test/xml/anyComplexType"; public static final TestSuite suite() { return new TestSuite(AnyComplexTypeUnitTestCase.class); } public AnyComplexTypeUnitTestCase(String name) { super(name); } public void testDOMFromWildcard() throws Exception { SchemaBinding schema = bind("AnyComplexType.xsd"); schema.setIgnoreUnresolvedFieldOrClass(false); ClassMetaData classMetaData = new ClassMetaData(); classMetaData.setImpl(Top.class.getName()); ElementBinding element = schema.getElement(new QName(NS, "top")); assertNotNull(element); element.setClassMetaData(classMetaData); DOMUnresolvedHandler unresolved = new DOMUnresolvedHandler(); TypeBinding type = schema.getType(new QName(NS, "any-complexType")); type.setStartElementCreatesObject(false); WildcardBinding wild = type.getWildcard(); assertNotNull(wild); wild.setUnresolvedElementHandler(unresolved); wild.setUnresolvedCharactersHandler(unresolved); Top top = (Top) unmarshal("AnyComplexTypeFromWildCard.xml", schema, Top.class); Element dom = top.element; assertNotNull(dom); getLog().debug(DOMWriter.printNode(dom, true)); assertElement("e1", dom); Element e1s1 = getUniqueChild(dom, "e1s1"); assertElement("e1s1", e1s1); Element e1s1s1 = getUniqueChild(e1s1, "e1s1s1"); assertElement("e1s1s1", e1s1s1); Element e1s1s2 = getUniqueChild(e1s1, "e1s1s2"); assertElement("e1s1s2", e1s1s2); Element e1s2 = getUniqueChild(dom, "e1s2"); assertElement("e1s2", e1s2); } public void testDOMFromWildcardAndElement() throws Exception { SchemaBinding schema = bind("AnyComplexType.xsd"); schema.setIgnoreUnresolvedFieldOrClass(false); ClassMetaData classMetaData = new ClassMetaData(); classMetaData.setImpl(Top.class.getName()); ElementBinding element = schema.getElement(new QName(NS, "top")); assertNotNull(element); element.setClassMetaData(classMetaData); DOMUnresolvedHandler unresolved = new DOMUnresolvedHandler(); TypeBinding type = schema.getType(new QName(NS, "any-complexType")); type.setStartElementCreatesObject(false); WildcardBinding wild = type.getWildcard(); assertNotNull(wild); wild.setUnresolvedElementHandler(unresolved); wild.setUnresolvedCharactersHandler(unresolved); DOMInterceptor interceptor = new DOMInterceptor(); element = schema.getElement(new QName(NS, "element")); element.pushInterceptor(interceptor); Top top = (Top) unmarshal("AnyComplexTypeFromWildCardAndElement.xml", schema, Top.class); Element dom = top.element; assertNotNull(dom); getLog().debug(DOMWriter.printNode(dom, true)); assertElement("element", dom, true); // TODO FIXME Element e1 = getUniqueChild(dom, "e1"); assertElement("e1", e1); Element e1s1 = getUniqueChild(e1, "e1s1"); assertElement("e1s1", e1s1); Element e1s1s1 = getUniqueChild(e1s1, "e1s1s1"); assertElement("e1s1s1", e1s1s1); Element e1s1s2 = getUniqueChild(e1s1, "e1s1s2"); assertElement("e1s1s2", e1s1s2); Element e1s2 = getUniqueChild(e1, "e1s2"); assertElement("e1s2", e1s2); } public void testDOMFromMultipleWildcardAndElement() throws Exception { SchemaBinding schema = bind("AnyComplexType.xsd"); schema.setIgnoreUnresolvedFieldOrClass(false); ClassMetaData classMetaData = new ClassMetaData(); classMetaData.setImpl(Top.class.getName()); ElementBinding element = schema.getElement(new QName(NS, "top")); assertNotNull(element); element.setClassMetaData(classMetaData); DOMUnresolvedHandler unresolved = new DOMUnresolvedHandler(); TypeBinding type = schema.getType(new QName(NS, "any-complexType")); //type.setStartElementCreatesObject(false); type.setHandler(new DOMUnresolvedHandler() { public void setParent(Object parent, Object o, QName qName, ParticleBinding particle, ParticleBinding parentParticle) { DefaultHandlers.ELEMENT_HANDLER.setParent(parent, o, qName, particle, parentParticle); } } ); WildcardBinding wild = type.getWildcard(); assertNotNull(wild); wild.setUnresolvedElementHandler(unresolved); wild.setUnresolvedCharactersHandler(unresolved); //DOMInterceptor interceptor = new DOMInterceptor(); //element = schema.getElement(new QName(NS, "element")); //element.pushInterceptor(interceptor); Top top = (Top) unmarshal("AnyComplexTypeFromMultipleWildCardAndElement.xml", schema, Top.class); Element dom = top.element; assertNotNull(dom); getLog().debug(DOMWriter.printNode(dom, true)); assertElement("element", dom, true); // TODO FIXME Element e1 = getUniqueChild(dom, "e1"); assertElement("e1", e1); Element e1s1 = getUniqueChild(e1, "e1s1"); assertElement("e1s1", e1s1); Element e1s1s1 = getUniqueChild(e1s1, "e1s1s1"); assertElement("e1s1s1", e1s1s1); Element e1s1s2 = getUniqueChild(e1s1, "e1s1s2"); assertElement("e1s1s2", e1s1s2); Element e1s2 = getUniqueChild(e1, "e1s2"); assertElement("e1s2", e1s2); Element e2 = getUniqueChild(dom, "e2"); assertElement("e2", e2); } protected void assertElement(String elementName, Element element) { assertElement(elementName, element, false); } protected void assertElement(String elementName, Element element, boolean ignoreChars) { assertNotNull(element); assertEquals(elementName, element.getLocalName()); assertEquals(elementName + "a1", element.getAttribute(elementName + "a1")); assertEquals(elementName + "a2", element.getAttribute(elementName + "a2")); if (ignoreChars == false) assertEquals(elementName + "c1", getElementContent(element)); } protected static String getElementContent(Element element) { if (element == null) return null; NodeList children = element.getChildNodes(); StringBuffer result = new StringBuffer(); for (int i = 0; i < children.getLength(); ++i) { Node child = children.item(i); if (child.getNodeType() == Node.TEXT_NODE || child.getNodeType() == Node.CDATA_SECTION_NODE) result.append(child.getNodeValue()); } return result.toString().trim(); } protected static Element getUniqueChild(Element element, String childName) { if (element == null) return null; NodeList children = element.getChildNodes(); Element result = null; for (int i = 0; i < children.getLength(); ++i) { Node child = children.item(i); if (child.getNodeType() == Node.ELEMENT_NODE && childName.equals(child.getNodeName())) { if (result != null) fail(childName + " not unique"); result = (Element) child; } } if (result == null) fail("No " + childName); return result; } public Element createTopElement(String namespace, String name) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); DOMImplementation impl = builder.getDOMImplementation(); Document document = impl.createDocument(null, null, null); Element element = document.createElementNS(namespace, name); document.appendChild(element); getLog().debug("createTopElement " + namespace + ":" + name + " result=" + toDebugString(element)); return element; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException("Error creating dom", e); } } public Element appendChildElement(Element parentElement, String namespace, String name) { Document document = parentElement.getOwnerDocument(); Element element = document.createElementNS(namespace, name); parentElement.appendChild(element); getLog().debug("appendChild parent=" + toDebugString(parentElement) + " child=" + toDebugString(element)); return element; } public void addAttributes(Element element, Attributes attrs) { for (int i = 0; i < attrs.getLength(); ++i) { String local = attrs.getLocalName(i); String nsURI = attrs.getURI(i); String value = attrs.getValue(i); getLog().debug("setAttribute " + nsURI + " " + local + " element=" + toDebugString(element) + " value=" + value); element.setAttributeNS(nsURI, local, value); } } public void setText(Object owner, Object value, QName qName) { if (value == null) return; if (owner == null || owner instanceof Element == false) throw new IllegalStateException("Unexpected owner: " + owner + " for " + qName); if (value instanceof String == false) throw new IllegalStateException("Unexpected value " + value + " for " + qName); Element element = (Element) owner; Text text = element.getOwnerDocument().createTextNode((String) value); getLog().debug("setText " + qName + " parent=" + toDebugString(owner) + " child=" + toDebugString(value)); element.appendChild(text); } public class DOMUnresolvedHandler extends CharactersHandler implements ParticleHandler { public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { getLog().debug("startParticle " + elementName + " parent=" + toDebugString(parent)); Element element = null; if (parent == null || parent instanceof Element == false) element = createTopElement(elementName.getNamespaceURI(), elementName.getLocalPart()); else element = appendChildElement((Element) parent, elementName.getNamespaceURI(), elementName.getLocalPart()); addAttributes(element, attrs); return element; } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { getLog().debug("endParticle " + elementName + " result=" + toDebugString(o)); return o; } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { getLog().debug("setParent " + elementName + " parent=" + toDebugString(parent) + " o=" + toDebugString(o)); } public void setValue(QName qName, ElementBinding element, Object owner, Object value) { setText(owner, value, qName); } public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { return value; } public Object unmarshalEmpty(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData) { return null; } } public class DOMInterceptor extends DefaultElementInterceptor { public Object startElement(Object parent, QName qName, TypeBinding type) { getLog().debug("startElement " + qName + " parent=" + toDebugString(parent)); Element element = null; if (parent == null || parent instanceof Element == false) { element = createTopElement(qName.getNamespaceURI(), qName.getLocalPart()); ((Top) parent).element = element; } else element = appendChildElement((Element) parent, qName.getNamespaceURI(), qName.getLocalPart()); return element; } public void attributes(Object o, QName elementName, TypeBinding type, Attributes attrs, NamespaceContext nsCtx) { getLog().debug("setAttributes " + elementName + " parent=" + toDebugString(o)); if (o == null || o instanceof Element == false) throw new IllegalStateException(Strings.defaultToString(o) + " is not an instanceof Element"); addAttributes((Element) o, attrs); } public void characters(Object o, QName qName, TypeBinding type, NamespaceContext nsCtx, String text) { if (o == null || o instanceof Element == false) throw new IllegalStateException(Strings.defaultToString(o) + " is not an instanceof Element"); setText(o, text, qName); } public void add(Object parent, Object child, QName qName) { getLog().debug("add " + qName + " parent=" + toDebugString(parent) + " child=" + toDebugString(child)); if (parent == null || parent instanceof Element == false) throw new IllegalStateException(Strings.defaultToString(parent) + " is not an instanceof Element"); if (child == null || child instanceof Element == false) throw new IllegalStateException(Strings.defaultToString(child) + " is not an instanceof Element"); Element parentElement = (Element) parent; Element childElement = (Element) child; parentElement.getOwnerDocument().adoptNode(childElement); parentElement.appendChild(childElement); } } public static class Top { public Element element; } public static String toDebugString(Object object) { if (object == null) return "null"; if (object instanceof String) return object.toString(); if (object instanceof Element == false) return Strings.defaultToString(object); Element element = (Element) object; return "Element@" + System.identityHashCode(element) + "{" + element.getLocalName() + "}"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/resolverwithqnamemapping/0000755000175000017500000000000011620316741033144 5ustar twernertwerner././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/resolverwithqnamemapping/test/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/resolverwithqnamemapping/te0000755000175000017500000000000011620316741033475 5ustar twernertwerner././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/resolverwithqnamemapping/test/ResolverWithQNameMappingTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/resolverwithqnamemapping/te0000644000175000017500000000537411453330564033513 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.resolverwithqnamemapping.test; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xml.resolverwithqnamemapping.support.NoNsRoot; import org.jboss.test.xml.resolverwithqnamemapping.support.Ns1Root; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.resolver.MutableSchemaResolverWithQNameMapping; /** * A ResolverWithQNameMappingTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ResolverWithQNameMappingTestCase extends AbstractBuilderTest { private MutableSchemaResolverWithQNameMapping resolver; public ResolverWithQNameMappingTestCase(String name) { super(name); } public void setUp() throws Exception { super.setUp(); resolver = new MultiClassSchemaResolver(); } public void tearDown() throws Exception { super.tearDown(); resolver = null; } public void testNs1Root() throws Exception { resolver.mapQNameToClasses(new QName("ns1", "root"), Ns1Root.class); Object o = unmarshal("ResolverWithQNameMapping_testNs1Root.xml", resolver); assertNotNull(o); assertTrue(o instanceof Ns1Root); Ns1Root root = (Ns1Root) o; assertEquals("ns1:root", root.getData()); } public void testNoNsRoot() throws Exception { resolver.mapQNameToClasses(new QName("root"), NoNsRoot.class); Object o = unmarshal("ResolverWithQNameMapping_testNoNsRoot.xml", resolver); assertNotNull(o); assertTrue(o instanceof NoNsRoot); NoNsRoot root = (NoNsRoot) o; assertEquals("nons:root", root.getData()); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/resolverwithqnamemapping/support/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/resolverwithqnamemapping/su0000755000175000017500000000000011620316742033515 5ustar twernertwerner././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/resolverwithqnamemapping/support/NoNsRoot.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/resolverwithqnamemapping/su0000644000175000017500000000246211453330564033525 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.resolverwithqnamemapping.support; import javax.xml.bind.annotation.XmlRootElement; /** * A DefaultNsRoot. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") public class NoNsRoot extends Base { } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/resolverwithqnamemapping/support/Ns1Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/resolverwithqnamemapping/su0000644000175000017500000000274111453330564033525 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.resolverwithqnamemapping.support; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlSchema; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root", namespace="ns1") @JBossXmlSchema(namespace="ns1", elementFormDefault=XmlNsForm.QUALIFIED) public class Ns1Root extends Base { } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/resolverwithqnamemapping/support/Base.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/resolverwithqnamemapping/su0000644000175000017500000000045611453330564033526 0ustar twernertwernerpackage org.jboss.test.xml.resolverwithqnamemapping.support; public class Base { private String data; public Base() { super(); } public String getData() { return data; } public void setData(String data) { this.data = data; } }././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/ChoiceMinOccurs0UnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/ChoiceMinOccurs0UnitTestCas0000644000175000017500000000714311151307541033162 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * @author Alexey Loubyansky * @version $Revision: 45337 $ */ public class ChoiceMinOccurs0UnitTestCase extends AbstractJBossXBTest { private static final String XSD = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; private static final String XML = "" + " value3" + ""; public ChoiceMinOccurs0UnitTestCase(String name) { super(name); } public void testMain() throws Exception { //enableTrace("org.jboss.xb.binding.sunday.unmarshalling.XsdBinder"); SchemaBinding schema = XsdBinder.bind(new StringReader(XSD), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML), schema); assertNotNull(o); assertTrue(o instanceof Top); Top top = (Top) o; assertNull(top.e1); assertNull(top.e2); assertEquals("value3", top.e3); } public static class Top { public String e1; public String e2; public String e3; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/LoginConfigUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/LoginConfigUnitTestCase.jav0000644000175000017500000000500411062060756033206 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.IOException; import java.io.InputStream; import java.net.URL; import org.jboss.test.xml.loginconfig.Users; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * A LoginConfigUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class LoginConfigUnitTestCase extends AbstractJBossXBTest { public LoginConfigUnitTestCase(String name) { super(name); } public void testLoginConfig() throws Exception { InputStream xsdIs = openStream("xml/loginconfig/user-roles_1_0.xsd"); InputStream xmlIs = openStream("xml/loginconfig/user-roles.xml"); SchemaBinding schema = XsdBinder.bind(xsdIs, null); schema.setStrictSchema(true); schema.setIgnoreUnresolvedFieldOrClass(false); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Users users = (Users) unmarshaller.unmarshal(xmlIs, schema); assertNotNull(users); assertEquals(6, users.size()); } private InputStream openStream(String path) throws IOException { java.net.URL url = Thread.currentThread().getContextClassLoader().getResource(path); if (url == null) fail("URL not found: " + path); return url.openStream(); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/PoUnitTestCase.java0000644000175000017500000000460610513427451031535 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.net.URL; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.test.xml.po.PurchaseOrder; import org.jboss.test.BaseTestCase; /** * @author Alexey Loubyansky * @version $Revision: 45813 $ */ public class PoUnitTestCase extends BaseTestCase { public PoUnitTestCase(String localName) { super(localName); } public void testMain() throws Exception { String xsdName = "xml/po.xsd"; URL xsd = getURL(xsdName); String xmlName = "xml/po.xml"; URL xml = getURL(xmlName); SchemaBinding schema = XsdBinder.bind(xsd.toExternalForm()); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); PurchaseOrder po = (PurchaseOrder)unmarshaller.unmarshal(xml.toExternalForm(), schema); assertEquals(PurchaseOrder.DEFAULT_INSTANCE, po); } private URL getURL(String name) { URL resource = Thread.currentThread().getContextClassLoader().getResource(name); if(resource == null) { fail("resource not found: " + name); } return resource; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AttributesUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AttributesUnitTestCase.java0000644000175000017500000002376011061473704033310 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.io.StringWriter; import java.util.Collection; import javax.xml.namespace.QName; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.DefaultHandlers; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.LSInputAdaptor; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.w3c.dom.ls.LSInput; /** * @author Alexey Loubyansky * @version $Revision: 45337 $ */ public class AttributesUnitTestCase extends AbstractJBossXBTest { private static final String NS_1 = "http://www.jboss.org/test/xml/attrs"; private static final String NS_2 = "http://www.jboss.org/test/xml/attrs2"; private static final String UNQUALIFIED_NAME = "unqualified"; private static final String MATE_NAME = "mate"; private static final String FOREIGNER_NAME = "foreigner"; private static final QName UNQUALIFIED_QNAME = new QName(UNQUALIFIED_NAME); private static final QName MATE_QNAME = new QName(NS_1, MATE_NAME); private static final QName FOREIGNER_QNAME = new QName(NS_2, FOREIGNER_NAME); private static final String XSD = "" + "" + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "" + ""; private static final String XSD_2 = "" + " " + ""; private static final SchemaBindingResolver SCHEMA_RESOLVER = new SchemaBindingResolver() { public String getBaseURI() { throw new UnsupportedOperationException("getBaseURI is not implemented."); } public void setBaseURI(String baseURI) { throw new UnsupportedOperationException("setBaseURI is not implemented."); } public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation) { throw new UnsupportedOperationException("resolve is not implemented."); } public LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation) { return new LSInputAdaptor(new StringReader(XSD_2), null); } }; private static SchemaBinding SCHEMA; private static final String XML = ""; public AttributesUnitTestCase(String name) { super(name); } protected void configureLogging() { if(SCHEMA == null) { SCHEMA = XsdBinder.bind(new StringReader(XSD), null, SCHEMA_RESOLVER); SCHEMA.setIgnoreUnresolvedFieldOrClass(false); } } public void testAttributesInSchema() { ElementBinding eBinding = SCHEMA.getElement(new QName(NS_1, "e")); TypeBinding eType = eBinding.getType(); Collection attributes = eType.getAttributes(); assertNotNull(attributes); assertEquals(3, attributes.size()); assertNotNull(eType.getAttribute(UNQUALIFIED_QNAME)); assertNotNull(eType.getAttribute(MATE_QNAME)); assertNotNull(eType.getAttribute(FOREIGNER_QNAME)); } public void testUnmarshalling() throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML), SCHEMA); assertTrue(o instanceof E); assertEquals(E.INSTANCE, o); } public void testMarshallingXerces() throws Exception { XercesXsMarshaller marshaller = new XercesXsMarshaller(); //new MarshallerImpl(); marshaller.setSchemaResolver(SCHEMA_RESOLVER); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), E.INSTANCE, writer); assertXmlEqual(XML, writer.getBuffer().toString()); } public void testMarshallingSunday() throws Exception { MarshallerImpl marshaller = new MarshallerImpl(); StringWriter writer = new StringWriter(); marshaller.marshal(SCHEMA, null, E.INSTANCE, writer); assertXmlEqual(XML, writer.getBuffer().toString()); } /** * Attribute binding can't be created with a complex type not being * adapted to a simple type. * Note: that's still bizarre to allow a complex type for an attribute * from the xsd point of view. */ public void testAttributeComplexType() throws Exception { TypeBinding complexType = new TypeBinding(); complexType.setSimple(false); assertTrue(!complexType.isSimple()); SchemaBinding schema = new SchemaBinding(); try { new AttributeBinding(schema, new QName("name"), complexType, DefaultHandlers.ATTRIBUTE_HANDLER); fail("Attribute can't be of a complex type w/o a value adapter."); } catch(JBossXBRuntimeException e) { } complexType.setValueAdapter( new ValueAdapter() { public Object cast(Object o, Class c) { // TODO Auto-generated method stub return null; } } ); try { new AttributeBinding(schema, new QName("name"), complexType, DefaultHandlers.ATTRIBUTE_HANDLER); } catch(JBossXBRuntimeException e) { fail("Attribute can be of a complex type with value adapter."); } } // Inner public static final class E { public static final E INSTANCE; static { E e = new E(); e.unqualified = "u"; e.mate = "m"; e.foreigner = "f"; INSTANCE = e; } public String unqualified; public String mate; public String foreigner; public String toString() { return "[unqualified=" + unqualified + ", mate=" + mate + ", foreigner=" + foreigner + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof E)) { return false; } final E e = (E)o; if(foreigner != null ? !foreigner.equals(e.foreigner) : e.foreigner != null) { return false; } if(mate != null ? !mate.equals(e.mate) : e.mate != null) { return false; } if(unqualified != null ? !unqualified.equals(e.unqualified) : e.unqualified != null) { return false; } return true; } public int hashCode() { int result; result = (unqualified != null ? unqualified.hashCode() : 0); result = 29 * result + (mate != null ? mate.hashCode() : 0); result = 29 * result + (foreigner != null ? foreigner.hashCode() : 0); return result; } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/person/0000755000175000017500000000000011620316743027321 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/person/Address.java0000644000175000017500000000352510513427451031555 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.person; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Address { private String street; public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } public String toString() { return street; } public boolean equals(Object o) { if(this == o) return true; if(!(o instanceof Address)) return false; final Address address = (Address) o; if(street != null ? !street.equals(address.street) : address.street != null) return false; return true; } public int hashCode() { return (street != null ? street.hashCode() : 0); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/person/Person.java0000644000175000017500000001102511061473704031431 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.person; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.TypeBinding; import java.util.Collection; import java.util.ArrayList; import java.util.Arrays; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Person { public static Person newInstance() { Person person = new Person(); person.setFirstName("Vasiliy"); person.setLastName("Poupkin"); person.setDateOfBirth((java.util.Date)SimpleTypeBindings.JAVA_UTIL_DATE.unmarshal("1980-01-01")); person.setPhones(Arrays.asList(new Object[]{"01", "02"})); ArrayList
list = new ArrayList
(); Address addr1 = new Address(); addr1.setStreet("prosp. Rad. Ukr. 11A, 70"); list.add(addr1); addr1 = new Address(); addr1.setStreet("Sky 7"); list.add(addr1); person.setAddresses(list); return person; } private String firstName; private String lastName; private java.util.Date dateOfBirth; private Collection phones = new ArrayList(); private Collection
addresses = new ArrayList
(); public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public java.util.Date getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(java.util.Date dateOfBirth) { this.dateOfBirth = dateOfBirth; } public Collection getPhones() { return phones; } public void setPhones(Collection phones) { this.phones = phones; } public Collection
getAddresses() { return addresses; } public void setAddresses(Collection
addresses) { this.addresses = addresses; } public boolean equals(Object o) { if(this == o) return true; if(!(o instanceof Person)) return false; final Person person = (Person) o; if(addresses != null ? !addresses.equals(person.addresses) : person.addresses != null) return false; if(dateOfBirth != null ? !dateOfBirth.equals(person.dateOfBirth) : person.dateOfBirth != null) return false; if(firstName != null ? !firstName.equals(person.firstName) : person.firstName != null) return false; if(lastName != null ? !lastName.equals(person.lastName) : person.lastName != null) return false; if(phones != null ? !phones.equals(person.phones) : person.phones != null) return false; return true; } public int hashCode() { int result; result = (firstName != null ? firstName.hashCode() : 0); result = 29 * result + (lastName != null ? lastName.hashCode() : 0); result = 29 * result + (dateOfBirth != null ? dateOfBirth.hashCode() : 0); result = 29 * result + (phones != null ? phones.hashCode() : 0); result = 29 * result + (addresses != null ? addresses.hashCode() : 0); return result; } public String toString() { return "[firstName=" + firstName + ", lastName=" + lastName + ", dateOfBirth=" + dateOfBirth + ", phones=" + phones + ", addresses=" + addresses + "]"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/any/0000755000175000017500000000000011620316741026600 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/any/Container.java0000644000175000017500000000461510513427451031374 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.any; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Container { private String id; private Object anyContent; public String getId() { return id; } public void setId(String id) { this.id = id; } public Object getAnyContent() { return anyContent; } public void setAnyContent(Object anyContent) { this.anyContent = anyContent; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Container)) { return false; } final Container container = (Container)o; if(anyContent != null ? !anyContent.equals(container.anyContent) : container.anyContent != null) { return false; } if(id != null ? !id.equals(container.id) : container.id != null) { return false; } return true; } public int hashCode() { int result; result = (id != null ? id.hashCode() : 0); result = 29 * result + (anyContent != null ? anyContent.hashCode() : 0); return result; } public String toString() { return "[container id=" + id + ", anyContent=" + anyContent + "]"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/XercesBugTestCase.java0000644000175000017500000001537511154172516032214 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.net.URL; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSImplementation; import org.apache.xerces.xs.XSLoader; import org.apache.xerces.xs.XSModel; import org.apache.xerces.xs.XSNamedMap; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSTypeDefinition; import org.apache.xerces.xs.XSModelGroup; import org.jboss.test.BaseTestCase; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.Util; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinderTerminatingErrorHandler; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.bootstrap.DOMImplementationRegistry; import org.w3c.dom.ls.LSInput; import org.w3c.dom.ls.LSResourceResolver; /** * @author Adrian Brock * @version $Revision: 41616 $ */ public class XercesBugTestCase extends BaseTestCase { public XercesBugTestCase(String localName) { super(localName); } public void testXerces280Bug() { String xsd = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; XSModel model = Util.loadSchema(xsd, (String)null); XSComplexTypeDefinition type = (XSComplexTypeDefinition)model.getTypeDefinition("valueType", ""); XSModelGroup modelGroup = (XSModelGroup)type.getParticle().getTerm(); assertNull(modelGroup.getAnnotation()); type = (XSComplexTypeDefinition)model.getTypeDefinition("annotatedValueType", ""); modelGroup = (XSModelGroup)type.getParticle().getTerm(); assertNull(modelGroup.getAnnotation()); } public void testXercesBug() { String name = "xml/xerces-bug.xsd"; URL xsdUrl = Thread.currentThread().getContextClassLoader().getResource(name); MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); resolver.setBaseURI(xsdUrl.toString()); XSImplementation impl = getXSImplementation(); XSLoader schemaLoader = impl.createXSLoader(null); setResourceResolver(schemaLoader, resolver); setDOMErrorHandler(schemaLoader); XSModel model = schemaLoader.loadURI(xsdUrl.toString()); XSNamedMap types = model.getComponents(XSConstants.TYPE_DEFINITION); for(int i = 0; i < types.getLength(); ++i) { XSTypeDefinition type = (XSTypeDefinition)types.item(i); if(!Constants.NS_XML_SCHEMA.equals(type.getNamespace())) { if (type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { XSComplexTypeDefinition typeDef = (XSComplexTypeDefinition) type; XSObjectList annotations = typeDef.getAnnotations(); assertEquals(1, annotations.getLength()); } } } } private static void setResourceResolver(XSLoader schemaLoader, final SchemaBindingResolver schemaResolver) { DOMConfiguration config = schemaLoader.getConfig(); config.setParameter("resource-resolver", new LSResourceResolver() { public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { if(Constants.NS_XML_SCHEMA.equals(type)) { return schemaResolver.resolveAsLSInput(namespaceURI, null, null); } return null; } } ); } private static void setDOMErrorHandler(XSLoader schemaLoader) { DOMConfiguration config = schemaLoader.getConfig(); config.setParameter("error-handler", XsdBinderTerminatingErrorHandler.newInstance()); } private static XSImplementation getXSImplementation() { // Get DOM Implementation using DOM Registry ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { // Try the 2.6.2 version String name = "org.apache.xerces.dom.DOMXSImplementationSourceImpl"; loader.loadClass(name); System.setProperty(DOMImplementationRegistry.PROPERTY, name); } catch(ClassNotFoundException e) { // Try the 2.7.0 version String name = "org.apache.xerces.dom.DOMXSImplementationSourceImpl"; System.setProperty(DOMImplementationRegistry.PROPERTY, name); } XSImplementation impl; try { DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); impl = (XSImplementation)registry.getDOMImplementation("XS-Loader"); } catch(Exception e) { throw new IllegalStateException("Failed to create schema loader: " + e.getMessage()); } return impl; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/BeforeMarshalAfterUnmarshalHandlerTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/BeforeMarshalAfterUnmarshal0000644000175000017500000004033011061473704033305 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.io.StringWriter; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.test.xml.BeforeMarshalAfterUnmarshalHandlerTestCase.GlobalElement.StringType; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.xb.binding.sunday.marshalling.MarshallingContext; import org.jboss.xb.binding.sunday.marshalling.TermBeforeMarshallingCallback; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBeforeSetParentCallback; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnmarshallingContext; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * @author Alexey Loubyansky * @version $Revision: 2096 $ */ public class BeforeMarshalAfterUnmarshalHandlerTestCase extends AbstractJBossXBTest { private static final String XSD = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; private static final String XML_STRING_TYPE = "" + " traumeel" + ""; private static final String XML_STRING_ELEMENT = "" + " traumeel" + ""; private static final String XML_SEQUENCE_ITEM = "" + " traumeel" + ""; private static SchemaBinding SCHEMA; public BeforeMarshalAfterUnmarshalHandlerTestCase(String name) { super(name); } public void testTermBeforeMarshallingHandler_stringType() throws Exception { SchemaBinding schema = getSchema(); MarshallerImpl marshaller = getMarshaller(); StringWriter writer = new StringWriter(); GlobalElement global = new GlobalElement(); global.stringType = GlobalElement.STRING_TYPE; marshaller.marshal(schema, null, global, writer); assertXmlEqual(XML_STRING_TYPE, writer.getBuffer().toString()); } public void testTermAfterUnmarshallingHandler_stringType() throws Exception { SchemaBinding schema = getSchema(); StringReader xmlReader = new StringReader(XML_STRING_TYPE); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(xmlReader, schema); assertNotNull(o); assertTrue(o instanceof GlobalElement); GlobalElement global = (GlobalElement) o; assertNotNull(global.stringType); assertEquals(GlobalElement.STRING_TYPE, global.stringType); } public void testTermBeforeMarshallingHandler_stringElement() throws Exception { SchemaBinding schema = getSchema(); MarshallerImpl marshaller = getMarshaller(); StringWriter writer = new StringWriter(); GlobalElement global = new GlobalElement(); global.stringElement = GlobalElement.TEXT; marshaller.marshal(schema, null, global, writer); assertXmlEqual(XML_STRING_ELEMENT, writer.getBuffer().toString()); } public void testTermAfterUnmarshallingHandler_stringElement() throws Exception { SchemaBinding schema = getSchema(); StringReader xmlReader = new StringReader(XML_STRING_ELEMENT); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(xmlReader, schema); assertNotNull(o); assertTrue(o instanceof GlobalElement); GlobalElement global = (GlobalElement) o; assertNotNull(global.stringElement); assertEquals(GlobalElement.TEXT, global.stringElement); } public void testTermBeforeMarshallingHandler_sequenceItem() throws Exception { SchemaBinding schema = getSchema(); MarshallerImpl marshaller = getMarshaller(); StringWriter writer = new StringWriter(); GlobalElement global = new GlobalElement(); global.sequenceItem = GlobalElement.STRING_TYPE; marshaller.marshal(schema, null, global, writer); assertXmlEqual(XML_SEQUENCE_ITEM, writer.getBuffer().toString()); } public void testTermAfterUnmarshallingHandler_sequenceItem() throws Exception { SchemaBinding schema = getSchema(); StringReader xmlReader = new StringReader(XML_SEQUENCE_ITEM); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(xmlReader, schema); assertNotNull(o); assertTrue(o instanceof GlobalElement); GlobalElement global = (GlobalElement) o; assertNotNull(global.sequenceItem); assertEquals(GlobalElement.STRING_TYPE, global.sequenceItem); } // private private MarshallerImpl getMarshaller() { MarshallerImpl marshaller = new MarshallerImpl(); //marshaller.addRootElement(new QName("http://jboss.org/ns/test", "global")); //marshaller.mapFieldToWildcard(GlobalElement.class, "anyObject", null); //marshaller.mapClassToGlobalElement(GlobalElement.Any.class, "intElement", "http://jboss.org/ns/test", null, null); return marshaller; } private static SchemaBinding getSchema() { if(SCHEMA == null) { SCHEMA = XsdBinder.bind(new StringReader(XSD), null); SCHEMA.setIgnoreUnresolvedFieldOrClass(false); TypeBinding stringType = SCHEMA.getType(Constants.QNAME_STRING); // stringType stringType.setBeforeMarshallingCallback(new TermBeforeMarshallingCallback() { public Object beforeMarshalling(Object o, MarshallingContext ctx) { if(o != null) { ParticleBinding particle = ctx.getParticleBinding(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertTrue(term.isElement()); ElementBinding element = (ElementBinding) term; String localPart = element.getQName().getLocalPart(); assertTrue("stringType".endsWith(localPart) || "item".equals(localPart)); TypeBinding type = element.getType(); assertEquals(Constants.QNAME_STRING, type.getQName()); o = ((GlobalElement.StringType)o).data; } return o; } }); stringType.setBeforeSetParentCallback(new TermBeforeSetParentCallback() { public Object beforeSetParent(Object o, UnmarshallingContext ctx) { ParticleBinding particle = ctx.getParticle(); assertNotNull(particle); assertTrue(particle.getTerm().isElement()); ElementBinding element = (ElementBinding) particle.getTerm(); String eName = element.getQName().getLocalPart(); if(eName.equals("stringType")) { assertTrue(ctx.getParentValue() instanceof GlobalElement); TermBinding parentTerm = ctx.getParentParticle().getTerm(); assertTrue(parentTerm.isElement()); assertEquals("global", ((ElementBinding)parentTerm).getQName().getLocalPart()); assertEquals("stringType", ctx.resolvePropertyName()); assertEquals(StringType.class, ctx.resolvePropertyType()); } else if(eName.equals("item")) { assertTrue(ctx.getParentValue() instanceof GlobalElement.Sequence); TermBinding parentTerm = ctx.getParentParticle().getTerm(); assertTrue(parentTerm instanceof SequenceBinding); assertEquals("item", ctx.resolvePropertyName()); assertEquals(StringType.class, ctx.resolvePropertyType()); } else { fail("Expected stringType or item but got " + eName); } return o == null ? null : new GlobalElement.StringType((String)o); } }); // have to override string type's handlers ElementBinding global = SCHEMA.getElement(new QName("http://jboss.org/ns/test", "global")); SequenceBinding sequence = (SequenceBinding) global.getType().getParticle().getTerm(); Iterator iter = sequence.getParticles().iterator(); iter.next(); // stringType element ElementBinding stringElement = (ElementBinding) iter.next().getTerm(); stringElement.setBeforeMarshallingCallback(new TermBeforeMarshallingCallback() { public Object beforeMarshalling(Object o, MarshallingContext ctx) { ParticleBinding particle = ctx.getParticleBinding(); assertNotNull(particle); assertTrue(particle.getTerm().isElement()); ElementBinding element = (ElementBinding) particle.getTerm(); assertEquals(new QName("http://jboss.org/ns/test", "stringElement"), element.getQName()); TypeBinding type = element.getType(); assertEquals(Constants.QNAME_STRING, type.getQName()); return o == null ? null : (String)o; } }); stringElement.setBeforeSetParentCallback(new TermBeforeSetParentCallback() { public Object beforeSetParent(Object o, UnmarshallingContext ctx) { ParticleBinding particle = ctx.getParticle(); assertNotNull(particle); assertTrue(particle.getTerm().isElement()); ElementBinding element = (ElementBinding) particle.getTerm(); assertEquals(new QName("http://jboss.org/ns/test", "stringElement"), element.getQName()); assertTrue(ctx.getParentValue() instanceof GlobalElement); TermBinding parentTerm = ctx.getParentParticle().getTerm(); assertTrue(parentTerm.isElement()); assertEquals("global", ((ElementBinding)parentTerm).getQName().getLocalPart()); assertEquals(String.class, ctx.resolvePropertyType()); return o == null ? null : (String)o; } }); // sequence sequence = (SequenceBinding) ((ParticleBinding)iter.next()).getTerm(); sequence.setBeforeMarshallingCallback(new TermBeforeMarshallingCallback() { public Object beforeMarshalling(Object o, MarshallingContext ctx) { ParticleBinding particle = ctx.getParticleBinding(); assertNotNull(particle); assertTrue(particle.getTerm() instanceof SequenceBinding); if(o != null) { GlobalElement.Sequence seq = new GlobalElement.Sequence(); seq.item = (StringType) o; o = seq; } return o; } }); sequence.setBeforeSetParentCallback(new TermBeforeSetParentCallback() { public Object beforeSetParent(Object o, UnmarshallingContext ctx) { ParticleBinding particle = ctx.getParticle(); assertTrue(particle.getTerm() instanceof SequenceBinding); assertTrue(ctx.getParentValue() instanceof GlobalElement); TermBinding parentTerm = ctx.getParentParticle().getTerm(); assertTrue(parentTerm.isElement()); assertEquals("global", ((ElementBinding)parentTerm).getQName().getLocalPart()); String prop = ctx.resolvePropertyName(); assertEquals("sequenceItem", prop); assertEquals(StringType.class, ctx.resolvePropertyType()); return o == null ? null : ((GlobalElement.Sequence)o).item; } }); } return SCHEMA; } // inner public static class GlobalElement { public static final String TEXT = "traumeel"; public static final StringType STRING_TYPE = new StringType(TEXT); public StringType stringType; public String stringElement; public StringType sequenceItem; public Object anyObject; public static class StringType { public String data; public StringType(String data) { this.data = data; } public int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + ((data == null) ? 0 : data.hashCode()); return result; } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final StringType other = (StringType) obj; if (data == null) { if (other.data != null) return false; } else if (!data.equals(other.data)) return false; return true; } } public static class Sequence { public StringType item; } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/MapsUnitTestCase.java0000644000175000017500000003310611330537706032057 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.net.URL; import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementInterceptor; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.xml.sax.Attributes; import junit.framework.TestCase; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class MapsUnitTestCase extends TestCase { private static final String NS = "http://www.jboss.org/test/xml/maps"; private static final QName QNAME_MAP = new QName(NS, "map"); private static final QName QNAME_SUBMAP = new QName(NS, "submap"); private static final QName QNAME_ENTRY1 = new QName(NS, "entry1"); private static final QName QNAME_ENTRY2 = new QName(NS, "entry2"); private static final QName QNAME_ENTRY3 = new QName(NS, "entry3"); private static final QName QNAME_ENTRY4 = new QName(NS, "entry4"); private static final QName QNAME_KEY1 = new QName(NS, "key1"); private static final QName QNAME_VALUE1 = new QName(NS, "value1"); private static final QName QNAME_VALUE2 = new QName(NS, "value2"); private static final Map EXPECTED; static { Map expected = new HashMap(); expected.put("key1", "value1"); expected.put("key2", "value2"); expected.put("key3", "value3"); expected.put("key4", "value4"); expected.put("key_1", "value_1"); expected.put("key_2", "value_2"); expected.put("submap", Collections.singletonMap("submapKey", "submapValue")); EXPECTED = expected; } public MapsUnitTestCase() { } public MapsUnitTestCase(String localName) { super(localName); } public void testXsd() throws Exception { SchemaBinding schema = XsdBinder.bind(getFullPath("xml/maps.xsd")); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object map = unmarshaller.unmarshal(getFullPath("xml/maps.xml"), schema); assertNotNull(map); assertTrue(map instanceof Map); assertEquals(EXPECTED, map); } public void testManual() throws Exception { SchemaBinding schema = new SchemaBinding(); // Type declarations TypeBinding mapType = new TypeBinding(); // default model group is all, we want sequence mapType.setParticle(new ParticleBinding(new SequenceBinding(schema))); TypeBinding entry1Type = new TypeBinding(); TypeBinding entry2Type = new TypeBinding(); TypeBinding entry3Type = new TypeBinding(); TypeBinding entry4Type = new TypeBinding(); // Schema assembling mapType.addElement(QNAME_ENTRY1, entry1Type, 0, true); mapType.addElement(QNAME_ENTRY2, entry2Type, 0, true); mapType.addElement(QNAME_ENTRY3, entry3Type, 0, true); mapType.addElement(QNAME_ENTRY4, entry4Type, 0, true); // sequence as entry SequenceBinding entrySeq = new SequenceBinding(schema); ElementBinding keyElement = new ElementBinding(schema, new QName(NS, "key"), new TypeBinding()); entrySeq.addParticle(new ParticleBinding(keyElement)); ElementBinding valueElement = new ElementBinding(schema, new QName(NS, "value"), new TypeBinding()); entrySeq.addParticle(new ParticleBinding(valueElement)); ParticleBinding entryParticle = new ParticleBinding(entrySeq); entryParticle.setMinOccurs(0); entryParticle.setMaxOccursUnbounded(true); mapType.addParticle(entryParticle); mapType.addElement(QNAME_SUBMAP, mapType, 0, true); schema.addElement(QNAME_MAP, mapType); // Handler implementations mapType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new HashMap(); } } ); ElementInterceptor addMapEntryInterceptor = new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { Map map = (Map)parent; Object[] arr = (Object[])child; map.put(arr[0], arr[1]); } }; mapType.pushInterceptor(QNAME_ENTRY1, addMapEntryInterceptor); mapType.pushInterceptor(QNAME_ENTRY2, addMapEntryInterceptor); mapType.pushInterceptor(QNAME_ENTRY3, addMapEntryInterceptor); mapType.pushInterceptor(QNAME_ENTRY4, addMapEntryInterceptor); mapType.pushInterceptor(QNAME_SUBMAP, addMapEntryInterceptor); entry1Type.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Object[2]; } } ); entry1Type.pushInterceptor(QNAME_KEY1, new DefaultElementInterceptor() { public void characters(Object o, QName name, TypeBinding type, NamespaceContext nsCtx, String text) { Object[] arr = (Object[])o; arr[0] = text; } } ); entry1Type.pushInterceptor(QNAME_VALUE1, new DefaultElementInterceptor() { public void characters(Object o, QName name, TypeBinding type, NamespaceContext nsCtx, String text) { Object[] arr = (Object[])o; arr[1] = text; } } ); entry2Type.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Object[2]; } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { Object[] arr = (Object[])o; for(int i = 0; i < attrs.getLength(); ++i) { String lName = attrs.getLocalName(i); if("key2".equals(lName)) { arr[0] = attrs.getValue(i); } } } } ); entry2Type.pushInterceptor(QNAME_VALUE2, new DefaultElementInterceptor() { public void characters(Object o, QName name, TypeBinding type, NamespaceContext nsCtx, String text) { Object[] arr = (Object[])o; arr[1] = text; } } ); entry3Type.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Object[2]; } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { Object[] arr = (Object[])o; for(int i = 0; i < attrs.getLength(); ++i) { String lName = attrs.getLocalName(i); if("key3".equals(lName)) { arr[0] = attrs.getValue(i); } else if("value3".equals(lName)) { arr[1] = attrs.getValue(i); } } } } ); entry4Type.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Object[2]; } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { Object[] arr = (Object[])o; for(int i = 0; i < attrs.getLength(); ++i) { String lName = attrs.getLocalName(i); if("key4".equals(lName)) { arr[0] = attrs.getValue(i); } } } } ); entry4Type.setSimpleType(new CharactersHandler() { public void setValue(QName qName, ElementBinding element, Object owner, Object value) { Object[] arr = (Object[])owner; arr[1] = value; } } ); mapType.pushInterceptor(QNAME_SUBMAP, new DefaultElementInterceptor() { public Object startElement(Object parent, QName name, TypeBinding type) { return new Object[2]; } public void attributes(Object o, QName elementName, TypeBinding type, Attributes attrs, NamespaceContext nsCtx) { Object[] arr = (Object[])o; for(int i = 0; i < attrs.getLength(); ++i) { String lName = attrs.getLocalName(i); if("key".equals(lName)) { arr[0] = attrs.getValue(i); } } } public void add(Object parent, Object child, QName qName) { Object[] arr = (Object[])parent; Map submap = (Map)child; arr[1] = submap; } } ); // sequence entry entrySeq.setSkip(false); entrySeq.setHandler(new ParticleHandler() { public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { return new Object[2]; } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return o; } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { Map map = (Map)parent; Object[] arr = (Object[])o; map.put(arr[0], arr[1]); } } ); keyElement.pushInterceptor(new DefaultElementInterceptor() { public void characters(Object o, QName name, TypeBinding type, NamespaceContext nsCtx, String text) { Object[] arr = (Object[])o; arr[0] = text; } }); valueElement.pushInterceptor(new DefaultElementInterceptor() { public void characters(Object o, QName name, TypeBinding type, NamespaceContext nsCtx, String text) { Object[] arr = (Object[])o; arr[1] = text; } }); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object map = unmarshaller.unmarshal(getFullPath("xml/maps.xml"), schema); assertNotNull(map); assertTrue(map instanceof Map); assertEquals(EXPECTED, map); } // Private private String getFullPath(String name) { URL url = Thread.currentThread().getContextClassLoader().getResource(name); if(url == null) { fail("Resource not found: " + name); } return url.getFile(); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/XsiNilUnitTestCase.java0000644000175000017500000000634511350377745032401 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import javax.xml.namespace.QName; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * A XsiNilUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class XsiNilUnitTestCase extends AbstractJBossXBTest { private static String XSD = "" + "" + " " + " " + " " + " " + " " + " " + " " + "" + ""; private static String XML_NIL_1 = ""; private static String XML_NIL_0 = ""; private static String XML = ""; public XsiNilUnitTestCase(String name) { super(name); } public void testUnmarshalling() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(XSD), null); ElementBinding rootBinding = schema.getElement(new QName("root")); assertNotNull(rootBinding); assertTrue(rootBinding.isNillable()); Root root = (Root) UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(XML), schema); assertNotNull(root); root = (Root) UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(XML_NIL_1), schema); assertNull(root); root = (Root) UnmarshallerFactory.newInstance().newUnmarshaller().unmarshal(new StringReader(XML_NIL_0), schema); assertNotNull(root); } public static class Root { } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/JBossXBTestSuite.java0000644000175000017500000000333410512170005031771 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import junit.framework.Test; import junit.framework.TestSuite; import junit.textui.TestRunner; /** * JBossXB TestSuite. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JBossXBTestSuite extends TestSuite { public static void main(String[] args) { TestRunner.run(suite()); } public static Test suite() { TestSuite suite = new TestSuite("JBossXB Tests"); suite.addTest(GlobalGroupUnitTestCase.suite()); suite.addTest(RepeatableTermsUnitTestCase.suite()); suite.addTest(SharedElementUnitTestCase.suite()); suite.addTest(XIncludeUnitTestCase.suite()); suite.addTest(XOPUnitTestCase.suite()); return suite; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/Dom2SaxUnitTestCase.java0000644000175000017500000000614310513427451032432 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.StringWriter; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.xml.serialize.OutputFormat; import org.apache.xml.serialize.XMLSerializer; import org.jboss.xb.util.Dom2Sax; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; /** * @author Alexey Loubyansky * @version $Revision: 41882 $ */ public class Dom2SaxUnitTestCase extends AbstractJBossXBTest { private static final String XML = "" + "e text content" + " " + " " + " e4 text content" + " " + ""; public Dom2SaxUnitTestCase(String name) { super(name); } public void testMain() throws Exception { Element e1 = parse(); StringWriter writer = new StringWriter(); XMLSerializer ser = new XMLSerializer(writer, null); ser.setNamespaces(true); OutputFormat of = new OutputFormat(); of.setOmitXMLDeclaration(true); ser.setOutputFormat(of); final ContentHandler serCh = ser.asContentHandler(); Dom2Sax.dom2sax(e1, serCh); assertXmlEqual(XML, writer.getBuffer().toString()); } private Element parse() throws ParserConfigurationException, SAXException, IOException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(new ByteArrayInputStream(XML.getBytes())); return (Element)doc.getFirstChild(); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/choiceresolution/0000755000175000017500000000000011620316742031370 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/choiceresolution/test/0000755000175000017500000000000011620316742032347 5ustar twernertwerner././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/choiceresolution/test/FooBarSequenceOrBarUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/choiceresolution/test/FooBa0000644000175000017500000000453411152730607033266 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.choiceresolution.test; import org.jboss.test.xml.AbstractJBossXBTest; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * A ChoiceResolutionUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class FooBarSequenceOrBarUnitTestCase extends AbstractJBossXBTest { public FooBarSequenceOrBarUnitTestCase(String name) { super(name); } public void testBar() throws Exception { String xml = findXML(getRootName() + '_' + getName() + ".xml"); String xsd = findXML(getRootName() + ".xsd"); SchemaBinding schema = XsdBinder.bind(xsd); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.unmarshal(xml, schema); } public void testFooBar() throws Exception { String xml = findXML(getRootName() + '_' + getName() + ".xml"); String xsd = findXML(getRootName() + ".xsd"); SchemaBinding schema = XsdBinder.bind(xsd); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.unmarshal(xml, schema); } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/choiceresolution/test/Foo2BarSequenceOrBarUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/choiceresolution/test/Foo2B0000644000175000017500000001572311152730607033211 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.choiceresolution.test; import java.util.Collection; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import org.jboss.test.xml.AbstractJBossXBTest; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * A ChoiceResolutionUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class Foo2BarSequenceOrBarUnitTestCase extends AbstractJBossXBTest { public Foo2BarSequenceOrBarUnitTestCase(String name) { super(name); } public void testBar() throws Exception { String xml = findXML(getRootName() + '_' + getName() + ".xml"); SchemaBinding schema = getSchemaBinding(); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(xml, schema); assertNotNull(o); Root root = (Root) o; assertNull(root.foo); assertNull(root.barMaxOccurs2); assertEquals("bar", root.bar); } public void testFooBar() throws Exception { String xml = findXML(getRootName() + '_' + getName() + ".xml"); SchemaBinding schema = getSchemaBinding(); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(xml, schema); assertNotNull(o); Root root = (Root) o; assertEquals("foo", root.foo); assertNotNull(root.barMaxOccurs2); assertEquals(1, root.barMaxOccurs2.size()); assertEquals("bar", root.barMaxOccurs2.get(0)); assertNull(root.bar); } public void testFoo2Bar() throws Exception { String xml = findXML(getRootName() + '_' + getName() + ".xml"); SchemaBinding schema = getSchemaBinding(); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(xml, schema); assertNotNull(o); Root root = (Root) o; assertEquals("foo", root.foo); assertNotNull(root.barMaxOccurs2); assertEquals(2, root.barMaxOccurs2.size()); assertEquals("bar1", root.barMaxOccurs2.get(0)); assertEquals("bar2", root.barMaxOccurs2.get(1)); assertNull(root.bar); } public void testFoo3Bar() throws Exception { String xml = findXML(getRootName() + '_' + getName() + ".xml"); SchemaBinding schema = getSchemaBinding(); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(xml, schema); assertNotNull(o); Root root = (Root) o; assertEquals("foo", root.foo); assertNotNull(root.barMaxOccurs2); assertEquals(2, root.barMaxOccurs2.size()); assertEquals("bar1", root.barMaxOccurs2.get(0)); assertEquals("bar2", root.barMaxOccurs2.get(1)); assertEquals("bar3", root.bar); } private SchemaBinding getSchemaBinding() { String xsd = findXML(getRootName() + ".xsd"); SchemaBinding schema = XsdBinder.bind(xsd); schema.setStrictSchema(true); schema.setIgnoreUnresolvedFieldOrClass(false); ElementBinding e = schema.getElement(new QName("file:///tmp/test.xsd", "message")); assertNotNull(e); TypeBinding type = e.getType(); ClassMetaData cmd = new ClassMetaData(); cmd.setImpl(Root.class.getName()); type.setClassMetaData(cmd); TermBinding t = type.getParticle().getTerm(); assertTrue(t instanceof ChoiceBinding); Collection particles = ((ChoiceBinding)t).getParticles(); assertEquals(2, particles.size()); Iterator i = particles.iterator(); ParticleBinding p = i.next(); assertEquals(1, p.getMinOccurs()); assertEquals(1, p.getMaxOccurs()); assertFalse(p.getMaxOccursUnbounded()); t = p.getTerm(); assertTrue(t instanceof SequenceBinding); p = i.next(); assertEquals(1, p.getMinOccurs()); assertEquals(1, p.getMaxOccurs()); assertFalse(p.getMaxOccursUnbounded()); assertTrue(p.getTerm().isElement()); assertEquals(new QName("file:///tmp/test.xsd", "bar"), ((ElementBinding)p.getTerm()).getQName()); particles = ((SequenceBinding)t).getParticles(); assertEquals(2, particles.size()); i = particles.iterator(); p = i.next(); assertEquals(1, p.getMinOccurs()); assertEquals(1, p.getMaxOccurs()); assertFalse(p.getMaxOccursUnbounded()); assertTrue(p.getTerm().isElement()); assertEquals(new QName("file:///tmp/test.xsd", "foo"), ((ElementBinding)p.getTerm()).getQName()); p = i.next(); assertEquals(1, p.getMinOccurs()); assertEquals(2, p.getMaxOccurs()); assertFalse(p.getMaxOccursUnbounded()); assertTrue(p.getTerm().isElement()); e = (ElementBinding) p.getTerm(); assertEquals(new QName("file:///tmp/test.xsd", "bar"), e.getQName()); PropertyMetaData pmd = new PropertyMetaData(); pmd.setName("barMaxOccurs2"); e.setPropertyMetaData(pmd); return schema; } public static class Root { public String foo; public List barMaxOccurs2; public String bar; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/book/0000755000175000017500000000000011620316735026746 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/book/BookCharacter.java0000644000175000017500000000664310513427451032327 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.book; /** * BookCharacter class that represents the character element in XML content. * * @version $Revision: 37406 $ * @author Alexey Loubyansky */ public class BookCharacter { private String name; private String friendOf; private String since; private String qualification; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getFriendOf() { return friendOf; } public void setFriendOf(String friendOf) { this.friendOf = friendOf; } public String getSince() { return since; } public void setSince(String since) { this.since = since; } public String getQualification() { return qualification; } public void setQualification(String qualification) { this.qualification = qualification; } public boolean equals(Object o) { if(this == o) return true; if(!(o instanceof BookCharacter)) return false; final BookCharacter bookCharacter = (BookCharacter)o; if(friendOf != null ? !friendOf.equals(bookCharacter.friendOf) : bookCharacter.friendOf != null) return false; if(name != null ? !name.equals(bookCharacter.name) : bookCharacter.name != null) return false; if(qualification != null ? !qualification.equals(bookCharacter.qualification) : bookCharacter.qualification != null) return false; if(since != null ? !since.equals(bookCharacter.since) : bookCharacter.since != null) return false; return true; } public int hashCode() { int result; result = (name != null ? name.hashCode() : 0); result = 29 * result + (friendOf != null ? friendOf.hashCode() : 0); result = 29 * result + (since != null ? since.hashCode() : 0); result = 29 * result + (qualification != null ? qualification.hashCode() : 0); return result; } public String toString() { StringBuffer sb = new StringBuffer(50); sb.append('[') .append("name=").append(name) .append(", friend-of=").append(friendOf) .append(", since=").append(since) .append(", qualification=").append(qualification) .append(']'); return sb.toString(); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/book/Book.java0000644000175000017500000001036611061473704030510 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.book; import java.util.List; import java.util.ArrayList; /** * Book class that represents book element in XML content. * * @version $Revision: 37406 $ * @author Alexey Loubyansky */ public class Book { public static Book getInstance() { Book book = new Book(); book.setIsbn("0836217462"); book.setTitle("Being a Dog Is a Full-Time Job"); book.setAuthor("Charles M. Schulz"); BookCharacter character = new BookCharacter(); character.setName("Snoopy"); character.setFriendOf("Peppermint Patty"); character.setSince("1950-10-04"); character.setQualification("extroverted beagle"); book.addCharacter(character); character = new BookCharacter(); character.setName("Peppermint Patty"); character.setSince("1966-08-22"); character.setQualification("bold, brash and tomboyish"); book.addCharacter(character); return book; } private String isbn; private String title; private String author; private List characters = new ArrayList(); public String getIsbn() { return isbn; } public void setIsbn(String isbn) { this.isbn = isbn; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public List getCharacters() { return characters; } public void setCharacters(List characters) { this.characters = characters; } public void addCharacter(BookCharacter character) { characters.add(character); } public int getCharactersTotal() { return characters.size(); } public String toString() { StringBuffer sb = new StringBuffer(100); sb.append('[') .append("isbn=").append(isbn) .append(", title=").append(title) .append(", author=").append(author) .append(", characters=").append(characters) .append(']'); return sb.toString(); } public boolean equals(Object o) { if(this == o) return true; if(!(o instanceof Book)) return false; final Book book = (Book)o; if(author != null ? !author.equals(book.author) : book.author != null) return false; if(characters != null ? !characters.equals(book.characters) : book.characters != null) return false; if(isbn != null ? !isbn.equals(book.isbn) : book.isbn != null) return false; if(title != null ? !title.equals(book.title) : book.title != null) return false; return true; } public int hashCode() { int result; result = (isbn != null ? isbn.hashCode() : 0); result = 29 * result + (title != null ? title.hashCode() : 0); result = 29 * result + (author != null ? author.hashCode() : 0); result = 29 * result + (characters != null ? characters.hashCode() : 0); return result; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/book/BookObjectFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/book/BookObjectFactory.java0000644000175000017500000001141710523470321033157 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.book; import org.xml.sax.Attributes; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.UnmarshallingContext; /** * org.jboss.xb.binding.ObjectModelFactory implementation that accepts data chuncks from unmarshaller * and assembles them into an instance Book. * * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class BookObjectFactory implements ObjectModelFactory { // ObjectModelFactory implementation public void startDTD(String name, String publicId, String systemId) { System.err.print("startDTD, name="+name+", publicId="+publicId+", systemId="+systemId); } /** * Return the root. */ public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { final Book book; if(root == null) { root = book = new Book(); } else { book = (Book) root; } if(attrs.getLength() > 0) { for(int i = 0; i < attrs.getLength(); ++i) { if(attrs.getLocalName(i).equals("isbn")) { book.setIsbn(attrs.getValue(i)); } } } return root; } public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name) { return root; } // Methods discovered by introspection /** * Called when a child element with simple content is read for book. */ public void setValue(Book book, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if("title".equals(localName)) { book.setTitle(value); } else if("author".equals(localName)) { book.setAuthor(value); } } /** * Called when parsing of a new element started. */ public Object newChild(Book book, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { Object child = null; if("character".equals(localName)) { child = new BookCharacter(); } return child; } /** * Called when a child element with simple content is read for character. */ public void setValue(BookCharacter character, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if("name".equals(localName)) { character.setName(value); } else if("friend-of".equals(localName)) { character.setFriendOf(value); } else if("since".equals(localName)) { if(value.endsWith("Z")) { value = value.substring(0, value.length() - 1); } character.setSince(value); } else if("qualification".equals(localName)) { character.setQualification(value); } } /** * Called when parsing character is complete. */ public void addChild(Book book, BookCharacter character, UnmarshallingContext navigator, String namespaceURI, String localName) { book.addCharacter(character); } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/book/BookGenericObjectModelFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/book/BookGenericObjectModel0000644000175000017500000001013610513427451033167 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.book; import org.jboss.xb.binding.GenericObjectModelFactory; import org.jboss.xb.binding.UnmarshallingContext; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class BookGenericObjectModelFactory implements GenericObjectModelFactory { public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { final Book book; if(root == null) { root = book = new Book(); } else { book = (Book) root; } if(attrs.getLength() > 0) { for(int i = 0; i < attrs.getLength(); ++i) { if(attrs.getLocalName(i).equals("isbn")) { book.setIsbn(attrs.getValue(i)); } } } return root; } public Object newChild(Object parent, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { Object child = null; if(parent instanceof Book) { if("character".equals(localName)) { child = new BookCharacter(); } } return child; } public void addChild(Object parent, Object child, UnmarshallingContext navigator, String namespaceURI, String localName) { if(parent instanceof Book) { final Book book = (Book)parent; if(child instanceof BookCharacter) { book.addCharacter((BookCharacter)child); } } } public void setValue(Object o, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { if(o instanceof Book) { final Book book = (Book)o; if("title".equals(localName)) { book.setTitle(value); } else if("author".equals(localName)) { book.setAuthor(value); } } else if(o instanceof BookCharacter) { BookCharacter character = (BookCharacter)o; if("name".equals(localName)) { character.setName(value); } else if("friend-of".equals(localName)) { character.setFriendOf(value); } else if("since".equals(localName)) { character.setSince(value); } else if("qualification".equals(localName)) { character.setQualification(value); } } } public Object completeRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName) { return root; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/book/BookGenericObjectModelProvider.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/book/BookGenericObjectModel0000644000175000017500000000647310513427451033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.book; import org.jboss.xb.binding.GenericObjectModelProvider; import org.jboss.xb.binding.MarshallingContext; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class BookGenericObjectModelProvider implements GenericObjectModelProvider { public Object getChildren(Object o, MarshallingContext ctx, String namespaceURI, String localName) { Object children = null; if(o instanceof Book) { Book book = (Book)o; if(localName.equals("character")) { children = book.getCharacters(); } else if(localName.equals("book")) { children = book; } } return children; } public Object getElementValue(Object o, MarshallingContext ctx, String namespaceURI, String localName) { Object value = null; if(o instanceof Book) { Book book = (Book)o; if("title".equals(localName)) { value = book.getTitle(); } else if("author".equals(localName)) { value = book.getAuthor(); } } else if(o instanceof BookCharacter) { BookCharacter character = (BookCharacter)o; if("name".equals(localName)) { value = character.getName(); } else if("friend-of".equals(localName)) { value = character.getFriendOf(); } else if("since".equals(localName)) { value = character.getSince(); } else if("qualification".equals(localName)) { value = character.getQualification(); } } return value; } public Object getAttributeValue(Object o, MarshallingContext ctx, String namespaceURI, String localName) { Object value = null; if(o instanceof Book) { Book book = (Book)o; if("isbn".equals(localName)) { value = book.getIsbn(); } } return value; } public Object getRoot(Object o, MarshallingContext ctx, String namespaceURI, String localName) { return o; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/book/DateDatatypeConverter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/book/DateDatatypeConverter.0000644000175000017500000000262210513427451033210 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.book; import java.util.Date; import javax.xml.namespace.NamespaceContext; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class DateDatatypeConverter { public static String unmarshal(String value, NamespaceContext ctx) { return value; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/book/BookObjectProvider.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/book/BookObjectProvider.jav0000644000175000017500000000774310513427451033215 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.book; import java.text.SimpleDateFormat; import java.text.ParseException; import java.util.Calendar; import java.util.TimeZone; import org.jboss.xb.binding.MarshallingContext; import org.jboss.xb.binding.ObjectModelProvider; /** * org.jboss.xb.binding.ObjectModelProvider implementation that provides data to marshaller given * specific Book instance. * * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class BookObjectProvider implements ObjectModelProvider { public Object getRoot(Object o, MarshallingContext ctx, String namespaceURI, String localName) { return o; } public Object getChildren(Book book, String namespaceUri, String localName) { Object children = null; if(localName.equals("book")) { children = book; } else if(localName.equals("character")) { children = book.getCharacters(); } return children; } public Object getAttributeValue(Book book, String namespaceUri, String localName) { Object value; if("isbn".equals(localName)) { value = book.getIsbn(); } else { value = null; } return value; } public Object getElementValue(Book book, String namespaceUri, String localName) { Object value; if("title".equals(localName)) { value = book.getTitle(); } else if("author".equals(localName)) { value = book.getAuthor(); } else { value = null; } return value; } public Object getElementValue(BookCharacter character, String namespaceUri, String localName) { Object value = null; if("name".equals(localName)) { value = character.getName(); } else if("friend-of".equals(localName)) { value = character.getFriendOf(); } else if("since".equals(localName)) { String since = character.getSince(); if(since == null) { value = null; } else { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); dateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); java.util.Date date = null; try { date = dateFormat.parse(since); } catch(ParseException e) { throw new IllegalStateException("Failed to parse date " + since + ": " + e.getMessage()); } Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); cal.setTime(date); value = cal; } } else if("qualification".equals(localName)) { value = character.getQualification(); } return value; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/MinOccurs0UnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/MinOccurs0UnitTestCase.java0000644000175000017500000001666510513427451033151 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.io.StringWriter; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.Marshaller; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; /** * @author Alexey Loubyansky * @version $Revision: 45337 $ */ public class MinOccurs0UnitTestCase extends AbstractJBossXBTest { private static final String XSD = "" + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "" + ""; private static final String MBEAN_XSD = "" + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "" + "" + "" + ""; private static SchemaBinding SCHEMA; private static final String XML_NO_VALUE = "" + ""; private static final String XML_WITH_VALUE = "" + "val" + ""; public MinOccurs0UnitTestCase(String name) { super(name); } protected void configureLogging() { if(SCHEMA == null) { SCHEMA = XsdBinder.bind(new StringReader(XSD), null); SCHEMA.setIgnoreUnresolvedFieldOrClass(false); } } public void testUnmarshallingNoValue() throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML_NO_VALUE), SCHEMA); assertNotNull(o); assertTrue(o instanceof E); E e = (E)o; assertNull(e.value); } public void testUnmarshallingWithValue() throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML_WITH_VALUE), SCHEMA); assertNotNull(o); assertTrue(o instanceof E); E e = (E)o; assertEquals("val", e.value); } public void testMarshallingNoValueXerces() throws Exception { XercesXsMarshaller marshaller = new XercesXsMarshaller(); marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), new E(), writer); String xml = writer.getBuffer().toString(); assertXmlEqual(XML_NO_VALUE, xml); } public void testMarshallingWithValueXerces() throws Exception { XercesXsMarshaller marshaller = new XercesXsMarshaller(); marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), new E("val"), writer); String xml = writer.getBuffer().toString(); assertXmlEqual(XML_WITH_VALUE, xml); } public void testMarshallingNoValueSunday() throws Exception { MarshallerImpl marshaller = new MarshallerImpl(); marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); StringWriter writer = new StringWriter(); marshaller.marshal(SCHEMA, null, new E(), writer); String xml = writer.getBuffer().toString(); assertXmlEqual(XML_NO_VALUE, xml); } public void testMarshallingWithValueSunday() throws Exception { MarshallerImpl marshaller = new MarshallerImpl(); marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); StringWriter writer = new StringWriter(); marshaller.marshal(SCHEMA, null, new E("val"), writer); String xml = writer.getBuffer().toString(); assertXmlEqual(XML_WITH_VALUE, xml); } public void testMBeanUnmarshalling() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(MBEAN_XSD), null); schema.setIgnoreUnresolvedFieldOrClass(false); String xml = "descriptors"; Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(xml), schema); assertNotNull(o); assertTrue(o instanceof ClassForMBean); ClassForMBean mb = (ClassForMBean)o; assertNull(mb.description); assertEquals("descriptors", mb.descriptors); } // Inner public static final class E { public String value; public E() { } public E(String value) { this.value = value; } } public static final class ClassForMBean { public String description; public String descriptors; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SchemaBindingInitializerUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SchemaBindingInitializerUni0000644000175000017500000001232311154172516033312 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import junit.framework.Test; import org.jboss.test.xml.initializer.Container; import org.jboss.test.xml.initializer.ContainerInitializer; import org.jboss.test.xml.initializer.Simple; import org.jboss.test.xml.initializer.SimpleInitializer; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; /** * SchemaBindingInitializerUnitTestCase. * * @author Adrian Brock * @version $Revision: 40498 $ */ public class SchemaBindingInitializerUnitTestCase extends AbstractJBossXBTest { public static SchemaBindingResolver initResolver() throws Exception { Class clazz = SchemaBindingInitializerUnitTestCase.class; MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); resolver.mapSchemaInitializer(SimpleInitializer.NS, SimpleInitializer.class.getName()); String location = getSchemaLocation(clazz, "SchemaBindingInitializerUnitTestCaseSimple.xsd"); resolver.mapSchemaLocation(SimpleInitializer.NS, location); resolver.mapSchemaInitializer(ContainerInitializer.NS, ContainerInitializer.class.getName()); location = getSchemaLocation(clazz, "SchemaBindingInitializerUnitTestCaseContainer.xsd"); resolver.mapSchemaLocation(ContainerInitializer.NS, location); return resolver; } public void testSimple() throws Exception { Simple simple = (Simple) unmarshal(rootName + "Simple.xml", Simple.class); assertEquals("SimpleTest", simple.getValue()); } public void testContainer() throws Exception { Container container = (Container) unmarshal(rootName + "Container.xml", Container.class); assertNull(container.getValue()); } public void testContainerStrictSimple() throws Exception { Container container = (Container) unmarshal(rootName + "ContainerStrictSimple.xml", Container.class); Object value = container.getValue(); assertNotNull("Should have a value", value); assertTrue("Should be a simple", value instanceof Simple); Simple simple = (Simple) value; assertEquals("ContainerStrict", simple.getValue()); } public void testContainerStrictNotSimple() throws Exception { try { unmarshal(rootName + "ContainerStrictNotSimple.xml"); fail("Should not be here!"); } catch (Exception e) { checkThrowable(JBossXBException.class, e); } } public void testContainerLaxSimple() throws Exception { Container container = (Container) unmarshal(rootName + "ContainerLaxSimple.xml", Container.class); Object value = container.getValue(); assertNotNull("Should have a value", value); assertTrue("Should be a simple", value instanceof Simple); Simple simple = (Simple) value; assertEquals("ContainerLax", simple.getValue()); } public void testContainerLaxNotSimple() throws Exception { Container container = (Container) unmarshal(rootName + "ContainerLaxNotSimple.xml", Container.class); Object value = container.getValue(); assertNull("Should NOT have a value", value); } public void testContainerSkipSimple() throws Exception { Container container = (Container) unmarshal(rootName + "ContainerSkipSimple.xml", Container.class); Object value = container.getValue(); assertNull("Should NOT have a value", value); } public void testContainerSkipNotSimple() throws Exception { Container container = (Container) unmarshal(rootName + "ContainerSkipNotSimple.xml", Container.class); Object value = container.getValue(); assertNull("Should NOT have a value", value); } /** * Setup the test * * @return the test */ public static Test suite() { return suite(SchemaBindingInitializerUnitTestCase.class); } /** * Create a new SchemaBindingInitializerUnitTestCase. * * @param name the test name */ public SchemaBindingInitializerUnitTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/JbxbCharactersUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/JbxbCharactersUnitTestCase.0000644000175000017500000001534410513427451033203 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.FileReader; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.net.URL; import org.jboss.test.BaseTestCase; import org.jboss.test.xml.jbxb.characters.Binding; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.Marshaller; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; /** * Test unmarshalling xml documents conforming to xml/jbxb/characters/schema1.xsd * into org.jboss.test.xml.jbxb.characters.Binding. * * @author Scott.Stark@jboss.org * @version $Revision: 45337 $ */ public class JbxbCharactersUnitTestCase extends BaseTestCase { private static final String XML_VALUE4 = "\n" + "" + "val4" + ""; public JbxbCharactersUnitTestCase(String name) { super(name); } /* public void configureLogging() { enableTrace("org.jboss.xb"); } */ public void testMainUnmarshalling() throws Exception { String res = getPath("xml/jbxb/characters/testSchema1.xml").getFile(); FileReader xmlReader = new FileReader(res); Binding binding = unmarshal(xmlReader); assertEquals("Binding.name = root ", "root", binding.getName()); assertEquals("Binding.text = value1 ", "value1", binding.getText()); } public void testValue2Unmarshalling() throws Exception { StringReader xmlReader = new StringReader("" + "" + " value2" + "" ); Binding binding = unmarshal(xmlReader); assertEquals("Binding.name = root ", "root", binding.getName()); Binding.Value2 value2 = binding.getValue2(); assertNotNull(value2); assertEquals("Binding.text2 = value2 ", "value2", value2.text); } public void testValue3Unmarshalling() throws Exception { StringReader xmlReader = new StringReader("" + "" + " value3" + "" ); Binding binding = unmarshal(xmlReader); assertEquals("Binding.name = root ", "root", binding.getName()); Binding.Value3 value3 = binding.getValue3(); assertNotNull(value3); assertEquals("value3", value3.chars); assertEquals("attr", value3.attr); } public void testValue4Unmarshalling() throws Exception { Binding binding = unmarshal(new StringReader(XML_VALUE4)); assertEquals("Binding.name = root ", "root", binding.getName()); Binding.Value4 value4 = binding.value4; assertNotNull(value4); assertEquals("val4", value4.value); } public void testValue4MarshallingXerces() throws Exception { Binding binding = new Binding(); binding.setName("root"); binding.value4 = new Binding.Value4("val4"); StringWriter writer = new StringWriter(); XercesXsMarshaller marshaller = new XercesXsMarshaller(); marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); String file = getPath("xml/jbxb/characters/schema1.xsd").getFile(); marshaller.marshal(new FileReader(file), new MappingObjectModelProvider(), binding, writer); String xml = writer.getBuffer().toString(); assertEquals(XML_VALUE4, xml); } public void testValue4MarshallingSunday() throws Exception { Binding binding = new Binding(); binding.setName("root"); binding.value4 = new Binding.Value4("val4"); StringWriter writer = new StringWriter(); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); String file = getPath("xml/jbxb/characters/schema1.xsd").getFile(); marshaller.marshal(new FileReader(file), new MappingObjectModelProvider(), binding, writer); String xml = writer.getBuffer().toString(); assertEquals(XML_VALUE4, xml); } // Private private Binding unmarshal(Reader xmlReader) throws JBossXBException { String url = getPath("xml/jbxb/characters/schema1.xsd").toExternalForm(); SchemaBinding schemaBinding = XsdBinder.bind(url); schemaBinding.setIgnoreUnresolvedFieldOrClass(true); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Binding binding = (Binding)unmarshaller.unmarshal(xmlReader, schemaBinding); return binding; } private URL getPath(String path) { java.net.URL url = Thread.currentThread().getContextClassLoader().getResource(path); if(url == null) { fail("URL not found: " + path); } return url; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AttributeRefUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AttributeRefUnitTestCase.ja0000644000175000017500000000653610661250222033226 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * @author Alexey Loubyansky * @version $Revision: 45337 $ */ public class AttributeRefUnitTestCase extends AbstractJBossXBTest { private static final String XSD = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; private static final String XML = ""; public AttributeRefUnitTestCase(String name) { super(name); } public void testMain() throws Exception { //enableTrace("org.jboss.xb.binding.sunday.unmarshalling.XsdBinder"); SchemaBinding schema = XsdBinder.bind(new StringReader(XSD), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML), schema); assertNotNull(o); assertTrue(o instanceof Top); Top top = (Top) o; assertEquals("attr", top.attr); assertEquals("attrRef", top.attrRef); } public static class Top { public String attr; public String attrRef; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SchemaIncludeUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SchemaIncludeUnitTestCase.j0000644000175000017500000000417211154172516033172 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.net.URL; import org.jboss.test.BaseTestCase; import org.jboss.xb.binding.Util; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; /** * SchemaIncludeUnitTestCase. * * @author Adrian Brock * @version $Revision: 42856 $ */ public class SchemaIncludeUnitTestCase extends BaseTestCase { public void testSimpleInclude() throws Exception { MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); URL url = getClass().getResource("/xml/SchemaIncludeUnitTestCase.xsd"); assertNotNull(url); Util.loadSchema(url.toString(), resolver); } public void testComplexInclude() throws Exception { MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); URL url = getClass().getResource("/xml/SchemaIncludeUnitTestCase.xsd"); assertNotNull(url); resolver.mapSchemaLocation("urn:jbosstest:schemainclude", url.toString()); Util.loadSchema(url.toString(), resolver); } public SchemaIncludeUnitTestCase(String name) { super(name); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/repeatableterms/0000755000175000017500000000000011620316742031171 5ustar twernertwerner././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/repeatableterms/Product.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/repeatableterms/Product.jav0000644000175000017500000000261411051025777033321 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.repeatableterms; /** * A Product. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class Product extends AbstractProduct { private int price; public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/repeatableterms/ProductArray.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/repeatableterms/ProductArra0000644000175000017500000000273611051025777033355 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.repeatableterms; import java.util.List; /** * A ProductArray. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ProductArray { private List product; public List getProduct() { return product; } public void setProduct(List products) { this.product = products; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/repeatableterms/AbstractProduct.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/repeatableterms/AbstractPro0000644000175000017500000000260311062060756033342 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.repeatableterms; /** * A BasicProduct. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class AbstractProduct { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AnnotationsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AnnotationsUnitTestCase.jav0000644000175000017500000000457510513427451033320 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import org.jboss.test.xml.book.Book; import org.jboss.test.BaseTestCase; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * @author Alexey Loubyansky * @version $Revision: 38201 $ */ public class AnnotationsUnitTestCase extends BaseTestCase { public AnnotationsUnitTestCase(String name) { super(name); } /* public void configureLogging() { enableTrace("org.jboss.xb"); } */ public void testMain() throws Exception { String url = getPath("xml/book/annotated_books.xsd"); SchemaBinding schemaBinding = XsdBinder.bind(url); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Book book = (Book)unmarshaller.unmarshal(getPath("xml/book/book-xs.xml"), schemaBinding); assertEquals(Book.getInstance(), book); } // Private public String getPath(String path) { java.net.URL url = Thread.currentThread().getContextClassLoader().getResource(path); if(url == null) { fail("URL not found: " + path); } return url.toString(); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/JbxbSchemaBindingAttributeUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/JbxbSchemaBindingAttributeU0000644000175000017500000000475511154172516033263 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xml.jbxb.schemabindingattribute.Ns2Root; import org.jboss.test.xml.jbxb.schemabindingattribute.Root; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A JbxbSchemaBindingAttributeUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class JbxbSchemaBindingAttributeUnitTestCase extends AbstractBuilderTest { public JbxbSchemaBindingAttributeUnitTestCase(String name) { super(name); } public void testNested() throws Exception { SchemaBinding schema = JBossXBBuilder.build(Root.class); schema.setSchemaResolver(new MultiClassSchemaResolver()); String name = findTestXml(); Object o = unmarshal(name, schema); assertNotNull(o); assertTrue(o instanceof Root); Root root = (Root) o; assertNotNull(root.getAnyElement()); assertEquals(1, root.getAnyElement().length); o = root.getAnyElement()[0]; assertNotNull(o); assertTrue(o instanceof Ns2Root); } public void testTop() throws Exception { String xml = findTestXml(); Object o = unmarshal(xml, new MultiClassSchemaResolver()); assertNotNull(o); assertTrue(o instanceof Ns2Root); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SchemalessTestCase.java0000644000175000017500000000453710711651506032411 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import junit.framework.TestCase; import org.jboss.test.xml.person.Person; import org.jboss.xb.binding.SchemalessMarshaller; import org.jboss.xb.binding.SchemalessObjectModelFactory; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import java.io.StringReader; import java.io.StringWriter; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class SchemalessTestCase extends TestCase { public SchemalessTestCase() { } public SchemalessTestCase(String localName) { super(localName); } public void testSchemalessMarshalling() throws Exception { Person person = Person.newInstance(); StringWriter writer = new StringWriter(); SchemalessMarshaller marshaller = new SchemalessMarshaller(); marshaller.marshal(person, writer); StringReader reader = new StringReader(writer.getBuffer().toString()); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); SchemalessObjectModelFactory factory = new SchemalessObjectModelFactory(); Person unmarshalled = (Person)unmarshaller.unmarshal(reader, factory, null); assertEquals(person, unmarshalled); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/EnumUnitTestCase.java0000644000175000017500000002726411061473704032071 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.io.StringWriter; import java.util.List; import java.util.Arrays; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.Marshaller; /** * @author Alexey Loubyansky * @version $Revision: 45337 $ */ public class EnumUnitTestCase extends AbstractJBossXBTest { private final String XSD = "" + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "" + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "" + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "" + ""; private final String XML_SIMPLE = "" + "red" + "1" + ""; private static final Global GLOBAL_SIMPLE; static { Global simple = new Global(); simple.color = Color.RED; simple.number = Nmbr.ONE; GLOBAL_SIMPLE = simple; } private final String XML_ALL = "" + " " + " 3" + " green" + " " + " " + " blue" + " 1" + " " + " " + " red" + " 2" + " " + ""; private static final Global GLOBAL_ALL; static { Global all = new Global(); all.all = Arrays.asList(new Object[]{Nmbr.THREE, Color.GREEN, Color.BLUE, Nmbr.ONE, Color.RED, Nmbr.TWO}); GLOBAL_ALL = all; } public EnumUnitTestCase(String name) { super(name); } public void testSimpleUnmarshalling() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(XSD), null); schema.setIgnoreUnresolvedFieldOrClass(false); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML_SIMPLE), schema); assertEquals(GLOBAL_SIMPLE, o); } public void testSimpleMarshallingSunday() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(XSD), null); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); StringWriter writer = new StringWriter(); marshaller.marshal(schema, null, GLOBAL_SIMPLE, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(XML_SIMPLE, marshalled); } public void testSimpleMarshallingXerces() throws Exception { XercesXsMarshaller marshaller = new XercesXsMarshaller(); marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), GLOBAL_SIMPLE, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(XML_SIMPLE, marshalled); } public void testAllUnmarshalling() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(XSD), null); schema.setIgnoreUnresolvedFieldOrClass(false); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML_ALL), schema); assertEquals(GLOBAL_ALL, o); } // Private public static final class Global { public Color color; public Nmbr number; public List all; public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Global)) { return false; } final Global global = (Global)o; if(all != null ? !all.equals(global.all) : global.all != null) { return false; } if(color != null ? !color.equals(global.color) : global.color != null) { return false; } if(number != null ? !number.equals(global.number) : global.number != null) { return false; } return true; } public int hashCode() { int result; result = (color != null ? color.hashCode() : 0); result = 29 * result + (number != null ? number.hashCode() : 0); result = 29 * result + (all != null ? all.hashCode() : 0); return result; } public String toString() { return color + " " + number + ", all=" + all; } } public static final class Color { private static final String RED_VALUE = "red"; private static final String GREEN_VALUE = "green"; private static final String BLUE_VALUE = "blue"; public static final Color RED = new Color(RED_VALUE); public static final Color GREEN = new Color(GREEN_VALUE); public static final Color BLUE = new Color(BLUE_VALUE); public static Color fromValue(String value) { Color color; if(RED_VALUE.equals(value)) { color = RED; } else if(GREEN_VALUE.equals(value)) { color = GREEN; } else if(BLUE_VALUE.equals(value)) { color = BLUE; } else { throw new IllegalArgumentException("Not supported value: " + value); } return color; } private final String value; private Color(String value) { this.value = value; } public String value() { return value; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Color)) { return false; } final Color color = (Color)o; if(!value.equals(color.value)) { return false; } return true; } public int hashCode() { return value.hashCode(); } public String toString() { return "COLOR " + value; } } public static final class Nmbr { public static final Nmbr ONE = new Nmbr(1); public static final Nmbr TWO = new Nmbr(2); public static final Nmbr THREE = new Nmbr(3); public static Nmbr fromValue(int value) { Nmbr nmbr; switch(value) { case 1: nmbr = ONE; break; case 2: nmbr = TWO; break; case 3: nmbr = THREE; break; default: throw new IllegalArgumentException("Not supported value: " + value); } return nmbr; } private final int value; private Nmbr(int value) { this.value = value; } public int value() { return value; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Nmbr)) { return false; } final Nmbr nmbr = (Nmbr)o; if(value != nmbr.value) { return false; } return true; } public int hashCode() { return value; } public String toString() { return "NUMBER " + value; } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/XIncludeUnitTestCase.java0000644000175000017500000000326510512170005032657 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import junit.framework.TestSuite; /*** * XIncludeUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class XIncludeUnitTestCase extends AbstractJBossXBTest { public static final TestSuite suite() { return new TestSuite(XIncludeUnitTestCase.class); } public XIncludeUnitTestCase(String name) { super(name); } public void testXInclude() throws Exception { Object o = unmarshal(); assertNotNull(o); assertTrue(o instanceof Top); } public static final class Top { } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/0000755000175000017500000000000011620316741031531 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/0000755000175000017500000000000011620316741032510 5ustar twernertwerner././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/MiscGroupsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/Misc0000644000175000017500000000524011151050602033315 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.unorderedsequence.test; import org.jboss.test.xml.unorderedsequence.support.RootWithMiscGroups; import org.jboss.test.xml.unorderedsequence.support.RootWithMiscGroups.CDEChoice; import org.jboss.test.xml.unorderedsequence.support.RootWithMiscGroups.DESequence; import org.jboss.test.xml.unorderedsequence.support.RootWithMiscGroups.FGSequence; /** * A BasicUnoderedSequenceUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class MiscGroupsUnitTestCase extends AbstractUnorderedSequenceTest { public MiscGroupsUnitTestCase(String name) { super(name, RootWithMiscGroups.class); } @Override protected String getCorrectName() { return "MiscGroups_correct.xml"; } @Override protected String getIncorrectName() { return "MiscGroups_incorrect.xml"; } @Override protected String getValidationError() { return "e cannot appear in this position. Expected content of root is sequence: a? b? {choice cde}? {sequence fg}?"; } @Override protected void assertResult(RootWithMiscGroups result) { assertEquals("a", result.getA()); assertEquals("b", result.getB()); CDEChoice cde = result.getCde(); assertNotNull(cde); assertNull(cde.getC()); DESequence de = cde.getDe(); assertNotNull(de); assertEquals("d", de.getD()); assertEquals("e", de.getE()); FGSequence fg = result.getFg(); assertNotNull(fg); assertEquals("f", fg.getF()); assertEquals("g", fg.getG()); } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/UnorderedOrderedMixUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/Unor0000644000175000017500000001646111356617671033402 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.unorderedsequence.test; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xml.unorderedsequence.support.UnorderedOrderedMix; import org.jboss.test.xml.unorderedsequence.support.UnorderedOrderedMix.SomeBean; import org.jboss.test.xml.unorderedsequence.support.UnorderedOrderedMix.SomeSequence; import org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A UnorderedSequenceWithCollections. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class UnorderedOrderedMixUnitTestCase extends AbstractBuilderTest { public UnorderedOrderedMixUnitTestCase(String name) { super(name); } private boolean defaultRepeatableHandlers; public void setUp() throws Exception { super.setUp(); defaultRepeatableHandlers = JBossXBBuilder.isRepeatableParticleHandlers(); JBossXBBuilder.setRepeatableParticleHandlers(true); } public void tearDown() throws Exception { super.tearDown(); JBossXBBuilder.setRepeatableParticleHandlers(defaultRepeatableHandlers); } public void testBinding() throws Exception { JBossXBBuilder.setUseUnorderedSequence(true); SchemaBinding schema = JBossXBBuilder.build(UnorderedOrderedMix.class, true); ElementBinding root = schema.getElement(new QName("root")); assertNotNull(root); TermBinding term = root.getType().getParticle().getTerm(); assertTrue(term instanceof UnorderedSequenceBinding); UnorderedSequenceBinding group = (UnorderedSequenceBinding) term; Collection particles = group.getParticles(); assertEquals(4, particles.size()); Iterator i = particles.iterator(); while(i.hasNext()) { ParticleBinding p = i.next(); assertTrue(p.getMaxOccursUnbounded()); term = p.getTerm(); if(term.isElement()) { if(new QName("string").equals(term.getQName())) continue; assertEquals(new QName("bean"), term.getQName()); term = ((ElementBinding)term).getType().getParticle().getTerm(); assertTrue(term instanceof SequenceBinding); particles = ((SequenceBinding)term).getParticles(); assertEquals(1, particles.size()); term = particles.iterator().next().getTerm(); assertTrue(term.isElement()); assertEquals(new QName("string"), term.getQName()); } else if(term instanceof SequenceBinding) { assertFalse(term.isSkip()); particles = ((SequenceBinding)term).getParticles(); assertEquals(3, particles.size()); Iterator iter = particles.iterator(); List expected = Arrays.asList(new QName("a"), new QName("b"), new QName("c")); List actual = Arrays.asList( iter.next().getTerm().getQName(), iter.next().getTerm().getQName(), iter.next().getTerm().getQName()); assertEquals(expected, actual); } else if(term instanceof ChoiceBinding) { assertTrue(term.isSkip()); particles = ((ChoiceBinding)term).getParticles(); assertEquals(2, particles.size()); Iterator iter = particles.iterator(); List expected = Arrays.asList(new QName("choice1"), new QName("choice2")); List actual = Arrays.asList(iter.next().getTerm().getQName(), iter.next().getTerm().getQName()); assertEquals(expected, actual); } } } public void testUnmarshalling() throws Exception { UnorderedOrderedMix root = unmarshalObject(UnorderedOrderedMix.class); List strings = root.getStrings(); assertNotNull(strings); assertEquals(2, strings.size()); assertEquals("string1", strings.get(0)); assertEquals("string2", strings.get(1)); List choices = root.getChoices(); assertNotNull(choices); assertEquals(2, choices.size()); assertEquals("choice11", choices.get(0)); assertEquals("choice21", choices.get(1)); List sequences = root.getSequences(); assertNotNull(sequences); assertEquals(3, sequences.size()); SomeSequence sequence = sequences.get(0); assertNotNull(sequence); assertEquals("a1", sequence.getA()); assertNull(sequence.getB()); assertTrue(sequence.getC().isEmpty()); sequence = sequences.get(1); assertNotNull(sequence); assertNull(sequence.getA()); assertEquals("b1", sequence.getB()); assertTrue(sequence.getC().isEmpty()); sequence = sequences.get(2); assertNotNull(sequence); assertEquals("a2", sequence.getA()); assertEquals("b2", sequence.getB()); assertEquals(2, sequence.getC().size()); assertTrue(sequence.getC().contains("c1")); assertTrue(sequence.getC().contains("c2")); List beans = root.getBeans(); assertNotNull(beans); assertEquals(2, beans.size()); SomeBean bean = beans.get(0); assertNotNull(bean); strings = bean.getStrings(); assertNotNull(strings); assertEquals(1, strings.size()); assertTrue(strings.contains("string1")); bean = beans.get(1); assertNotNull(bean); strings = bean.getStrings(); assertNotNull(strings); assertEquals(2, strings.size()); assertTrue(strings.contains("string1")); assertTrue(strings.contains("string2")); } } ././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/AbstractUnorderedSequenceTest.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/Abst0000644000175000017500000000643611151056423033332 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.unorderedsequence.test; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public abstract class AbstractUnorderedSequenceTest extends AbstractBuilderTest { private Class rootClass; public AbstractUnorderedSequenceTest(String name, Class rootClass) { super(name); this.rootClass = rootClass; } protected abstract String getCorrectName(); protected abstract String getIncorrectName(); protected abstract void assertResult(T result); protected abstract String getValidationError(); public void testValidXmlWithOrderedBinding() throws Exception { T result = unmarshal(false, getCorrectName()); assertResult(result); } public void testInvalidXmlWithOrderedBinding() throws Exception { try { unmarshal(false, getIncorrectName()); fail(getValidationError()); } catch(JBossXBException e) { JBossXBRuntimeException re = (JBossXBRuntimeException) e.getCause(); assertEquals(getValidationError(), re.getMessage()); } } public void testValidXmlWithUnorderedBinding() throws Exception { T result = unmarshal(true, getCorrectName()); assertResult(result); } public void testInvalidXmlWithUnorderedBinding() throws Exception { T result = unmarshal(true, getIncorrectName()); assertResult(result); } @SuppressWarnings("unchecked") protected T unmarshal(boolean unordered, String fileName) throws Exception { boolean unorderedSequence = JBossXBBuilder.isUseUnorderedSequence(); try { JBossXBBuilder.setUseUnorderedSequence(unordered); SchemaBinding schema = JBossXBBuilder.build(rootClass, true); return (T) unmarshal(fileName, schema); } finally { JBossXBBuilder.setUseUnorderedSequence(unorderedSequence); } } }././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/BasicUnorderedSequenceUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/Basi0000644000175000017500000000414311151050602033301 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.unorderedsequence.test; import org.jboss.test.xml.unorderedsequence.support.RootWithUnorderedSequence; /** * A BasicUnoderedSequenceUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class BasicUnorderedSequenceUnitTestCase extends AbstractUnorderedSequenceTest { public BasicUnorderedSequenceUnitTestCase(String name) { super(name, RootWithUnorderedSequence.class); } @Override protected String getCorrectName() { return "BasicUnorderedSequence_correctAB.xml"; } @Override protected String getIncorrectName() { return "BasicUnorderedSequence_incorrectAB.xml"; } @Override protected String getValidationError() { return "a cannot appear in this position. Expected content of root is sequence: a? b?"; } @Override protected void assertResult(RootWithUnorderedSequence result) { assertEquals("a", result.getA()); assertEquals("b", result.getB()); } } ././@LongLink0000000000000000000000000000022200000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/UnorderedSequenceWithCollectionsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/Unor0000644000175000017500000000727111350426230033360 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.unorderedsequence.test; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.test.xml.unorderedsequence.support.UnorderedSequenceWithCollections; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A UnorderedSequenceWithCollections. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class UnorderedSequenceWithCollectionsUnitTestCase extends AbstractBuilderTest { public UnorderedSequenceWithCollectionsUnitTestCase(String name) { super(name); } public void testBinding() throws Exception { SchemaBinding schema = JBossXBBuilder.build(UnorderedSequenceWithCollections.class, true); ElementBinding root = schema.getElement(new QName("root")); assertNotNull(root); TermBinding term = root.getType().getParticle().getTerm(); assertTrue(term instanceof UnorderedSequenceBinding); UnorderedSequenceBinding group = (UnorderedSequenceBinding) term; Collection particles = group.getParticles(); assertEquals(2, particles.size()); Iterator i = particles.iterator(); ParticleBinding p = i.next(); assertTrue(p.getMaxOccursUnbounded()); term = p.getTerm(); assertTrue(term.isElement()); List names = new ArrayList(2); names.add(term.getQName()); p = i.next(); assertTrue(p.getMaxOccursUnbounded()); term = p.getTerm(); assertTrue(term.isElement()); names.add(term.getQName()); assertTrue(Arrays.asList(new QName("strings"), new QName("ints")).containsAll(names)); } public void testUnmarshalling() throws Exception { UnorderedSequenceWithCollections root = unmarshalObject(UnorderedSequenceWithCollections.class); List strings = root.getStrings(); assertNotNull(strings); assertEquals(4, strings.size()); assertTrue(Arrays.asList(new String[]{"1", "2", "3", "4"}).containsAll(strings)); Integer[] ints = root.getInts(); assertNotNull(ints); assertEquals(4, ints.length); assertEquals(new Integer[]{1, 2, 3, 4}, ints); } } ././@LongLink0000000000000000000000000000020000000000000011555 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/NestedSequenceUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/Nest0000644000175000017500000000452411151050602033337 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.unorderedsequence.test; import org.jboss.test.xml.unorderedsequence.support.OneTwoSequence; import org.jboss.test.xml.unorderedsequence.support.RootWithOneTwoSequence; /** * A NestedSequenceUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class NestedSequenceUnitTestCase extends AbstractUnorderedSequenceTest { public NestedSequenceUnitTestCase(String name) { super(name, RootWithOneTwoSequence.class); } @Override protected String getCorrectName() { return "NestedSequence_correct.xml"; } @Override protected String getIncorrectName() { return "NestedSequence_incorrect.xml"; } @Override protected void assertResult(RootWithOneTwoSequence result) { assertEquals("a", result.getA()); assertEquals("b", result.getB()); assertEquals("c", result.getC()); OneTwoSequence oneTwo = result.getOneTwo(); assertNotNull(oneTwo); assertEquals(1, oneTwo.getOne()); assertEquals(2, oneTwo.getTwo()); } @Override protected String getValidationError() { return "two cannot appear in this position. Expected content of root is sequence: a? {sequence one-two}? b? c?"; } } ././@LongLink0000000000000000000000000000021500000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/UnorderedSequenceAnnotationUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/test/Unor0000644000175000017500000001211011171577572033365 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.unorderedsequence.test; import java.util.Collection; import java.util.Iterator; import javax.xml.bind.annotation.XmlType; import javax.xml.namespace.QName; import org.jboss.test.xb.builder.AbstractBuilderTest; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.builder.JBossXBBuilder; /** * A UnorderedSequenceAnnotationUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class UnorderedSequenceAnnotationUnitTestCase extends AbstractBuilderTest { public UnorderedSequenceAnnotationUnitTestCase(String name) { super(name); } public void testBinding() throws Exception { boolean defaultSequence = JBossXBBuilder.isUseUnorderedSequence(); JBossXBBuilder.setUseUnorderedSequence(false); try { SchemaBinding schema = JBossXBBuilder.build(Root.class); ElementBinding e = schema.getElement(new QName("root")); assertNotNull(e); TermBinding t = e.getType().getParticle().getTerm(); assertTrue(t instanceof SequenceBinding); Collection particles = ((SequenceBinding) t).getParticles(); assertEquals(3, particles.size()); Iterator i = particles.iterator(); t = i.next().getTerm(); assertTrue(t instanceof SequenceBinding); t = i.next().getTerm(); assertTrue(t instanceof SequenceBinding); t = i.next().getTerm(); assertTrue(t instanceof UnorderedSequenceBinding); } finally { JBossXBBuilder.setUseUnorderedSequence(defaultSequence); } } public static class BaseGroup { private String a; private String b; public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } } @JBossXmlModelGroup(name="defaultGroup", propOrder={"a", "b"}) public static class DefaultGroup extends BaseGroup { } @JBossXmlModelGroup(name="orderedSequence", kind = JBossXmlConstants.MODEL_GROUP_SEQUENCE, propOrder={"a", "b"}) public static class OrderedSequence extends BaseGroup { } @JBossXmlModelGroup(name="unorderedSequence", kind = JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE) public static class UnorderedSequence extends BaseGroup { } @XmlType(propOrder={"defaultGroup", "orderedSequence", "unorderedSequence"}) public static class Root { private DefaultGroup defaultGroup; private OrderedSequence orderedSequence; private UnorderedSequence unorderedSequence; public DefaultGroup getDefaultGroup() { return defaultGroup; } public void setDefaultGroup(DefaultGroup defaultGroup) { this.defaultGroup = defaultGroup; } public OrderedSequence getOrderedSequence() { return orderedSequence; } public void setOrderedSequence(OrderedSequence orderedSequence) { this.orderedSequence = orderedSequence; } public UnorderedSequence getUnorderedSequence() { return unorderedSequence; } public void setUnorderedSequence(UnorderedSequence unorderedSequence) { this.unorderedSequence = unorderedSequence; } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/support/0000755000175000017500000000000011620316741033245 5ustar twernertwerner././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/support/RootWithOneTwoSequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/support/R0000644000175000017500000000405311151050602033361 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.unorderedsequence.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A RootWithOneTwoSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"a", "oneTwo", "b", "c"}) public class RootWithOneTwoSequence { private String a; private String b; private String c; private OneTwoSequence oneTwo; public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } public String getC() { return c; } public void setC(String c) { this.c = c; } public OneTwoSequence getOneTwo() { return this.oneTwo; } public void setOneTwo(OneTwoSequence oneTwo) { this.oneTwo = oneTwo; } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/support/RootWithUnorderedSequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/support/R0000644000175000017500000000330011151050602033353 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.unorderedsequence.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * A RootWithUnorderedSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"a", "b"}) public class RootWithUnorderedSequence { private String a; private String b; public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/support/RootWithMiscGroups.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/support/R0000644000175000017500000000720011151050602033356 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.unorderedsequence.support; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; /** * A RootWithMiscGroups. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @XmlType(propOrder={"a", "b", "cde", "fg"}) public class RootWithMiscGroups { private String a; private String b; private CDEChoice cde; private FGSequence fg; public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } public CDEChoice getCde() { return cde; } public void setCde(CDEChoice cde) { this.cde = cde; } public FGSequence getFg() { return fg; } public void setFg(FGSequence fg) { this.fg = fg; } @JBossXmlModelGroup(name="cde", kind=JBossXmlConstants.MODEL_GROUP_CHOICE) public static class CDEChoice { private String c; private DESequence de; public String getC() { return c; } public void setC(String c) { this.c = c; } public DESequence getDe() { return de; } public void setDe(DESequence de) { this.de = de; } } @JBossXmlModelGroup(name="de", kind=JBossXmlConstants.MODEL_GROUP_SEQUENCE, propOrder={"d", "e"}) public static class DESequence { private String d; private String e; public String getD() { return d; } public void setD(String d) { this.d = d; } public String getE() { return e; } public void setE(String e) { this.e = e; } } @JBossXmlModelGroup(name="fg", kind=JBossXmlConstants.MODEL_GROUP_SEQUENCE, propOrder={"f", "g"}) public static class FGSequence { private String f; private String g; public String getF() { return f; } public void setF(String f) { this.f = f; } public String getG() { return g; } public void setG(String g) { this.g = g; } } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/support/OneTwoSequence.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/support/O0000644000175000017500000000335611151050602033363 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.unorderedsequence.support; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; /** * A OneTwoSequence. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @JBossXmlModelGroup(name="one-two", kind=JBossXmlConstants.MODEL_GROUP_SEQUENCE, propOrder={"one", "two"}) public class OneTwoSequence { private int one; private int two; public int getOne() { return one; } public void setOne(int one) { this.one = one; } public int getTwo() { return two; } public void setTwo(int two) { this.two = two; } } ././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/support/UnorderedOrderedMix.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/support/U0000644000175000017500000001051711350256505033401 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.unorderedsequence.support; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlModelGroup; import org.jboss.xb.annotations.JBossXmlType; /** * A UnorderedOrderedMix. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE) public class UnorderedOrderedMix { private List strings = new ArrayList(); private List someSequences = new ArrayList(); private List someChoices = new ArrayList(); private List someBeans = new ArrayList(); @XmlElement(name="string") public List getStrings() { return strings; } public void setStrings(List strings) { throw new UnsupportedOperationException(); } public List getSequences() { return this.someSequences; } public void setSequences(List sequences) { throw new UnsupportedOperationException(); } @XmlElements({ @XmlElement(name="choice1", type=String.class), @XmlElement(name="choice2", type=String.class)}) public List getChoices() { return someChoices; } public void setChoices(List choices) { throw new UnsupportedOperationException(); } @XmlElement(name="bean") public List getBeans() { return someBeans; } public void setBeans(List beans) { throw new UnsupportedOperationException(); } @JBossXmlModelGroup(name="some-sequence", propOrder={"a", "b", "c"}, kind=JBossXmlConstants.MODEL_GROUP_SEQUENCE) public static class SomeSequence { private String a; private String b; private List c = new ArrayList(); public SomeSequence() { } public SomeSequence(String a, String b) { this.a = a; this.b = b; } public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } public List getC() { return Collections.unmodifiableList(c); } public void setC(List c) { this.c = c; } } @XmlType() @JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_SEQUENCE) public static class SomeBean { private List strings; @XmlElement(name="string") public List getStrings() { return Collections.unmodifiableList(strings); } public void setStrings(List strings) { this.strings = strings; } } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/support/UnorderedSequenceWithCollections.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/unorderedsequence/support/U0000644000175000017500000000362411350426230033374 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.unorderedsequence.support; import java.util.List; import javax.xml.bind.annotation.XmlRootElement; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlType; /** * A UnorderedSequenceWithCollections. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root") @JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE) public class UnorderedSequenceWithCollections { private List strings; private Integer[] ints; public List getStrings() { return strings; } public void setStrings(List strings) { this.strings = strings; } public Integer[] getInts() { return ints; } public void setInts(Integer[] ints) { this.ints = ints; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SharedElementUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SharedElementUnitTestCase.j0000644000175000017500000001042111061473704033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.util.Collection; import java.util.Iterator; import javax.xml.namespace.QName; import junit.framework.TestSuite; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; /** * GlobalGroupUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class SharedElementUnitTestCase extends AbstractJBossXBTest { private static final String NS = "http://www.jboss.org/test/xml/sharedElement"; public static final TestSuite suite() { return new TestSuite(SharedElementUnitTestCase.class); } public SharedElementUnitTestCase(String name) { super(name); } public void testSharedElementForwardsAndBackwards() throws Exception { SchemaBinding schema = bind("SharedElement.xsd"); ElementBinding element1 = schema.getElement(new QName(NS, "element1")); assertNotNull(element1); ElementBinding element2 = schema.getElement(new QName(NS, "element2")); assertNotNull(element2); ElementBinding element3 = schema.getElement(new QName(NS, "element3")); assertNotNull(element3); TypeBinding type = element2.getType(); assertNotNull(type); ParticleBinding particle = type.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); assertTrue(term instanceof SequenceBinding); SequenceBinding sequence = (SequenceBinding) term; Collection particles = sequence.getParticles(); assertNotNull(particles); assertEquals(2, particles.size()); Iterator iterator = particles.iterator(); particle = iterator.next(); term = particle.getTerm(); assertTrue(element1 == term); particle = iterator.next(); term = particle.getTerm(); assertTrue(element3 == term); } public void testSharedElementGroupForwardsAndBackwards() throws Exception { SchemaBinding schema = bind("SharedElement.xsd"); ElementBinding element1 = schema.getElement(new QName(NS, "element1")); assertNotNull(element1); ModelGroupBinding group = schema.getGroup(new QName(NS, "globalGroup")); assertNotNull(group); ElementBinding element3 = schema.getElement(new QName(NS, "element3")); assertNotNull(element3); Collection particles = group.getParticles(); assertNotNull(particles); assertEquals(2, particles.size()); Iterator iterator = particles.iterator(); ParticleBinding particle = iterator.next(); TermBinding term = particle.getTerm(); assertTrue(element1 == term); particle = iterator.next(); term = particle.getTerm(); assertTrue(element3 == term); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/0000755000175000017500000000000011620316742030324 5ustar twernertwerner././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanAttributeMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanAttribute0000644000175000017500000001017110513427451033245 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.multispaced; /** * @version $Revision: 37406 $ * @author Alexey Loubyansky */ public class XMBeanAttributeMetaData { private String access; private String getMethod; private String setMethod; private String description; private String name; private String type; public String getAccess() { return access; } public void setAccess(String access) { this.access = access; } public String getGetMethod() { return getMethod; } public void setGetMethod(String getMethod) { this.getMethod = getMethod; } public String getSetMethod() { return setMethod; } public void setSetMethod(String setMethod) { this.setMethod = setMethod; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String toString() { return "[description=" + description + ", access=" + access + ", getMethod=" + getMethod + ", setMethod=" + setMethod + ", name=" + name + ", type=" + type + ']'; } public boolean equals(Object o) { if(this == o) return true; if(!(o instanceof XMBeanAttributeMetaData)) return false; final XMBeanAttributeMetaData mBeanAttributeMetaData = (XMBeanAttributeMetaData)o; if(access != null ? !access.equals(mBeanAttributeMetaData.access) : mBeanAttributeMetaData.access != null) return false; if(description != null ? !description.equals(mBeanAttributeMetaData.description) : mBeanAttributeMetaData.description != null) return false; if(getMethod != null ? !getMethod.equals(mBeanAttributeMetaData.getMethod) : mBeanAttributeMetaData.getMethod != null) return false; if(name != null ? !name.equals(mBeanAttributeMetaData.name) : mBeanAttributeMetaData.name != null) return false; if(setMethod != null ? !setMethod.equals(mBeanAttributeMetaData.setMethod) : mBeanAttributeMetaData.setMethod != null) return false; if(type != null ? !type.equals(mBeanAttributeMetaData.type) : mBeanAttributeMetaData.type != null) return false; return true; } public int hashCode() { int result; result = (access != null ? access.hashCode() : 0); result = 29 * result + (getMethod != null ? getMethod.hashCode() : 0); result = 29 * result + (setMethod != null ? setMethod.hashCode() : 0); result = 29 * result + (description != null ? description.hashCode() : 0); result = 29 * result + (name != null ? name.hashCode() : 0); result = 29 * result + (type != null ? type.hashCode() : 0); return result; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanMetaData.0000644000175000017500000001254611061473704033051 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.multispaced; import java.util.List; import java.util.ArrayList; /** * @version $Revision: 37406 $ * @author Alexey Loubyansky */ public class XMBeanMetaData { private String description; private String mbeanClass; private List constructors = new ArrayList(); private List attributes = new ArrayList(); private List operations = new ArrayList(); private List notifications = new ArrayList(); private Object persistenceManager; public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getMbeanClass() { return mbeanClass; } public void setMbeanClass(String mbeanClass) { this.mbeanClass = mbeanClass; } public List getConstructors() { return constructors; } public void addConstructor(XMBeanConstructorMetaData constructor) { constructors.add(constructor); } public List getAttributes() { return attributes; } public void addAttribute(XMBeanAttributeMetaData attribute) { attributes.add(attribute); } public List getOperations() { return operations; } public void addOperation(XMBeanOperationMetaData operation) { operations.add(operation); } public List getNotifications() { return notifications; } public void addNotification(XMBeanNotificationMetaData notification) { notifications.add(notification); } public Object getPersistenceManager() { return persistenceManager; } public void setPersistenceManager(Object persistenceManager) { this.persistenceManager = persistenceManager; } public String toString() { return "[description=" + description + ", mbeanClass=" + mbeanClass + ", constructors=" + constructors + ", attributes=" + attributes + ", operations=" + operations + ", notifications=" + notifications + ", persistence-manager=" + persistenceManager + ']'; } public boolean equals(Object o) { if(this == o) return true; if(!(o instanceof XMBeanMetaData)) return false; final XMBeanMetaData xmBeanMetaData = (XMBeanMetaData)o; if(attributes != null ? !attributes.equals(xmBeanMetaData.attributes) : xmBeanMetaData.attributes != null) return false; if(constructors != null ? !constructors.equals(xmBeanMetaData.constructors) : xmBeanMetaData.constructors != null) return false; if(description != null ? !description.equals(xmBeanMetaData.description) : xmBeanMetaData.description != null) return false; if(mbeanClass != null ? !mbeanClass.equals(xmBeanMetaData.mbeanClass) : xmBeanMetaData.mbeanClass != null) return false; if(notifications != null ? !notifications.equals(xmBeanMetaData.notifications) : xmBeanMetaData.notifications != null) return false; if(operations != null ? !operations.equals(xmBeanMetaData.operations) : xmBeanMetaData.operations != null) return false; if(persistenceManager != null ? !persistenceManager.equals(xmBeanMetaData.persistenceManager) : xmBeanMetaData.persistenceManager != null) return false; return true; } public int hashCode() { int result; result = (description != null ? description.hashCode() : 0); result = 29 * result + (mbeanClass != null ? mbeanClass.hashCode() : 0); result = 29 * result + (constructors != null ? constructors.hashCode() : 0); result = 29 * result + (attributes != null ? attributes.hashCode() : 0); result = 29 * result + (operations != null ? operations.hashCode() : 0); result = 29 * result + (notifications != null ? notifications.hashCode() : 0); result = 29 * result + (persistenceManager != null ? persistenceManager.hashCode() : 0); return result; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanMetaDataProvider.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanMetaDataP0000644000175000017500000001260210513427451033103 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.multispaced; import org.jboss.xb.binding.MarshallingContext; import org.jboss.xb.binding.ObjectModelProvider; /** * @version $Revision: 37406 $ * @author Alexey Loubyansky */ public class XMBeanMetaDataProvider implements ObjectModelProvider { public static final XMBeanMetaDataProvider INSTANCE = new XMBeanMetaDataProvider(); private XMBeanMetaDataProvider() {} public Object getRoot(Object o, MarshallingContext ctx, String namespaceURI, String localName) { return o; } public Object getChildren(XMBeanMetaData xmbean, String namespaceUri, String localName) { Object children; if("mbean".equals(localName)) { children = xmbean; } else if("constructor".equals(localName)) { children = xmbean.getConstructors(); } else if("attribute".equals(localName)) { children = xmbean.getAttributes(); } else if("operation".equals(localName)) { children = xmbean.getOperations(); } else if("notification".equals(localName)) { children = xmbean.getNotifications(); } else if("persistence".equals(localName)) { children = xmbean.getPersistenceManager(); } else { children = null; } return children; } public Object getElementValue(XMBeanMetaData xmbean, String namespaceUri, String localName) { Object value; if("description".equals(localName)) { value = xmbean.getDescription(); } else if("class".equals(localName)) { value = xmbean.getMbeanClass(); } else { value = null; } return value; } public Object getElementValue(XMBeanConstructorMetaData constructor, String namespaceUri, String localName) { Object value; if("description".equals(localName)) { value = constructor.getDescription(); } else if("name".equals(localName)) { value = constructor.getName(); } else { value = null; } return value; } public Object getAttributeValue(XMBeanAttributeMetaData attribute, String namespaceUri, String localName) { Object value; if("access".equals(localName)) { value = attribute.getAccess(); } else if("getMethod".equals(localName)) { value = attribute.getGetMethod(); } else if("setMethod".equals(localName)) { value = attribute.getSetMethod(); } else { value = null; } return value; } public Object getElementValue(XMBeanAttributeMetaData attribute, String namespaceUri, String localName) { Object value; if("description".equals(localName)) { value = attribute.getDescription(); } else if("name".equals(localName)) { value = attribute.getName(); } else if("type".equals(localName)) { value = attribute.getType(); } else { value = null; } return value; } public Object getElementValue(XMBeanOperationMetaData operation, String namespaceUri, String localName) { Object value; if("description".equals(localName)) { value = operation.getDescription(); } else if("name".equals(localName)) { value = operation.getName(); } else if("return-type".equals(localName)) { value = operation.getReturnType(); } else { value = null; } return value; } public Object getElementValue(XMBeanNotificationMetaData notification, String namespaceUri, String localName) { Object value; if("description".equals(localName)) { value = notification.getDescription(); } else if("name".equals(localName)) { value = notification.getName(); } else if("notification-type".equals(localName)) { value = notification.getNotificationType(); } else { value = null; } return value; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanMetaDataFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanMetaDataF0000644000175000017500000001613310513427451033074 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.multispaced; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.UnmarshallingContext; import org.jboss.test.xml.multispaced.pm.jdbc.JDBCPm; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class XMBeanMetaDataFactory implements ObjectModelFactory { public static final XMBeanMetaDataFactory INSTANCE = new XMBeanMetaDataFactory(); private XMBeanMetaDataFactory() { } public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { return root == null ? new XMBeanMetaData() : root; } public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name) { return root; } public void setValue(XMBeanMetaData xmbean, UnmarshallingContext navigator, String namespaceUri, String localName, String value) { if("description".equals(localName)) { xmbean.setDescription(value); } else if("class".equals(localName)) { xmbean.setMbeanClass(value); } } public Object newChild(XMBeanMetaData xmbean, UnmarshallingContext navigator, String namespaceUri, String localName, Attributes attrs) { Object child; if("constructor".equals(localName)) { child = new XMBeanConstructorMetaData(); } else if("attribute".equals(localName)) { final XMBeanAttributeMetaData attribute = new XMBeanAttributeMetaData(); for(int i = 0; i < attrs.getLength(); ++i) { final String attrName = attrs.getLocalName(i); if("access".equals(attrName)) { attribute.setAccess(attrs.getValue(i)); } else if("getMethod".equals(attrName)) { attribute.setGetMethod(attrs.getValue(i)); } else if("setMethod".equals(attrName)) { attribute.setSetMethod(attrs.getValue(i)); } } child = attribute; } else if("operation".equals(localName)) { child = new XMBeanOperationMetaData(); } else if("notification".equals(localName)) { child = new XMBeanNotificationMetaData(); } else { child = null; } return child; } public void addChild(XMBeanMetaData xmbean, XMBeanConstructorMetaData constructor, UnmarshallingContext navigator, String namespaceURI, String localName) { xmbean.addConstructor(constructor); } public void addChild(XMBeanMetaData xmbean, XMBeanAttributeMetaData attribute, UnmarshallingContext navigator, String namespaceURI, String localName) { xmbean.addAttribute(attribute); } public void addChild(XMBeanMetaData xmbean, XMBeanOperationMetaData operation, UnmarshallingContext navigator, String namespaceURI, String localName) { xmbean.addOperation(operation); } public void addChild(XMBeanMetaData xmbean, XMBeanNotificationMetaData notification, UnmarshallingContext navigator, String namespaceURI, String localName) { xmbean.addNotification(notification); } public void addChild(XMBeanMetaData xmbean, Object pm, UnmarshallingContext navigator, String namespaceURI, String localName) { xmbean.setPersistenceManager(pm); } public void setValue(XMBeanConstructorMetaData constructor, UnmarshallingContext navigator, String namespaceUri, String localName, String value) { if("description".equals(localName)) { constructor.setDescription(value); } else if("name".equals(localName)) { constructor.setName(value); } } public void setValue(XMBeanAttributeMetaData attribute, UnmarshallingContext navigator, String namespaceUri, String localName, String value) { if("description".equals(localName)) { attribute.setDescription(value); } else if("name".equals(localName)) { attribute.setName(value); } else if("type".equals(localName)) { attribute.setType(value); } } public void setValue(XMBeanOperationMetaData operation, UnmarshallingContext navigator, String namespaceUri, String localName, String value) { if("description".equals(localName)) { operation.setDescription(value); } else if("name".equals(localName)) { operation.setName(value); } else if("return-type".equals(localName)) { operation.setReturnType(value); } } public void setValue(XMBeanNotificationMetaData notification, UnmarshallingContext navigator, String namespaceUri, String localName, String value) { if("description".equals(localName)) { notification.setDescription(value); } else if("name".equals(localName)) { notification.setName(value); } else if("notification-type".equals(localName)) { notification.setNotificationType(value); } } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanConstructorMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanConstruct0000644000175000017500000000472310513427451033274 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.multispaced; /** * @version $Revision: 37406 $ * @author Alexey Loubyansky */ public class XMBeanConstructorMetaData { private String description; private String name; public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String toString() { return "[name=" + name + ", description=" + description + ']'; } public boolean equals(Object o) { if(this == o) return true; if(!(o instanceof XMBeanConstructorMetaData)) return false; final XMBeanConstructorMetaData mBeanConstructorMetaData = (XMBeanConstructorMetaData)o; if(description != null ? !description.equals(mBeanConstructorMetaData.description) : mBeanConstructorMetaData.description != null) return false; if(name != null ? !name.equals(mBeanConstructorMetaData.name) : mBeanConstructorMetaData.name != null) return false; return true; } public int hashCode() { int result; result = (description != null ? description.hashCode() : 0); result = 29 * result + (name != null ? name.hashCode() : 0); return result; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanOperationMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanOperation0000644000175000017500000000561610513427451033252 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.multispaced; /** * @version $Revision: 37406 $ * @author Alexey Loubyansky */ public class XMBeanOperationMetaData { private String description; private String name; private String returnType; public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getReturnType() { return returnType; } public void setReturnType(String returnType) { this.returnType = returnType; } public String toString() { return "[name=" + name + ", return-type=" + returnType + ", description=" + description + ']'; } public boolean equals(Object o) { if(this == o) return true; if(!(o instanceof XMBeanOperationMetaData)) return false; final XMBeanOperationMetaData mBeanOperationMetaData = (XMBeanOperationMetaData)o; if(description != null ? !description.equals(mBeanOperationMetaData.description) : mBeanOperationMetaData.description != null) return false; if(name != null ? !name.equals(mBeanOperationMetaData.name) : mBeanOperationMetaData.name != null) return false; if(returnType != null ? !returnType.equals(mBeanOperationMetaData.returnType) : mBeanOperationMetaData.returnType != null) return false; return true; } public int hashCode() { int result; result = (description != null ? description.hashCode() : 0); result = 29 * result + (name != null ? name.hashCode() : 0); result = 29 * result + (returnType != null ? returnType.hashCode() : 0); return result; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/pm/0000755000175000017500000000000011620316742030740 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/pm/jdbc/0000755000175000017500000000000011620316742031642 5ustar twernertwerner././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/pm/jdbc/JDBCPmMetaDataFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/pm/jdbc/JDBCPmM0000644000175000017500000000445610513427451032712 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.multispaced.pm.jdbc; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.UnmarshallingContext; import org.jboss.test.xml.multispaced.XMBeanMetaData; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class JDBCPmMetaDataFactory implements ObjectModelFactory { public static final JDBCPmMetaDataFactory INSTANCE = new JDBCPmMetaDataFactory(); private JDBCPmMetaDataFactory() { } public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { return new JDBCPm(); } public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String name) { return root; } public void setValue(JDBCPm pm, UnmarshallingContext navigator, String namespaceUri, String localName, String value) { if("datasource".equals(localName)) { pm.setDatasource(value); } else if("table".equals(localName)) { pm.setTable(value); } } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/pm/jdbc/JDBCPm.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/pm/jdbc/JDBCPm.0000644000175000017500000000446510513427451032653 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.multispaced.pm.jdbc; /** * @version $Revision: 37406 $ * @author Alexey Loubyansky */ public class JDBCPm { private String datasource; private String table; public String getDatasource() { return datasource; } public void setDatasource(String datasource) { this.datasource = datasource; } public String getTable() { return table; } public void setTable(String table) { this.table = table; } public String toString() { return "[datasource=" + datasource + ", table=" + table + ']'; } public boolean equals(Object o) { if(this == o) return true; if(!(o instanceof JDBCPm)) return false; final JDBCPm jdbcPm = (JDBCPm)o; if(datasource != null ? !datasource.equals(jdbcPm.datasource) : jdbcPm.datasource != null) return false; if(table != null ? !table.equals(jdbcPm.table) : jdbcPm.table != null) return false; return true; } public int hashCode() { int result; result = (datasource != null ? datasource.hashCode() : 0); result = 29 * result + (table != null ? table.hashCode() : 0); return result; } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/pm/jdbc/JDBCPmMetaDataProvider.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/pm/jdbc/JDBCPmM0000644000175000017500000000457210513427451032711 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.multispaced.pm.jdbc; import org.jboss.xb.binding.MarshallingContext; import org.jboss.xb.binding.ObjectModelProvider; import org.jboss.logging.Logger; /** * @version $Revision: 37406 $ * @author Alexey Loubyansky */ public class JDBCPmMetaDataProvider implements ObjectModelProvider { private static final Logger log = Logger.getLogger(JDBCPmMetaDataFactory.class); private final JDBCPm pm; public JDBCPmMetaDataProvider(JDBCPm pm) { this.pm = pm; } public Object getRoot(Object o, MarshallingContext ctx, String namespaceURI, String localName) { log.debug("getRoot(): o=" + o.getClass()); return pm; } public Object getChildren(JDBCPm pm, String namespaceUri, String localName) { log.debug("getChildren> ns=" + namespaceUri + ", localName=" + localName); return null; } public Object getElementValue(JDBCPm pm, String namespaceUri, String localName) { log.debug("getValue> ns=" + namespaceUri + ", localName=" + localName); Object child = null; if("datasource".equals(localName)) { child = pm.getDatasource(); } else if("table".equals(localName)) { child = pm.getTable(); } return child; } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanNotificationMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/multispaced/XMBeanNotificat0000644000175000017500000000601110513427451033220 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.multispaced; /** * @version $Revision: 37406 $ * @author Alexey Loubyansky */ public class XMBeanNotificationMetaData { private String description; private String name; private String notificationType; public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getNotificationType() { return notificationType; } public void setNotificationType(String notificationType) { this.notificationType = notificationType; } public String toString() { return "[name=" + name + ", notification-type=" + notificationType + ", description=" + description + ']'; } public boolean equals(Object o) { if(this == o) return true; if(!(o instanceof XMBeanNotificationMetaData)) return false; final XMBeanNotificationMetaData mBeanNotificationMetaData = (XMBeanNotificationMetaData)o; if(description != null ? !description.equals(mBeanNotificationMetaData.description) : mBeanNotificationMetaData.description != null) return false; if(name != null ? !name.equals(mBeanNotificationMetaData.name) : mBeanNotificationMetaData.name != null) return false; if(notificationType != null ? !notificationType.equals(mBeanNotificationMetaData.notificationType) : mBeanNotificationMetaData.notificationType != null) return false; return true; } public int hashCode() { int result; result = (description != null ? description.hashCode() : 0); result = 29 * result + (name != null ? name.hashCode() : 0); result = 29 * result + (notificationType != null ? notificationType.hashCode() : 0); return result; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/sandbox/0000755000175000017500000000000011620316741027447 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/sandbox/Choice3.java0000644000175000017500000000564311061473704031601 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.sandbox; import java.util.Collection; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Choice3 { private Collection listOfIntegers; private Collection listOfStrings; public Choice3() { } public Choice3(Collection listOfIntegers, Collection listOfStrings) { this.listOfIntegers = listOfIntegers; this.listOfStrings = listOfStrings; } public Collection getListOfIntegers() { return listOfIntegers; } public void setListOfIntegers(Collection listOfIntegers) { this.listOfIntegers = listOfIntegers; } public Collection getListOfStrings() { return listOfStrings; } public void setListOfStrings(Collection listOfStrings) { this.listOfStrings = listOfStrings; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Choice3)) { return false; } final Choice3 choice3 = (Choice3)o; if(listOfIntegers != null ? !listOfIntegers.equals(choice3.listOfIntegers) : choice3.listOfIntegers != null) { return false; } if(listOfStrings != null ? !listOfStrings.equals(choice3.listOfStrings) : choice3.listOfStrings != null) { return false; } return true; } public int hashCode() { int result; result = (listOfIntegers != null ? listOfIntegers.hashCode() : 0); result = 29 * result + (listOfStrings != null ? listOfStrings.hashCode() : 0); return result; } public String toString() { return "[listOfIntegers=" + listOfIntegers + ", listOfStrigns=" + listOfStrings + "]"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/sandbox/Root.java0000644000175000017500000000606111061473704031242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.sandbox; import java.util.Collection; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Root { private Collection choiceCollection1; private Collection choice2; private Collection choice3; public Collection getChoice3() { return choice3; } public void setChoice3(Collection choice3) { this.choice3 = choice3; } public Collection getChoiceCollection1() { return choiceCollection1; } public void setChoiceCollection1(Collection choiceCollection1) { this.choiceCollection1 = choiceCollection1; } public Collection getChoice2() { return choice2; } public void setChoice2(Collection choice2) { this.choice2 = choice2; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Root)) { return false; } final Root root = (Root)o; if(choice2 != null ? !choice2.equals(root.choice2) : root.choice2 != null) { return false; } if(choice3 != null ? !choice3.equals(root.choice3) : root.choice3 != null) { return false; } if(choiceCollection1 != null ? !choiceCollection1.equals(root.choiceCollection1) : root.choiceCollection1 != null) { return false; } return true; } public int hashCode() { int result; result = (choiceCollection1 != null ? choiceCollection1.hashCode() : 0); result = 29 * result + (choice2 != null ? choice2.hashCode() : 0); result = 29 * result + (choice3 != null ? choice3.hashCode() : 0); return result; } public String toString() { return "[choiceCollection1=" + choiceCollection1 + ", choice2=" + choice2 + ", choice3=" + choice3 + "]"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/sandbox/Choice2.java0000644000175000017500000000527510513427451031600 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.sandbox; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Choice2 { private String c; private String d; private String e; public Choice2() { } public Choice2(String c, String d, String e) { this.c = c; this.d = d; this.e = e; } public String getC() { return c; } public void setC(String c) { this.c = c; } public String getD() { return d; } public void setD(String d) { this.d = d; } public String getE() { return e; } public void setE(String e) { this.e = e; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Choice2)) { return false; } final Choice2 choice2 = (Choice2)o; if(c != null ? !c.equals(choice2.c) : choice2.c != null) { return false; } if(d != null ? !d.equals(choice2.d) : choice2.d != null) { return false; } if(e != null ? !e.equals(choice2.e) : choice2.e != null) { return false; } return true; } public int hashCode() { int result; result = (c != null ? c.hashCode() : 0); result = 29 * result + (d != null ? d.hashCode() : 0); result = 29 * result + (e != null ? e.hashCode() : 0); return result; } public String toString() { return "[c=" + c + ", d=" + d + ", e=" + e + "]"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/sandbox/Choice1.java0000644000175000017500000000453510513427451031575 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.sandbox; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Choice1 { private String a; private String b; public Choice1() { } public Choice1(String a, String b) { this.a = a; this.b = b; } public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Choice1)) { return false; } final Choice1 choice1 = (Choice1)o; if(a != null ? !a.equals(choice1.a) : choice1.a != null) { return false; } if(b != null ? !b.equals(choice1.b) : choice1.b != null) { return false; } return true; } public int hashCode() { int result; result = (a != null ? a.hashCode() : 0); result = 29 * result + (b != null ? b.hashCode() : 0); return result; } public String toString() { return "[a=" + a + ", b=" + b + "]"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/choice/0000755000175000017500000000000011620316735027246 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/choice/Root.java0000644000175000017500000000474511061473704031045 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.choice; import java.util.Collection; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Root { private Collection choice1; private Collection choice2; public Collection getChoice1() { return choice1; } public void setChoice1(Collection choice1) { this.choice1 = choice1; } public Collection getChoice2() { return choice2; } public void setChoice2(Collection choice2) { this.choice2 = choice2; } public String toString() { return "[choice1=" + choice1 + ", choice2=" + choice2 + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Root)) { return false; } final Root root = (Root)o; if(choice1 != null ? !choice1.equals(root.choice1) : root.choice1 != null) { return false; } if(choice2 != null ? !choice2.equals(root.choice2) : root.choice2 != null) { return false; } return true; } public int hashCode() { int result; result = (choice1 != null ? choice1.hashCode() : 0); result = 29 * result + (choice2 != null ? choice2.hashCode() : 0); return result; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/choice/Choice2.java0000644000175000017500000000527410513427451031373 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.choice; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Choice2 { private String a; private String b; private String c; public Choice2() { } public Choice2(String a, String b, String c) { this.a = a; this.b = b; this.c = c; } public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } public String getC() { return c; } public void setC(String c) { this.c = c; } public String toString() { return "[a=" + a + ", b=" + b + ", c=" + c + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Choice2)) { return false; } final Choice2 choice2 = (Choice2)o; if(a != null ? !a.equals(choice2.a) : choice2.a != null) { return false; } if(b != null ? !b.equals(choice2.b) : choice2.b != null) { return false; } if(c != null ? !c.equals(choice2.c) : choice2.c != null) { return false; } return true; } public int hashCode() { int result; result = (a != null ? a.hashCode() : 0); result = 29 * result + (b != null ? b.hashCode() : 0); result = 29 * result + (c != null ? c.hashCode() : 0); return result; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/choice/Choice1.java0000644000175000017500000000453410513427451031370 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.choice; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Choice1 { private String a; private String b; public Choice1() { } public Choice1(String a, String b) { this.a = a; this.b = b; } public String getA() { return a; } public void setA(String a) { this.a = a; } public String getB() { return b; } public void setB(String b) { this.b = b; } public String toString() { return "[a=" + a + ", b=" + b + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Choice1)) { return false; } final Choice1 choice1 = (Choice1)o; if(a != null ? !a.equals(choice1.a) : choice1.a != null) { return false; } if(b != null ? !b.equals(choice1.b) : choice1.b != null) { return false; } return true; } public int hashCode() { int result; result = (a != null ? a.hashCode() : 0); result = 29 * result + (b != null ? b.hashCode() : 0); return result; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/XmlDiff.java0000644000175000017500000005065611061473704030223 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.util.ArrayList; import java.util.Collections; import java.util.List; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.jboss.xb.binding.Constants; /** * @author Alexey Loubyansky * @version $Revision: 45494 $ */ public class XmlDiff { public static final ErrorHandler ERROR_HANDLER = new DefErrorHandler(); public static final byte PRINT_ELEMENT = 0; public static final byte PRINT_PARENT = 1; public static final byte PRINT_ALL = 2; private static final DocumentBuilderFactory FACTORY = DocumentBuilderFactory.newInstance(); static { FACTORY.setNamespaceAware(true); FACTORY.setValidating(true); } private static final String INDENT = " "; public static void main(String[] args) throws Exception { String xml1 = "\n" + " \n" + " child2_val\n" + " \n" + " text\n" + ""; String xml2 = "text" + " " + " child2_val" + " " + ""; System.out.println(new XmlDiff().diff(xml1, xml2)); } public XmlDiff() { this(PRINT_ALL, true); } public XmlDiff(byte print, boolean reformat) { this.print = print; this.reformat = reformat; } private byte print = PRINT_ALL; private boolean reformat = true; public byte getPrint() { return print; } public void setPrint(byte print) { this.print = print; } public boolean isReformat() { return reformat; } public void setReformat(boolean reformat) { this.reformat = reformat; } /** * Compares two XML contents and returns a diff if they are different or null if they are equal. * * @param expected expected XML content * @param was actual XML content * @return difference between XML contents or null if the contents are equal */ public String diff(String expected, String was) { return diff(expected, was, ERROR_HANDLER, null); } public String diff(String expected, String was, ErrorHandler eh) { return diff(expected, was, eh, null); } public String diff(String expected, String was, EntityResolver er) { return diff(expected, was, ERROR_HANDLER, er); } public String diff(String expected, String was, ErrorHandler eh, EntityResolver er) { DocumentBuilder documentBuilder = null; try { documentBuilder = FACTORY.newDocumentBuilder(); } catch(ParserConfigurationException e) { throw new IllegalStateException("Failed to create a document builder: " + e.getMessage()); } if(eh != null) { documentBuilder.setErrorHandler(eh); } if(er != null) { documentBuilder.setEntityResolver(er); } Document expDoc = null; try { expDoc = documentBuilder.parse(new InputSource(new StringReader(expected))); } catch(Exception e) { throw new IllegalStateException("Failed to parse expected XML\n" + expected + ": " + e.getMessage()); } Document wasDoc = null; try { wasDoc = documentBuilder.parse(new InputSource(new StringReader(was))); } catch(Exception e) { throw new IllegalStateException("Failed to parse XML\n" + was + ": " + e.getMessage()); } Element expElement = expDoc.getDocumentElement(); Element wasElement = wasDoc.getDocumentElement(); return assertEquals(expElement, wasElement, expElement, wasElement); } private String assertEquals(Element exp, Element was, Element printAsExp, Element printAsWas) { QName expName = new QName(exp.getNamespaceURI(), exp.getLocalName()); QName wasName = new QName(was.getNamespaceURI(), was.getLocalName()); if(!expName.equals(wasName)) { return fail("Expected name " + expName + " but was " + wasName, exp, was); } NamedNodeMap expAttrs = exp.getAttributes(); NamedNodeMap wasAttrs = was.getAttributes(); if(expAttrs == null && wasAttrs != null && hasNonIgnorableNs(wasAttrs)) { return fail("Element " + expName + " doesn't have attributes", printAsExp, printAsWas); } else if(wasAttrs == null && expAttrs != null && hasNonIgnorableNs(expAttrs)) { return fail("Element " + expName + " has attributes", printAsExp, printAsWas); } else if(expAttrs != null && wasAttrs != null) { String msg = assertAttrs(expAttrs, wasAttrs, printAsExp); if(msg != null) { return fail(msg, printAsExp, printAsWas); } } NodeList expChildren = exp.getChildNodes(); NodeList wasChildren = was.getChildNodes(); NodeList expTexts = getTextNodes(expChildren); NodeList wasTexts = getTextNodes(wasChildren); if(expTexts.getLength() > 0 && wasTexts.getLength() == 0) { return fail("Element " + expName + " has text content", printAsExp, printAsWas); } else if(expTexts.getLength() == 0 && wasTexts.getLength() > 0) { return fail("Element " + expName + " doesn't have text content", printAsExp, printAsWas); } // todo: should text content be concatenated before comparison? else if(expTexts.getLength() != wasTexts.getLength()) { return fail( "Element " + expName + " has " + expTexts.getLength() + " text nodes (was " + wasTexts.getLength() + ")", printAsExp, printAsWas ); } else if(expTexts.getLength() > 0 && wasTexts.getLength() > 0) { for(int i = 0; i < expTexts.getLength(); ++i) { Text text = (Text)expTexts.item(i); if(!containsText(text.getNodeValue(), wasTexts, i)) { return fail("Element " + expName + " has text '" + text.getNodeValue() + "'", printAsExp, printAsWas); } } } NodeList expElems = sublist(expChildren, Node.ELEMENT_NODE); NodeList wasElems = sublist(wasChildren, Node.ELEMENT_NODE); if(expElems.getLength() > 0 && wasElems.getLength() == 0) { return fail("Element " + expName + " has child elements", printAsExp, printAsWas); } else if(expElems.getLength() == 0 && wasElems.getLength() > 0) { return fail("Element " + expName + " doesn't have child elements", printAsExp, printAsWas); } else if(expElems.getLength() != wasElems.getLength()) { return fail("Element " + expName + " has " + expElems.getLength() + " child elements (was " + wasElems.getLength() + ")", printAsExp, printAsWas ); } else if(expElems.getLength() > 0 && wasElems.getLength() > 0) { if(print == PRINT_PARENT) { printAsExp = exp; printAsWas = was; } for(int i = 0; i < expElems.getLength(); ++i) { Element expChild = (Element)expElems.item(i); Element wasChild = getElement(expChild.getNamespaceURI(), expChild.getLocalName(), wasElems, i); if(wasChild == null) { return fail("Element " + expName + " has child element " + new QName(expChild.getNamespaceURI(), expChild.getLocalName()), printAsExp, printAsWas ); } if(print == PRINT_ELEMENT) { printAsExp = expChild; printAsWas = wasChild; } String diff = assertEquals(expChild, wasChild, printAsExp, printAsWas); if(diff != null) { return diff; } } } return null; } private static Element getElement(String ns, String local, NodeList elements, int suggestedIndex) { if(suggestedIndex >= 0 && suggestedIndex < elements.getLength()) { Element element = (Element)elements.item(suggestedIndex); if((ns == null && element.getNamespaceURI() == null || ns != null && ns.equals(element.getNamespaceURI()) ) && local.equals(element.getLocalName())) { return element; } } for(int i = 0; i < elements.getLength(); ++i) { Element element = (Element)elements.item(i); if((ns == null && element.getNamespaceURI() == null || ns != null && ns.equals(element.getNamespaceURI()) ) && local.equals(element.getLocalName())) { return element; } } return null; } private static boolean containsText(String text, NodeList textNodes, int suggestedIndex) { text = text.trim(); if(suggestedIndex >= 0) { Text textNode = (Text)textNodes.item(suggestedIndex); String wasText = textNode.getNodeValue().trim(); if(text.equals(wasText)) { return true; } } for(int i = 0; i < textNodes.getLength(); ++i) { Text textNode = (Text)textNodes.item(i); String wasText = textNode.getNodeValue().trim(); if(text.equals(wasText)) { return true; } } return false; } private static NodeList getTextNodes(NodeList list) { MutableNodeList result = new MutableNodeList(); for(int i = 0; i < list.getLength(); ++i) { Node node = list.item(i); if(node.getNodeType() == Node.TEXT_NODE) { String text = node.getNodeValue(); if(text.trim().length() > 0) { result.add(node); } } } return result; } private static NodeList sublist(NodeList list, short nodeType) { MutableNodeList result = new MutableNodeList(); for(int i = 0; i < list.getLength(); ++i) { Node node = list.item(i); if(node.getNodeType() == nodeType) { result.add(node); } } return result; } private static String assertAttrs(NamedNodeMap attrsExp, NamedNodeMap attrsWas, Element printAsExp) { String result = assertSubset(attrsExp, attrsWas, printAsExp, true); if(result == null) { result = assertSubset(attrsWas, attrsExp, printAsExp, false); } return result; } private static String assertSubset(NamedNodeMap attrsSubset, NamedNodeMap attrsSet, Element printAsExp, boolean checkHave) { String msg = checkHave ? " has attribute " : " doesn't have attribute "; QName expName = new QName(printAsExp.getNamespaceURI(), printAsExp.getLocalName()); for(int i = 0; i < attrsSubset.getLength(); ++i) { Attr attr = (Attr)attrsSubset.item(i); String attrNs = attr.getNamespaceURI(); String localName = attr.getLocalName(); if(xsiNs(attrNs) && "type".equals(localName)) { Attr wasAttr = (Attr)attrsSet.getNamedItemNS(attrNs, localName); if(wasAttr == null) { return "Element " + expName + msg + new QName(attrNs, localName); } String typeName = attr.getValue(); int colon = typeName.indexOf(':'); if(colon != -1) { typeName = typeName.substring(colon); } if(!wasAttr.getValue().endsWith(typeName)) { return "Element " + expName + (checkHave ? " has xsi:type " : " doesn't have xsi:type ") + attr.getValue(); } //todo compare namespaces for xsi:types } else if(nonIgnorableNs(attrNs) || xsiNs(attrNs) && localName.equals("nil")) { Attr wasAttr = (Attr)attrsSet.getNamedItemNS(attrNs, localName); if(wasAttr == null) { return "Element " + expName + msg + new QName(attrNs, localName); } if(!attr.getValue().equals(wasAttr.getValue())) { return "Attribute " + new QName(attrNs, localName) + " in element " + expName + " has value " + attr.getValue(); } } } return null; } private static boolean hasNonIgnorableNs(NamedNodeMap nodeMap) { for(int i = 0; i < nodeMap.getLength(); ++i) { Node node = nodeMap.item(i); if(nonIgnorableNs(node.getNamespaceURI())) { return true; } } return false; } private static boolean nonIgnorableNs(String ns) { return ns == null || !ns.equals(Constants.NS_XML_SCHEMA) && !ns.equals(Constants.NS_XML_SCHEMA_INSTANCE) && !ns.equals(Constants.NS_XML_XMLNS); } private static boolean xsiNs(String ns) { return Constants.NS_XML_SCHEMA_INSTANCE.equals(ns); } private String fail(String msg, Element exp, Element was) { return msg + ". Expected\n" + toString(exp) + "\nbut was\n" + toString(was); } private String toString(Element e) { return append(e, new StringBuffer(), 0).toString(); } private StringBuffer append(Element e, StringBuffer buf, int depth) { if(reformat && depth > 0) { buf.append('\n'); for(int i = 0; i < depth; ++i) { buf.append(INDENT); } } buf.append('<'); if(e.getPrefix() != null && e.getPrefix().length() > 0) { buf.append(e.getPrefix()).append(':'); } buf.append(e.getLocalName()); NamedNodeMap attrs = e.getAttributes(); if(attrs != null && attrs.getLength() > 0) { for(int i = 0; i < attrs.getLength(); ++i) { Attr attr = (Attr)attrs.item(i); buf.append(' ') .append(attr.getName()) .append('=') .append('\'') .append(attr.getValue()) .append('\''); } } buf.append('>'); NodeList childNodes = e.getChildNodes(); boolean childElements = false; for(int i = 0; i < childNodes.getLength(); ++i) { Node child = childNodes.item(i); switch(child.getNodeType()) { case Node.TEXT_NODE: String chars = child.getNodeValue(); if(chars.trim().length() > 0) { buf.append(chars); } break; case Node.ELEMENT_NODE: append((Element)child, buf, depth + 1); childElements = true; break; default: throw new IllegalStateException("Node type is not supported: " + child.getNodeType()); } } if(reformat && childElements) { buf.append('\n'); for(int i = 0; i < depth; ++i) { buf.append(INDENT); } } buf.append(" 0) { buf.append(e.getPrefix()).append(':'); } buf.append(e.getLocalName()) .append('>'); return buf; } // Inner private static final class MutableNodeList implements NodeList { private List list = Collections.emptyList(); public void add(Node node) { switch(list.size()) { case 0: list = Collections.singletonList(node); break; case 1: list = new ArrayList(list); default: list.add(node); } } public int getLength() { return list.size(); } public Node item(int index) { return (Node)list.get(index); } } public static final class DefErrorHandler implements ErrorHandler { public static final byte IGNORE = 0; public static final byte LOG = 1; public static final byte FAIL = 3; private byte warnEvent = IGNORE; private byte errorEvent = IGNORE; private byte fatalEvent = FAIL; public void error(SAXParseException e) throws SAXException { handleEvent(warnEvent, e); } public void fatalError(SAXParseException e) throws SAXException { handleEvent(errorEvent, e); } public void warning(SAXParseException e) throws SAXException { handleEvent(fatalEvent, e); } private void handleEvent(byte event, SAXParseException e) throws SAXException { switch(event) { case IGNORE: break; case LOG: System.out.println(formatMessage(e)); break; case FAIL: String msg = formatMessage(e); throw new SAXException(msg); } } } private static String formatMessage(SAXParseException exception) { StringBuffer buffer = new StringBuffer(50); buffer.append(exception.getMessage()).append(" @ "); String location = exception.getPublicId(); if(location != null) { buffer.append(location); } else { location = exception.getSystemId(); if(location != null) { buffer.append(location); } else { buffer.append("*unknown*"); } } buffer.append('['); buffer.append(exception.getLineNumber()).append(','); buffer.append(exception.getColumnNumber()).append(']'); return buffer.toString(); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/naming/0000755000175000017500000000000011620316740027261 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/naming/JNDIBindings.java0000644000175000017500000000265311357571642032347 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.naming; /** * A collection of JNDI bindings * * @author Scott.Stark@jboss.org * @version $Revision: 81030 $ */ public class JNDIBindings { private JNDIBinding[] bindings; public JNDIBinding[] getBindings() { return bindings; } public void setBindings(JNDIBinding[] bindings) { this.bindings = bindings; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/naming/JNDIBinding.java0000644000175000017500000001163211357571642032161 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.naming; import java.beans.PropertyEditor; import org.jboss.util.propertyeditor.PropertyEditors; /** * A representation of a binding into JNDI. * * @author Scott.Stark@jboss.org * @version $Revision: 81030 $ */ public class JNDIBinding { /** The jndi name to bind under */ private String name; /** The binding text */ private String text; /** The optional binding type the text should be converted to */ private String type; /** The optional explicit PropertyEditor implementation class */ private String editor; /** The actual binding value */ private Object value; /** A flag indicating if the text should be trimmed */ private boolean trim; /** * The JNDI name to bind under * @return */ public String getName() { return name; } public void setName(String name) { this.name = name; } /** * The text representation of the binding * @return */ public String getText() { return text; } /** * Set the text representation of the binding. If the replace attribute * is true, the text will be searched for system property references of the * form ${x}. * * @param text */ public void setText(String text) { if( trim == true ) text = text.trim(); this.text = text; } /** * The optional type the text representation should be converted to. * * @return */ public String getType() { return type; } /** * * @param type - type the text representation should be converted to. */ public void setType(String type) { this.type = type; } /** * The optional PropertyEditor implementation class name. * @return */ public String getEditor() { return editor; } /** * * @param editor - the optional PropertyEditor implementation class name. */ public void setEditor(String editor) { this.editor = editor; } /** * Object the binding value. If there is a binding from an external xml * fragment it will be whatever that was. If there is a type it will be the * value as obtained by converting the text of the value element to an object * using the type PropertyEditor. If there is an explicit PropertyEditor * given by the editor attribute that will be used to convert the text into * an object. * * @return the value binding * @throws Exception - on failure to load/use the PropertyEditor */ public Object getValue() throws Exception { if( value == null && text != null ) { // If there is a property editor set, transform text to value if( editor != null ) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); Class editorClass = loader.loadClass(editor); PropertyEditor pe = (PropertyEditor) editorClass.newInstance(); pe.setAsText(text); value = pe.getValue(); } else if( type != null ) { PropertyEditor pe = PropertyEditors.getEditor(type); pe.setAsText(text); value = pe.getValue(); } else { value = text; } } return value; } /** * Set the raw value binding * @param value */ public void setValue(Object value) { this.value = value; } /** * * @return flag indicating if the text should be trimmed */ public boolean isTrim() { return trim; } /** * * @param trim - flag indicating if the text should be trimmed */ public void setTrim(boolean trim) { this.trim = trim; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/GlobalGroupUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/GlobalGroupUnitTestCase.jav0000644000175000017500000001321111326355033033222 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.util.ArrayList; import java.util.Collection; import javax.xml.namespace.QName; import junit.framework.TestSuite; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; /** * GlobalGroupUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class GlobalGroupUnitTestCase extends AbstractJBossXBTest { private static final String NS = "http://www.jboss.org/test/xml/globalGroup"; public static final TestSuite suite() { return new TestSuite(GlobalGroupUnitTestCase.class); } public GlobalGroupUnitTestCase(String name) { super(name); } public void testGlobalGroup() throws Exception { SchemaBinding schema = bind("GlobalGroup.xsd"); ModelGroupBinding group = schema.getGroup(new QName(NS, "global1")); assertNotNull(group); ElementBinding element = schema.getElement(new QName(NS, "parent")); assertNotNull(element); TypeBinding type = element.getType(); assertNotNull(type); ParticleBinding particle = type.getParticle(); assertNotNull(particle); TermBinding term = particle.getTerm(); assertNotNull(term); assertTrue(term instanceof SequenceBinding); SequenceBinding sequence = (SequenceBinding) term; Collection particles = sequence.getParticles(); assertNotNull(particles); assertEquals(1, particles.size()); particle = particles.iterator().next(); term = particle.getTerm(); assertTrue(group == term); } public void testGlobalGroupForwardsAndBackwardsRefs() throws Exception { SchemaBinding schema = bind("GlobalGroup.xsd"); ModelGroupBinding group2 = schema.getGroup(new QName(NS, "global2")); assertNotNull(group2); ModelGroupBinding group3 = schema.getGroup(new QName(NS, "global3")); assertNotNull(group3); ModelGroupBinding group4 = schema.getGroup(new QName(NS, "global4")); assertNotNull(group4); // Forwards Collection particles = group2.getParticles(); assertNotNull(particles); assertEquals(1, particles.size()); ParticleBinding particle = particles.iterator().next(); TermBinding term = particle.getTerm(); assertTrue(term == group3); // Backwards particles = group4.getParticles(); assertNotNull(particles); assertEquals(1, particles.size()); particle = particles.iterator().next(); term = particle.getTerm(); assertTrue(term == group3); } public void testGlobalGroupSchemaBindingModel() throws Exception { SchemaBinding schema = bind("GlobalGroup.xsd"); schema.setIgnoreUnresolvedFieldOrClass(false); ClassMetaData classMetaData = new ClassMetaData(); classMetaData.setImpl(Parent.class.getName()); ElementBinding element = schema.getElement(new QName(NS, "parent")); assertNotNull(element); element.setClassMetaData(classMetaData); classMetaData = new ClassMetaData(); classMetaData.setImpl(Global1.class.getName()); ModelGroupBinding group = schema.getGroup(new QName(NS, "global1")); assertNotNull(group); group.setClassMetaData(classMetaData); group.setSkip(false); // TODO should be able to determine this from the global group name! PropertyMetaData prop = new PropertyMetaData(); prop.setName("global1"); group.setPropertyMetaData(prop); Parent parent = (Parent) unmarshal("GlobalGroup.xml", schema, Parent.class); assertNotNull(parent.global1); assertEquals(2, parent.global1.child.size()); ArrayList expected = new ArrayList(); expected.add("Hello"); expected.add("Goodbye"); assertEquals(expected, parent.global1.child); } public static class Parent { public Global1 global1; } public static class Global1 { public Collection child = new ArrayList(); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/0000755000175000017500000000000011620316742026737 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/defaults/0000755000175000017500000000000011620316742030546 5ustar twernertwerner././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/defaults/DefaultsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/defaults/DefaultsUnitT0000644000175000017500000000654310513427451033234 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.jbxb.defaults; import java.io.InputStream; import java.io.IOException; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import junit.framework.TestCase; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public class DefaultsUnitTestCase extends TestCase { public void testSchema1() throws Exception { InputStream xsd = getResource("xml/jbxb/defaults/schema1.xsd"); SchemaBinding schemaBinding = XsdBinder.bind(xsd, "UTF-8"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); InputStream is = getResource("xml/jbxb/defaults/testSchema1.xml"); JBean bean = (JBean) unmarshaller.unmarshal(is, schemaBinding); is.close(); int attr2 = bean.getAttr2(); assertEquals("JBean.Attr2("+attr2+") == 123", 123, attr2); String attr1 = bean.getAttr1(); assertEquals("JBean.Attr1("+attr1+") == DefaultVaue", "DefaultValue", attr1); boolean attr3 = bean.getAttr3(); assertEquals("JBean.Attr3("+attr3+") == true", true, attr3); } public void testSchema2() throws Exception { InputStream xsd = getResource("xml/jbxb/defaults/schema2.xsd"); SchemaBinding schemaBinding = XsdBinder.bind(xsd, "UTF-8"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); InputStream is = getResource("xml/jbxb/defaults/testSchema2.xml"); JBean bean = (JBean) unmarshaller.unmarshal(is, schemaBinding); is.close(); int attr2 = bean.getAttr2(); assertEquals("JBean.Attr2("+attr2+") == 123", 123, attr2); String attr1 = bean.getAttr1(); assertEquals("JBean.Attr1("+attr1+") == DefaultVaue", "DefaultValue", attr1); boolean attr3 = bean.getAttr3(); assertEquals("JBean.Attr3("+attr3+") == true", true, attr3); } private InputStream getResource(String path) throws IOException { java.net.URL url = Thread.currentThread().getContextClassLoader().getResource(path); if(url == null) { fail("URL not found: " + path); } return url.openStream(); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/defaults/JBean.java0000644000175000017500000000324410513427451032373 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.jbxb.defaults; /** * @author Scott.Stark@jboss.org * @version $Revision: 37406 $ */ public class JBean { private String attr1; private int attr2; private boolean attr3; public String getAttr1() { return attr1; } public void setAttr1(String attr1) { this.attr1 = attr1; } public int getAttr2() { return attr2; } public void setAttr2(int attr2) { this.attr2 = attr2; } public boolean getAttr3() { return attr3; } public void setAttr3(boolean attr3) { this.attr3 = attr3; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/minOccurs/0000755000175000017500000000000011620316742030701 5ustar twernertwerner././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/minOccurs/Schema1UnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/minOccurs/Schema1UnitT0000644000175000017500000000521411154172516033074 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.jbxb.minOccurs; import java.net.URL; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.test.xml.AbstractJBossXBTest; /** * @author Scott.Stark@jboss.org * @version $Revision: 41759 $ */ public class Schema1UnitTestCase extends AbstractJBossXBTest { public Schema1UnitTestCase(String name) { super(name); } public void testSchema1() throws Exception { ClassLoader loader = Thread.currentThread().getContextClassLoader(); MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); resolver.mapSchemaLocation("urn:jboss:jbxb-minOccurs-schema1", "xml/jbxb/minOccurs/schema1.xsd"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); URL testSchema1 = loader.getResource("xml/jbxb/minOccurs/testSchema1.xml"); Object root = unmarshaller.unmarshal(testSchema1.toString(), resolver); } public void testSchema1v2() throws Exception { ClassLoader loader = Thread.currentThread().getContextClassLoader(); MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); resolver.mapSchemaLocation("urn:jboss:jbxb-minOccurs-schema1", "xml/jbxb/minOccurs/schema1v2.xsd"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); URL testSchema1 = loader.getResource("xml/jbxb/minOccurs/testSchema1.xml"); Object root = unmarshaller.unmarshal(testSchema1.toString(), resolver); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/schemabindingattribute/libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/schemabindingattribute0000755000175000017500000000000011620316742033377 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/schemabindingattribute/Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/schemabindingattribute0000644000175000017500000000363611044055770033412 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.jbxb.schemabindingattribute; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlAnyElement; /** * A Root. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement() public class Root { private String schemabinding; private Object[] anyElement; // it's not really set, it's here for the schema only @XmlAttribute(namespace="http://www.jboss.org/xml/ns/jbxb") public String getSchemabinding() { return schemabinding; } public void setSchemabinding(String o) { this.schemabinding = o; } @XmlAnyElement public Object[] getAnyElement() { return anyElement; } public void setAnyElement(Object[] o) { this.anyElement = o; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/schemabindingattribute/Ns2Root.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/schemabindingattribute0000644000175000017500000000250311044055770033402 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.jbxb.schemabindingattribute; import javax.xml.bind.annotation.XmlRootElement; /** * A Included. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @XmlRootElement(name="root", namespace="urn:ns2") public class Ns2Root { } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/characters/0000755000175000017500000000000011620316742031056 5ustar twernertwerner././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/characters/Binding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/jbxb/characters/Binding.jav0000644000175000017500000000527010513427451033136 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.jbxb.characters; /** * @author Scott.Stark@jboss.org * @version $Revision: 38439 $ */ public class Binding { private String name; private String type; private String text; private Value2 value2; private Value3 value3; public Value4 value4; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getText() { return text; } public void setText(String text) { this.text = text; } public Value2 getValue2() { return value2; } public void setValue2(Value2 value2) { this.value2 = value2; } public Value3 getValue3() { return value3; } public void setValue3(Value3 value3) { this.value3 = value3; } // Inner public static final class Value2 { public String text; public String getText() { return text; } public void setText(String text) { this.text = text; } } public static final class Value3 { public static Object unmarshalChars(String chars) { return chars; } public Object chars; public String attr; } public static final class Value4 { public Value4(String value) { this.value = value; } public Value4() { } public String value; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/RequiredAttributesUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/RequiredAttributesUnitTestC0000644000175000017500000001576410763513557033416 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.IOException; import java.io.StringReader; import java.io.StringWriter; import javax.xml.namespace.QName; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** * @author Alexey Loubyansky * @version $Revision: 45337 $ */ public class RequiredAttributesUnitTestCase extends AbstractJBossXBTest { private static final String XSD = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; private static SchemaBinding SCHEMA; public RequiredAttributesUnitTestCase(String name) { super(name); } protected void setUp() throws Exception { super.setUp(); if(SCHEMA == null) { SCHEMA = XsdBinder.bind(new StringReader(XSD), null); SCHEMA.setIgnoreUnresolvedFieldOrClass(false); } } public void testBinding() throws Exception { assertNotNull(SCHEMA); ElementBinding element = SCHEMA.getElement(new QName("root")); assertNotNull(element); AttributeBinding attribute = element.getType().getAttribute(new QName("unqualified")); assertNotNull(attribute); assertTrue(attribute.getRequired()); } public void testUnmarshallingInvalidXml() throws Exception { String xml = ""; org.xml.sax.EntityResolver resolver = new org.xml.sax.EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if(systemId != null && systemId.endsWith("testns")) return new org.xml.sax.InputSource(new StringReader(XSD)); return null; } }; /* Validator.assertValidXml(xml, new org.xml.sax.EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if(systemId != null && systemId.endsWith("testns")) return new org.xml.sax.InputSource(new StringReader(xsd)); return null; } }); */ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.setEntityResolver(resolver); unmarshaller.setSchemaValidation(true); try { unmarshaller.unmarshal(new StringReader(xml), SCHEMA); fail("required attribute is missing"); } catch(JBossXBException e) { // expected } } public void testMarshallingInvalidObject() throws Exception { E root = new E(); StringWriter writer = new StringWriter(); MarshallerImpl marshaller = new MarshallerImpl(); try { marshaller.marshal(SCHEMA, null, root, writer); fail("required attribute is missing"); } catch(JBossXBRuntimeException e) { // expected } } public void testUnmarshallingValidXml() throws Exception { String xml = ""; org.xml.sax.EntityResolver resolver = new org.xml.sax.EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if(systemId != null && systemId.endsWith("testns")) return new org.xml.sax.InputSource(new StringReader(XSD)); return null; } }; /* Validator.assertValidXml(xml, new org.xml.sax.EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if(systemId != null && systemId.endsWith("testns")) return new org.xml.sax.InputSource(new StringReader(xsd)); return null; } }); */ Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.setEntityResolver(resolver); unmarshaller.setSchemaValidation(true); E e = (E) unmarshaller.unmarshal(new StringReader(xml), SCHEMA); assertNotNull(e); assertEquals("1", e.unqualified); } public void testMarshallingValidObject() throws Exception { E root = new E(); root.unqualified = "1"; StringWriter writer = new StringWriter(); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.marshal(SCHEMA, null, root, writer); String xml = ""; assertXmlEqual(xml, writer.getBuffer().toString()); } // Inner public static final class E { public String unqualified; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/BooleanPatternUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/BooleanPatternUnitTestCase.0000644000175000017500000001375310513427451033235 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.io.StringWriter; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.Marshaller; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; /** * @author Alexey Loubyansky * @version $Revision: 45337 $ */ public class BooleanPatternUnitTestCase extends AbstractJBossXBTest { private static final String XSD = "" + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "" + "" + " " + " " + " " + "" + "" + " " + " " + " " + "" + ""; private static SchemaBinding SCHEMA; private static final String XML = "" + "1" + "0" + "true" + "false" + ""; public BooleanPatternUnitTestCase(String name) { super(name); } protected void configureLogging() { if(SCHEMA == null) { SCHEMA = XsdBinder.bind(new StringReader(XSD), null); SCHEMA.setIgnoreUnresolvedFieldOrClass(false); } } public void testUnmarshalling() throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML), SCHEMA); assertNotNull(o); assertTrue(o instanceof E); E e = (E)o; assertTrue(e.aTrue10); assertFalse(e.aFalse10); assertTrue(e.aTrueTF); assertFalse(e.aFalseTF); assertTrue(e.eTrue10); assertFalse(e.eFalse10); assertTrue(e.eTrueTF); assertFalse(e.eFalseTF); } public void testMarshallingXerces() throws Exception { StringWriter writer = new StringWriter(); XercesXsMarshaller marshaller = new XercesXsMarshaller(); marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), E.INSTANCE, writer); String xml = writer.getBuffer().toString(); assertXmlEqual(XML, xml); } public void testMarshallingSunday() throws Exception { StringWriter writer = new StringWriter(); MarshallerImpl marshaller = new MarshallerImpl(); marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); marshaller.marshal(SCHEMA, null, E.INSTANCE, writer); String xml = writer.getBuffer().toString(); assertXmlEqual(XML, xml); } // Inner public static final class E { public static final E INSTANCE; static { E e = new E(); e.aTrue10 = true; e.aTrueTF = true; e.eTrue10 = true; e.eTrueTF = true; INSTANCE = e; } public boolean aTrue10; public boolean aFalse10; public boolean aTrueTF; public boolean aFalseTF; public boolean eTrue10; public boolean eFalse10; public boolean eTrueTF; public boolean eFalseTF; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/NestedWildcardUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/NestedWildcardUnitTestCase.0000644000175000017500000000570310533036112033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import junit.framework.TestSuite; import org.jboss.util.Strings; import org.jboss.util.xml.DOMWriter; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; import org.xml.sax.Attributes; /** * NestedWildcardUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NestedWildcardUnitTestCase extends AbstractJBossXBTest { private static final String NS = "http://www.jboss.org/test/xml/nestedWildcard"; public static final TestSuite suite() { return new TestSuite(NestedWildcardUnitTestCase.class); } public NestedWildcardUnitTestCase(String name) { super(name); } public void testNestedWildcard() throws Exception { SchemaBinding schema = bind("NestedWildcard.xsd"); TypeBinding type = schema.getType(new QName(NS, "nested-wildcard")); WildcardBinding wc = type.getWildcard(); assertNotNull(wc); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/JbxbPojoServerUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/JbxbPojoServerUnitTestCase.0000644000175000017500000000445210513427451033220 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; /** * @author Alexey Loubyansky * @version $Revision: 37728 $ */ public class JbxbPojoServerUnitTestCase extends PojoServerTestBase { public JbxbPojoServerUnitTestCase(String localName) { super(localName); } protected SchemaBinding getSchemaBinding() { SchemaBinding cursor = readXsd(); /** TODO TypeBinding namedValueType = cursor.getType(namedValueTypeQName); // // add handlers // namedValueType.pushInterceptor(propsQName, new DefaultElementInterceptor() { public void add(Object parent, Object child, QName qName) { AbstractPropertyMetaData prop = (AbstractPropertyMetaData)parent; Map children = (Map)child; for(Iterator i = children.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry)i.next(); prop.setValue((String)entry.getKey(), entry.getValue()); } } } ); */ return cursor; } protected String getXsd() { return "xml/jbxb-bean-deployer_1_0.xsd"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SundayUnitTestCase.java0000644000175000017500000005135311061473704032424 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import junit.framework.TestCase; import org.jboss.xb.binding.Immutable; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementInterceptor; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.test.xml.config.Config; import org.jboss.test.xml.config.Config.Bean; import org.jboss.test.xml.config.Config.ConfigAttr; import org.jboss.test.xml.config.Config.Depends; import org.jboss.test.xml.config.Config.ListValue; import org.xml.sax.Attributes; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import java.util.HashMap; import java.util.Map; import java.util.ArrayList; import java.util.Collection; import java.net.URL; /** * @author Alexey Loubyansky * @version $Revision: 56873 $ */ public class SundayUnitTestCase extends TestCase { public SundayUnitTestCase() { } public SundayUnitTestCase(String localName) { super(localName); } public void testConfigUnmarshalling() throws Exception { // // Type declarations // TypeBinding configType = new TypeBinding(); TypeBinding attributeType = new TypeBinding(); TypeBinding attributeValue1Type = new TypeBinding(); TypeBinding attributeValue2Type = new TypeBinding(); TypeBinding beansType = new TypeBinding(); TypeBinding beanType = new TypeBinding(); TypeBinding listType = new TypeBinding(); TypeBinding listValueType = new TypeBinding(); TypeBinding listDependsType = new TypeBinding(); TypeBinding mapType = new TypeBinding(); TypeBinding entry1Type = new TypeBinding(); TypeBinding entry2Type = new TypeBinding(); TypeBinding entry3Type = new TypeBinding(); TypeBinding entry4Type = new TypeBinding(); // // Schema assembling // configType.addElement(new QName("attribute"), attributeType, 0, true); configType.addElement(new QName("beans"), beansType); configType.addElement(new QName("list"), listType); configType.addElement(new QName("map"), mapType); attributeType.addElement(new QName("value1"), attributeValue1Type); attributeType.addElement(new QName("value2"), attributeValue2Type); beansType.addElement(new QName("bean"), beanType, 0, true); listType.addElement(new QName("value"), listValueType); listType.addElement(new QName("depends"), listDependsType); listType.addElement(new QName("list"), listType); mapType.addElement(new QName("entry1"), entry1Type); mapType.addElement(new QName("entry2"), entry2Type); mapType.addElement(new QName("entry3"), entry3Type); mapType.addElement(new QName("entry4"), entry4Type); mapType.addElement(new QName("map"), mapType); // // Handler implementations // configType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Config(); } } ); configType.pushInterceptor(new QName("attribute"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { Config config = (Config)parent; Config.ConfigAttr attr = (Config.ConfigAttr)child; Collection attrs = config.getAttrs(); if(attrs == null) { attrs = new ArrayList(); config.setAttrs(attrs); } attrs.add(attr); } } ); configType.pushInterceptor(new QName("beans"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { Config config = (Config)parent; config.beans = (Collection)child; } } ); configType.pushInterceptor(new QName("list"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { Config config = (Config)parent; config.list = (Collection)child; } } ); configType.pushInterceptor(new QName("map"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { Config config = (Config)parent; config.map = (Map)child; } } ); attributeType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Immutable(Config.ConfigAttr.class); } public Object endElement(Object o, QName name, ElementBinding element) { Immutable imm = (Immutable)o; return imm.newInstance(); } } ); attributeType.setSimpleType(new CharactersHandler(){ public void setValue(QName qName, ElementBinding element, Object owner, Object value) { Immutable imm = (Immutable)owner; Config.ConfigAttr.ConfigAttrDataValue o = new Config.ConfigAttr.ConfigAttrDataValue(); o.setData((String)value); imm.addChild(qName.getLocalPart(), o); } }); attributeType.pushInterceptor(new QName("value1"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { Immutable imm = (Immutable)parent; Config.ConfigAttr.ConfigAttrValue1 value1 = (Config.ConfigAttr.ConfigAttrValue1)child; imm.addChild(name.getLocalPart(), value1); } } ); attributeType.pushInterceptor(new QName("value2"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { Immutable imm = (Immutable)parent; Config.ConfigAttr.ConfigAttrValue2 value2 = (Config.ConfigAttr.ConfigAttrValue2)child; imm.addChild(name.getLocalPart(), value2); } } ); attributeValue1Type.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Config.ConfigAttr.ConfigAttrValue1(); } } ); attributeValue1Type.pushInterceptor(new QName("property"), new DefaultElementInterceptor() { public void characters(Object o, QName name, TypeBinding type, NamespaceContext nsCtx, String text) { Config.ConfigAttr.ConfigAttrValue1 value1 = (Config.ConfigAttr.ConfigAttrValue1)o; value1.setProperty(text); } } ); attributeValue2Type.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Config.ConfigAttr.ConfigAttrValue2(); } } ); attributeValue2Type.setSimpleType(new CharactersHandler(){ public void setValue(QName qName, ElementBinding element, Object owner, Object value) { Config.ConfigAttr.ConfigAttrValue2 value2 = (Config.ConfigAttr.ConfigAttrValue2)owner; value2.setValue2((String)value); } }); beansType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new ArrayList(); } } ); beansType.pushInterceptor(new QName("bean"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { Collection beans = (Collection)parent; Config.Bean bean = (Config.Bean)child; beans.add(bean); } } ); beanType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Immutable(Config.Bean.class); } public Object endElement(Object o, QName name, ElementBinding element) { Immutable imm = (Immutable)o; Config.Bean bean = (Config.Bean)imm.newInstance(); return bean; } } ); beanType.pushInterceptor(new QName("name"), new DefaultElementInterceptor() { public void characters(Object o, QName name, TypeBinding type, NamespaceContext nsCtx, String text) { Immutable imm = (Immutable)o; imm.addChild(name.getLocalPart(), text); } } ); listType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new ArrayList(); } } ); listType.pushInterceptor(new QName("value"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { Collection list = (Collection)parent; Config.ListValue value = (Config.ListValue)child; list.add(value); } } ); listType.pushInterceptor(new QName("depends"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { Collection list = (Collection)parent; Config.Depends depends = (Config.Depends)child; list.add(depends); } } ); listType.pushInterceptor(new QName("list"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { Collection> list = (Collection>)parent; Collection sublist = (Collection)child; list.add(sublist); } } ); listValueType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Immutable(Config.ListValue.class); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { Immutable imm = (Immutable)o; for(int i = 0; i < attrs.getLength(); ++i) { String lName = attrs.getLocalName(i); if("type".equals(lName)) { imm.addChild(lName, attrs.getValue(i)); } } } public Object endElement(Object o, QName name, ElementBinding element) { Immutable imm = (Immutable)o; Config.ListValue value = (Config.ListValue)imm.newInstance(); return value; } } ); listValueType.setSimpleType(new CharactersHandler(){ public void setValue(QName qName, ElementBinding element, Object owner, Object value) { Immutable imm = (Immutable)owner; imm.addChild(qName.getLocalPart(), value); } }); listDependsType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Immutable(Config.Depends.class); } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { Immutable imm = (Immutable)o; for(int i = 0; i < attrs.getLength(); ++i) { String lName = attrs.getLocalName(i); if("value".equals(lName)) { imm.addChild(lName, attrs.getValue(i)); } } } public Object endElement(Object o, QName name, ElementBinding element) { Immutable imm = (Immutable)o; Config.Depends depends = (Config.Depends)imm.newInstance(); return depends; } } ); mapType.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new HashMap(); } } ); ElementInterceptor addMapEntryInterceptor = new DefaultElementInterceptor() { public void add(Object parent, Object child, QName name) { Map map = (Map)parent; Object[] arr = (Object[])child; map.put(arr[0], arr[1]); } }; mapType.pushInterceptor(new QName("entry1"), addMapEntryInterceptor); mapType.pushInterceptor(new QName("entry2"), addMapEntryInterceptor); mapType.pushInterceptor(new QName("entry3"), addMapEntryInterceptor); mapType.pushInterceptor(new QName("entry4"), addMapEntryInterceptor); mapType.pushInterceptor(new QName("map"), addMapEntryInterceptor); entry1Type.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Object[2]; } } ); entry1Type.pushInterceptor(new QName("key1"), new DefaultElementInterceptor() { public void characters(Object o, QName name, TypeBinding type, NamespaceContext nsCtx, String text) { Object[] arr = (Object[])o; arr[0] = text; } } ); entry1Type.pushInterceptor(new QName("value1"), new DefaultElementInterceptor() { public void characters(Object o, QName name, TypeBinding type, NamespaceContext nsCtx, String text) { Object[] arr = (Object[])o; arr[1] = text; } } ); entry2Type.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Object[2]; } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { Object[] arr = (Object[])o; for(int i = 0; i < attrs.getLength(); ++i) { String lName = attrs.getLocalName(i); if("key2".equals(lName)) { arr[0] = attrs.getValue(i); } } } } ); entry2Type.pushInterceptor(new QName("value2"), new DefaultElementInterceptor() { public void characters(Object o, QName name, TypeBinding type, NamespaceContext nsCtx, String text) { Object[] arr = (Object[])o; arr[1] = text; } } ); entry3Type.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Object[2]; } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { Object[] arr = (Object[])o; for(int i = 0; i < attrs.getLength(); ++i) { String lName = attrs.getLocalName(i); if("key3".equals(lName)) { arr[0] = attrs.getValue(i); } else if("value3".equals(lName)) { arr[1] = attrs.getValue(i); } } } } ); entry4Type.setHandler(new DefaultElementHandler() { public Object startElement(Object parent, QName name, ElementBinding element) { return new Object[2]; } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { Object[] arr = (Object[])o; for(int i = 0; i < attrs.getLength(); ++i) { String lName = attrs.getLocalName(i); if("key4".equals(lName)) { arr[0] = attrs.getValue(i); } } } } ); entry4Type.setSimpleType(new CharactersHandler(){ public void setValue(QName qName, ElementBinding element, Object owner, Object value) { Object[] arr = (Object[])owner; arr[1] = value; } }); mapType.pushInterceptor(new QName("map"), new DefaultElementInterceptor() { public Object startElement(Object parent, QName name, TypeBinding type) { return new Object[2]; } public void attributes(Object o, QName elementName, TypeBinding type, Attributes attrs, NamespaceContext nsCtx) { Object[] arr = (Object[])o; for(int i = 0; i < attrs.getLength(); ++i) { String lName = attrs.getLocalName(i); if("key".equals(lName)) { arr[0] = attrs.getValue(i); } } } public void add(Object parent, Object child, QName qName) { Object[] arr = (Object[])parent; Map submap = (Map)child; arr[1] = submap; } } ); SchemaBinding cursor = new SchemaBinding(); cursor.addElement(new QName("config"), configType); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object config = unmarshaller.unmarshal(getXmlUrl("xml/newmetadata.xml"), cursor); //log.debug("unmarshalled: " + config); assertEquals(Config.getInstance(), config); } // Private private static String getXmlUrl(String name) { URL xmlUrl = Thread.currentThread().getContextClassLoader().getResource(name); if(xmlUrl == null) { throw new IllegalStateException(name + " not found"); } return xmlUrl.getFile(); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/CollectionOverridePropertyUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/CollectionOverridePropertyU0000644000175000017500000001207011061473704033423 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.util.LinkedList; import java.util.List; import javax.xml.namespace.QName; import junit.framework.TestSuite; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; /** * CollectionOverridePropertyUnitTestCase. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class CollectionOverridePropertyUnitTestCase extends AbstractJBossXBTest { private static final String NS = "http://www.jboss.org/test/xml/collectionOverrideProperty"; public static final TestSuite suite() { return new TestSuite(CollectionOverridePropertyUnitTestCase.class); } public CollectionOverridePropertyUnitTestCase(String name) { super(name); } public void testCollectionOverrideProperty() throws Exception { SchemaBinding schema = bind("CollectionOverrideProperty.xsd"); schema.setIgnoreUnresolvedFieldOrClass(false); ClassMetaData classMetaData = new ClassMetaData(); classMetaData.setImpl(Parent.class.getName()); TypeBinding type = schema.getType(new QName(NS, "parent-type")); assertNotNull(type); type.setClassMetaData(classMetaData); type.pushInterceptor(new QName(NS, "child"), new DefaultElementInterceptor() { public void add(Object parent, Object child, QName qName) { getLog().debug("Add " + parent + " " + child); Parent p = (Parent) parent; if (p.list == null) p.list = new LinkedList(); p.list.add(child); } }); classMetaData = new ClassMetaData(); classMetaData.setImpl(Child.class.getName()); type = schema.getType(new QName(NS, "child-type")); assertNotNull(type); type.setClassMetaData(classMetaData); Parent parent = (Parent) unmarshal("CollectionOverrideProperty.xml", schema, Parent.class); List list = parent.list; assertNotNull(list); assertEquals("one", ((Child) list.get(0)).getValue()); assertEquals("two", ((Child) list.get(1)).getValue()); } public void testWithPropertyMetaData() throws Exception { SchemaBinding schema = bind("CollectionOverrideProperty.xsd"); schema.setIgnoreUnresolvedFieldOrClass(false); ClassMetaData classMetaData = new ClassMetaData(); classMetaData.setImpl(Parent.class.getName()); TypeBinding type = schema.getType(new QName(NS, "parent-type")); assertNotNull(type); type.setClassMetaData(classMetaData); PropertyMetaData prop = new PropertyMetaData(); prop.setName("list"); type.getElement(new QName(NS, "child")).setPropertyMetaData(prop); classMetaData = new ClassMetaData(); classMetaData.setImpl(Child.class.getName()); type = schema.getType(new QName(NS, "child-type")); assertNotNull(type); type.setClassMetaData(classMetaData); Parent parent = (Parent) unmarshal("CollectionOverrideProperty.xml", schema, Parent.class); List list = parent.list; assertNotNull(list); assertEquals("one", ((Child) list.get(0)).getValue()); assertEquals("two", ((Child) list.get(1)).getValue()); } public static class Parent { private List list; public List getList() { return list; } public void setList(List list) { this.list = list; } } public static class Child { private String value; public String getValue() { return value; } public void setValue(String value) { this.value = value; } } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/WildcardUnresolvedElementsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/WildcardUnresolvedElementsU0000644000175000017500000007400311350171524033360 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.io.StringWriter; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.jboss.xb.binding.AttributesImpl; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.MarshallingContext; import org.jboss.xb.binding.ObjectLocalMarshaller; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.AbstractMarshaller; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler; import org.jboss.xb.util.DomCharactersHandler; import org.jboss.xb.util.DomLocalMarshaller; import org.jboss.xb.util.DomParticleHandler; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.ls.LSInput; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; /** * @author Alexey Loubyansky * @version $Revision: 46112 $ */ public class WildcardUnresolvedElementsUnitTestCase extends AbstractJBossXBTest { private static final String XSD = "" + " " + " " + " " + " " + " " + " " + ""; private static final String XML = "" + " " + " " + " text content3" + " " + " " + " " + " " + " " + " " + " " + " " + ""; static { //Validator.assertValidXml(XSD, XML); } public WildcardUnresolvedElementsUnitTestCase(String name) { super(name); } public void testUnmarshallingGenericElement() throws Exception { SchemaBinding schema = getSchemaBinding(true); // unmarshal Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML), schema); assertArrayOfAnyGenericElement(o); } public void testUnmarshallingDom() throws Exception { SchemaBinding schema = getSchemaBinding(false); // unmarshal Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML), schema); assertArrayOfAnyDom(o); } public void testMarshallingXercesGenericElement() throws Exception { XercesXsMarshaller marshaller = new XercesXsMarshaller(); setupGeMarshaller(marshaller); MappingObjectModelProvider provider = new MappingObjectModelProvider(); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(XSD), provider, ArrayOfAny.GE_INSTANCE, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(XML, marshalled); } public void testMarshallingXercesDom() throws Exception { XercesXsMarshaller marshaller = new XercesXsMarshaller(); setupDomMarshaller(marshaller); MappingObjectModelProvider provider = new MappingObjectModelProvider(); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(XSD), provider, ArrayOfAny.DOM_INSTANCE, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(XML, marshalled); } public void testMarshallingSundayGenericElement() throws Exception { MarshallerImpl marshaller = new MarshallerImpl(); setupGeMarshaller(marshaller); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(XSD), null, ArrayOfAny.GE_INSTANCE, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(XML, marshalled); } public void testMarshallingSundayDom() throws Exception { MarshallerImpl marshaller = new MarshallerImpl(); setupDomMarshaller(marshaller); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(XSD), null, ArrayOfAny.DOM_INSTANCE, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(XML, marshalled); } // Private private void setupDomMarshaller(AbstractMarshaller marshaller) { marshaller.mapClassToGlobalElement(ArrayOfAny.class, "e", "http://org.jboss.ws/jbws434/types", null, null); marshaller.mapFieldToWildcard(ArrayOfAny.class, "_any", DomLocalMarshaller.INSTANCE); } private void setupGeMarshaller(AbstractMarshaller marshaller) { marshaller.mapClassToGlobalElement(ArrayOfAny.class, "e", "http://org.jboss.ws/jbws434/types", null, null); marshaller.mapFieldToWildcard(ArrayOfAny.class, "_any", new ObjectLocalMarshaller() { public void marshal(MarshallingContext ctx, Object o) { ContentHandler ch = ctx.getContentHandler(); GenericElement ge = (GenericElement)o; try { AttributesImpl attrs = null; if(ge.getAttributesTotal() > 0) { attrs = new AttributesImpl(ge.getAttributesTotal() + 1); Set attrNames = ge.getAttributeNames(); for(Iterator i = attrNames.iterator(); i.hasNext();) { String attrName = (String)i.next(); String attrValue = ge.getAttribute(attrName); attrs.add(null, attrName, attrName, null, attrValue); } } else { attrs = new AttributesImpl(1); } attrs.add(Constants.NS_XML_SCHEMA, "xmlns", "xmlns", null, ge.getNsUri()); ch.startElement(ge.getNsUri(), ge.getLocalName(), ge.getLocalName(), attrs); String text = ge.getTextContent(); if(text != null && text.length() > 0) { ch.characters(text.toCharArray(), 0, text.length()); } if(ge.getChildElementsTotal() > 0) { for(Iterator i = ge.getChildElements(); i.hasNext();) { GenericElement child = (GenericElement)i.next(); this.marshal(ctx, child); } } ch.endElement(null, ge.getLocalName(), ge.getLocalName()); } catch(Exception e) { throw new JBossXBRuntimeException(e); } } } ); } private SchemaBinding getSchemaBinding(boolean genericElement) { // bind SchemaBinding schema = XsdBinder.bind(new StringReader(XSD), null); // get bound components TypeBinding type = schema.getType(new QName("http://org.jboss.ws/jbws434/types", "ArrayOfAny")); WildcardBinding wildcard = type.getWildcard(); ElementBinding e = schema.getElement(new QName("http://org.jboss.ws/jbws434/types", "e")); // adjust binding ParticleHandler unresolvedElementHandler; CharactersHandler unresolvedCharactersHandler; if(genericElement) { unresolvedElementHandler = new GenericElementHandler(); unresolvedCharactersHandler = new GenericCharactersHandler(); } else { unresolvedElementHandler = DomParticleHandler.INSTANCE; unresolvedCharactersHandler = DomCharactersHandler.INSTANCE; } wildcard.setUnresolvedElementHandler(unresolvedElementHandler); wildcard.setUnresolvedCharactersHandler(unresolvedCharactersHandler); PropertyMetaData property = new PropertyMetaData(); property.setName("_any"); wildcard.setPropertyMetaData(property); ClassMetaData clsBinding = new ClassMetaData(); clsBinding.setImpl(ArrayOfAny.class.getName()); e.setClassMetaData(clsBinding); // to fail the resolution quickly schema.setSchemaResolver(new SchemaBindingResolver() { public String getBaseURI() { return null; } public void setBaseURI(String baseURI) { } public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation) { return null; } public LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation) { return null; } }); return schema; } private static void assertArrayOfAnyGenericElement(Object o) { assertNotNull(o); assertTrue(o instanceof ArrayOfAny); ArrayOfAny arrayOfAny = (ArrayOfAny)o; assertNotNull(arrayOfAny._any); assertEquals(3, arrayOfAny._any.length); // child1 GenericElement ge = (GenericElement)arrayOfAny._any[0]; assertEquals("child1", ge.getLocalName()); assertAttributesTotal(ge, 0); assertNoTextContent(ge); assertChildElementsTotal(ge, 3); for(Iterator i = ge.getChildElements(); i.hasNext();) { ge = (GenericElement)i.next(); String localName = ge.getLocalName(); if("child2".equals(localName)) { assertNoTextContent(ge); assertChildElementsTotal(ge, 0); assertAttributesTotal(ge, 2); assertAttribute(ge, "child2_attr1", "attr1"); assertAttribute(ge, "child2_attr2", "attr2"); } else if("child3".equals(localName)) { assertTextContent(ge, "text content3"); assertChildElementsTotal(ge, 0); assertAttributesTotal(ge, 0); } else if("child4".equals(localName)) { assertNoTextContent(ge); assertAttributesTotal(ge, 1); assertAttribute(ge, "child4_attr1", "attr1"); assertChildElementsTotal(ge, 1); ge = (GenericElement)ge.getChildElements().next(); assertEquals("child5", ge.getLocalName()); assertNoTextContent(ge); assertAttributesTotal(ge, 0); assertChildElementsTotal(ge, 0); } else { fail("child1 expected to have only child2, child3 and child4 as child elements but got: " + localName); } } ge = (GenericElement)arrayOfAny._any[1]; assertEquals("child6", ge.getLocalName()); assertAttributesTotal(ge, 0); assertNoTextContent(ge); assertChildElementsTotal(ge, 0); ge = (GenericElement)arrayOfAny._any[2]; assertEquals("child7", ge.getLocalName()); assertAttributesTotal(ge, 0); assertNoTextContent(ge); assertChildElementsTotal(ge, 1); ge = (GenericElement)ge.getChildElements().next(); assertEquals("child8", ge.getLocalName()); assertAttributesTotal(ge, 0); assertNoTextContent(ge); assertChildElementsTotal(ge, 0); } private static void assertArrayOfAnyDom(Object o) { assertNotNull(o); assertTrue(o instanceof ArrayOfAny); ArrayOfAny arrayOfAny = (ArrayOfAny)o; assertNotNull(arrayOfAny._any); assertEquals(3, arrayOfAny._any.length); // child1 String somens = "http://somens"; Element e = (Element)arrayOfAny._any[0]; assertEquals("child1", e.getLocalName()); assertEquals(somens, e.getNamespaceURI()); assertEquals(0, e.getAttributes().getLength()); assertNoTextContent(e); assertChildElementsTotal(e, 3); NodeList childNodes = e.getChildNodes(); for(int i = 0; i < childNodes.getLength(); ++i) { Node node = childNodes.item(i); if(node.getNodeType() == Node.ELEMENT_NODE) { e = (Element)node; String localName = e.getLocalName(); if("child2".equals(localName)) { assertEquals(somens, e.getNamespaceURI()); assertNoTextContent(e); assertChildElementsTotal(e, 0); assertAttributesTotal(e, e.getAttributes().getLength()); assertAttribute(e, "child2_attr1", "attr1"); assertAttribute(e, "child2_attr2", "attr2"); } else if("child3".equals(localName)) { assertEquals(somens, e.getNamespaceURI()); assertTextContent(e, "text content3"); assertChildElementsTotal(e, 0); assertAttributesTotal(e, 0); } else if("child4".equals(localName)) { assertEquals(somens, e.getNamespaceURI()); assertNoTextContent(e); assertAttributesTotal(e, 1); assertAttribute(e, "child4_attr1", "attr1"); assertChildElementsTotal(e, 1); e = getChildElement(e, "child5"); if(e == null) { fail("Element child4 expected to have child element child5"); } assertEquals(somens, e.getNamespaceURI()); assertEquals("child5", e.getLocalName()); assertNoTextContent(e); assertAttributesTotal(e, 0); assertChildElementsTotal(e, 0); } else { fail("child1 expected to have only child2, child3 and child4 as child elements but got: " + localName); } } } e = (Element)arrayOfAny._any[1]; assertEquals("child6", e.getLocalName()); assertEquals("http://anotherns", e.getNamespaceURI()); assertAttributesTotal(e, 0); assertNoTextContent(e); assertChildElementsTotal(e, 0); e = (Element)arrayOfAny._any[2]; assertEquals("child7", e.getLocalName()); assertEquals("http://child7ns", e.getNamespaceURI()); assertAttributesTotal(e, 0); assertNoTextContent(e); assertChildElementsTotal(e, 1); e = getChildElement(e, "child8"); assertNotNull(e); assertEquals("http://child8ns", e.getNamespaceURI()); assertAttributesTotal(e, 0); assertNoTextContent(e); assertChildElementsTotal(e, 0); } private static void assertChildElementsTotal(GenericElement e, int total) { if(e.getChildElementsTotal() != total) { fail("element " + e.getLocalName() + " was expected to have " + total + " elements but got " + e.getChildElementsTotal() ); } } private static void assertChildElementsTotal(Element e, int total) { int was = 0; NodeList childNodes = e.getChildNodes(); if(childNodes != null && childNodes.getLength() > 0) { for(int i = 0; i < childNodes.getLength(); ++i) { Node node = childNodes.item(i); if(node.getNodeType() == Node.ELEMENT_NODE) { ++was; } } } if(was != total) { fail("element " + e.getLocalName() + " was expected to have " + total + " elements but got " + was ); } } private static void assertAttribute(GenericElement e, String attrName, String attrValue) { assertEquals(attrValue, e.getAttribute(attrName)); } private static void assertAttribute(Element e, String attrName, String attrValue) { assertEquals(attrValue, e.getAttribute(attrName)); } private static void assertAttributesTotal(GenericElement e, int total) { if(e.getAttributesTotal() != total) { fail("element " + e.getLocalName() + " was expected to have " + total + " attributes but got " + e.getAttributesTotal() + ": " + e.getAttributeNames() ); } } private static void assertAttributesTotal(Element e, int total) { NamedNodeMap attributes = e.getAttributes(); int was = attributes == null ? 0 : attributes.getLength(); if(was != total) { fail("element " + e.getLocalName() + " was expected to have " + total + " attributes but got " + was ); } } private static void assertTextContent(GenericElement e, String text) { assertEquals(text, e.getTextContent()); } private static void assertTextContent(Element e, String text) { NodeList childNodes = e.getChildNodes(); if(childNodes != null && childNodes.getLength() > 0) { for(int i = 0; i < childNodes.getLength(); ++i) { Node node = childNodes.item(i); if(node.getNodeType() == Node.TEXT_NODE) { String value = node.getNodeValue().trim(); if(value.length() > 0) { assertEquals(text, value); return; } } } } fail("Element " + e.getLocalName() + " expected to have text content " + text); } private static void assertNoTextContent(GenericElement e) { if(e.getTextContent() != null) { fail("element " + e.getLocalName() + " was not expected to have text content but got " + e.getTextContent() ); } } private static void assertNoTextContent(Element e) { NodeList childNodes = e.getChildNodes(); if(childNodes != null && childNodes.getLength() > 0) { for(int i = 0; i < childNodes.getLength(); ++i) { Node child = childNodes.item(i); if(child.getNodeType() == Node.TEXT_NODE) { fail("element " + e.getLocalName() + " was not expected to have text content but got " + child.getNodeValue() ); } } } } private static Element getChildElement(Element e, String name) { NodeList childNodes = e.getChildNodes(); if(childNodes != null && childNodes.getLength() > 0) { for(int i = 0; i < childNodes.getLength(); ++i) { Node node = childNodes.item(i); if(node.getNodeType() == Node.ELEMENT_NODE) { if(name.equals(node.getLocalName())) { return (Element)node; } } } } return null; } // Inner public static class ArrayOfAny { public static final ArrayOfAny GE_INSTANCE; public static final ArrayOfAny DOM_INSTANCE; static { GE_INSTANCE = new ArrayOfAny(); GE_INSTANCE._any = new GenericElement[3]; GenericElement child1 = new GenericElement("http://somens", "child1"); GE_INSTANCE._any[0] = child1; GenericElement child2 = new GenericElement("http://somens", "child2"); child1.addChild(child2); child2.setAttribute("child2_attr1", "attr1"); child2.setAttribute("child2_attr2", "attr2"); GenericElement child3 = new GenericElement("http://somens", "child3"); child1.addChild(child3); child3.setTextContent("text content3"); GenericElement child4 = new GenericElement("http://somens", "child4"); child1.addChild(child4); child4.setAttribute("child4_attr1", "attr1"); GenericElement child5 = new GenericElement("http://somens", "child5"); child4.addChild(child5); GenericElement child6 = new GenericElement("http://anotherns", "child6"); GE_INSTANCE._any[1] = child6; GenericElement child7 = new GenericElement("http://child7ns", "child7"); GE_INSTANCE._any[2] = child7; GenericElement child8 = new GenericElement("http://child8ns", "child8"); child7.addChild(child8); assertArrayOfAnyGenericElement(GE_INSTANCE); } static { DOM_INSTANCE = new ArrayOfAny(); DOM_INSTANCE._any = new Element[3]; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder domBuilder = null; try { domBuilder = factory.newDocumentBuilder(); } catch(ParserConfigurationException e) { throw new JBossXBRuntimeException("Failed to create document builder instance", e); } Document doc = domBuilder.newDocument(); Element child1 = doc.createElementNS("http://somens", "child1"); DOM_INSTANCE._any[0] = child1; Element child2 = doc.createElementNS("http://somens", "child2"); child1.appendChild(child2); child2.setAttribute("child2_attr1", "attr1"); child2.setAttribute("child2_attr2", "attr2"); Element child3 = doc.createElementNS("http://somens", "child3"); child1.appendChild(child3); child3.appendChild(doc.createTextNode("text content3")); Element child4 = doc.createElementNS("http://somens", "child4"); child1.appendChild(child4); child4.setAttribute("child4_attr1", "attr1"); Element child5 = doc.createElementNS("http://somens", "child5"); child4.appendChild(child5); Element child6 = doc.createElementNS("http://anotherns", "child6"); DOM_INSTANCE._any[1] = child6; Element child7 = doc.createElementNS("http://child7ns", "child7"); DOM_INSTANCE._any[2] = child7; Element child8 = doc.createElementNS("http://child8ns", "child8"); child7.appendChild(child8); assertArrayOfAnyDom(DOM_INSTANCE); } private Object[] _any; public Object[] get_any() { return _any; } public void set_any(Object[] _any) { this._any = _any; } } public static class GenericElement { private String localName; private String nsUri; private Map attributes = Collections.emptyMap(); private Map childElements = Collections.emptyMap(); private String textContent; public GenericElement(String localName) { this.localName = localName; } public GenericElement(String nsUri, String localName) { this.localName = localName; this.nsUri = nsUri; } public String getLocalName() { return localName; } public String getNsUri() { return nsUri; } public String getTextContent() { return textContent; } public void setTextContent(String textContent) { this.textContent = textContent; } public void setAttribute(String name, String value) { switch(attributes.size()) { case 0: attributes = Collections.singletonMap(name, value); break; case 1: attributes = new HashMap(attributes); default: attributes.put(name, value); } } public String getAttribute(String name) { return (String)attributes.get(name); } public void addChild(GenericElement child) { switch(childElements.size()) { case 0: childElements = Collections.singletonMap(child.getLocalName(), child); break; case 1: childElements = new LinkedHashMap(childElements); default: childElements.put(child.getLocalName(), child); } } public GenericElement getChild(String name) { return (GenericElement)childElements.get(name); } public Iterator getChildElements() { return childElements.values().iterator(); } public int getChildElementsTotal() { return childElements.size(); } public Set getAttributeNames() { return attributes.keySet(); } public int getAttributesTotal() { return attributes.size(); } } public static class GenericCharactersHandler extends CharactersHandler { public Object unmarshalEmpty(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData) { return ""; } public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { return value; } public void setValue(QName qName, ElementBinding element, Object owner, Object value) { GenericElement e = (GenericElement)owner; String text = (String)value; e.setTextContent(text); } } public static class GenericElementHandler extends RtElementHandler implements ParticleHandler { public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { GenericElement el = new GenericElement(elementName.getNamespaceURI(), elementName.getLocalPart()); if(attrs != null) { for(int i = 0; i < attrs.getLength(); ++i) { el.setAttribute(attrs.getLocalName(i), attrs.getValue(i)); } } return el; } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return o; } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { if(parent instanceof GenericElement) ((GenericElement)parent).addChild((GenericElement)o); else super.setParent(parent, o, elementName, particle, parentParticle); } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/JBossXBTestDelegate.java0000644000175000017500000001426511211707307032427 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.lang.reflect.Method; import java.net.URL; import org.jboss.net.protocol.URLStreamHandlerFactory; import org.jboss.test.AbstractTestDelegate; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * JBossXBTestDelegate. * * @author Adrian Brock * @version $Revision: 40492 $ */ public class JBossXBTestDelegate extends AbstractTestDelegate { /** Whether initialization has been done */ private static boolean done = false; /** The unmarshaller factory */ protected UnmarshallerFactory unmarshallerFactory; /** The resolver */ protected SchemaBindingResolver defaultResolver; /** * Initialize */ public synchronized static void init() { if (done) return; done = true; URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory()); URLStreamHandlerFactory.preload(); String handlerPkgs = System.getProperty("java.protocol.handler.pkgs"); if (handlerPkgs != null) handlerPkgs += "|org.jboss.net.protocol"; else handlerPkgs = "org.jboss.net.protocol"; System.setProperty("java.protocol.handler.pkgs", handlerPkgs); } /** * Create a new JBossXBTestDelegate. * * @param clazz the test class */ public JBossXBTestDelegate(Class clazz) { super(clazz); } public void setUp() throws Exception { super.setUp(); init(); unmarshallerFactory = UnmarshallerFactory.newInstance(); initResolver(); } protected void initResolver() throws Exception { try { Method method = clazz.getMethod("initResolver", null); defaultResolver = (SchemaBindingResolver) method.invoke(null, null); } catch (NoSuchMethodException ignored) { defaultResolver = new MultiClassSchemaResolver(); } } /** * Unmarshal an object * * @param url the url * @param resolver the resolver * @return the object * @throws Exception for any error */ public Object unmarshal(String url, SchemaBindingResolver resolver) throws Exception { if (resolver == null) resolver = defaultResolver; long start = System.currentTimeMillis(); Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller(); unmarshaller.setSchemaValidation(true); log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms"); try { Object result = unmarshaller.unmarshal(url, resolver); log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms"); return result; } catch (Exception e) { log.debug("Error during parsing: " + url, e); throw e; } } /** * Unmarshal an object * * @param url the url * @return the object * @throws Exception for any error */ public Object unmarshal(String url) throws Exception { long start = System.currentTimeMillis(); Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller(); log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms"); try { Object result = unmarshaller.unmarshal(url, SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver()); log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms"); return result; } catch (Exception e) { log.debug("Error during parsing: " + url, e); throw e; } } /** * Unmarshal an object * * @param url the url * @param schema the schema * @return the object * @throws Exception for any error */ public Object unmarshal(String url, SchemaBinding schema) throws Exception { long start = System.currentTimeMillis(); Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller(); log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms"); try { Object result = unmarshaller.unmarshal(url, schema); log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms"); return result; } catch (Exception e) { log.debug("Error during parsing: " + url, e); throw e; } } /** * Bind a schema * * @param url the url * @param resolver the resolver * @return the object * @throws Exception for any error */ public SchemaBinding bind(String url, SchemaBindingResolver resolver) throws Exception { return XsdBinder.bind(url, resolver); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/ArrayWrapperUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/ArrayWrapperUnitTestCase.ja0000644000175000017500000003214611335111240033234 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.io.StringWriter; import java.util.Arrays; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * @author Alexey Loubyansky * @version $Revision: 57202 $ */ public class ArrayWrapperUnitTestCase extends AbstractJBossXBTest { private static final String XSD = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; private static final String JBXB79_XSD = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; private static SchemaBinding SCHEMA;// = XsdBinder.bind(new StringReader(XSD), null); private static final String XML = "" + " " + " item1" + " item2" + " " + " " + " " + ""; private static final String XML_STRING_ARR_ARR = "" + " " + " " + " item1" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " item1" + " item2" + " " + " " + " " + " " + ""; private static final String JBXB79_XML = "" + " item1" + " item2" + " " + " " + ""; public ArrayWrapperUnitTestCase(String name) { super(name); } protected void configureLogging() { // enableTrace("org.jboss.xb.binding"); if(SCHEMA == null) SCHEMA = XsdBinder.bind(new StringReader(XSD), null); } public void testMarshalStringArraySunday() throws Exception { MarshallerImpl marshaller = new MarshallerImpl(); StringWriter writer = new StringWriter(); marshaller.marshal(SCHEMA, null, ArrayWrapper.STRING_ARR_INSTANCE, writer); assertXmlEqual(XML, writer.getBuffer().toString()); } public void testMarshalStringArrayXerces() throws Exception { XercesXsMarshaller marshaller = new XercesXsMarshaller(); marshaller.mapClassToGlobalElement(ArrayWrapper.class, "arr", "http://www.jboss.org/xml/test/arraywrapper", null, null); MappingObjectModelProvider provider = new MappingObjectModelProvider(); provider.mapFieldToElement(ArrayWrapper.class, "stringArray", "http://www.jboss.org/xml/test/arraywrapper", "stringArray", null); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(XSD), provider, ArrayWrapper.STRING_ARR_INSTANCE, writer); assertXmlEqual(XML, writer.getBuffer().toString()); } public void testUnmarshalStringArray() throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML), SCHEMA); assertNotNull(o); assertTrue(o instanceof ArrayWrapper); ArrayWrapper aw = (ArrayWrapper)o; assertNotNull(aw.stringArray); assertTrue(Arrays.equals(ArrayWrapper.STRING_ARR_INSTANCE.stringArray.getValue(), aw.stringArray.getValue())); } public void testMarshalStringArrayArraySunday() throws Exception { MarshallerImpl marshaller = new MarshallerImpl(); StringWriter writer = new StringWriter(); marshaller.marshal(SCHEMA, null, ArrayWrapper.STRING_ARR_ARR_INSTANCE, writer); assertXmlEqual(XML_STRING_ARR_ARR, writer.getBuffer().toString()); } public void testMarshalStringArrayArrayXerces() throws Exception { XercesXsMarshaller marshaller = new XercesXsMarshaller(); marshaller.mapClassToGlobalElement(ArrayWrapper.class, "arr", "http://www.jboss.org/xml/test/arraywrapper", null, null); MappingObjectModelProvider provider = new MappingObjectModelProvider(); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(XSD), provider, ArrayWrapper.STRING_ARR_ARR_INSTANCE, writer); assertXmlEqual(XML_STRING_ARR_ARR, writer.getBuffer().toString()); } public void testUnmarshalStringArrayArray() throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML_STRING_ARR_ARR), SCHEMA); assertNotNull(o); assertTrue(o instanceof ArrayWrapper); ArrayWrapper aw = (ArrayWrapper)o; assertNotNull(aw.stringArrayArray); StringArray[] wasArr = aw.stringArrayArray.getValue(); assertNotNull(wasArr); StringArray[] expArr = ArrayWrapper.STRING_ARR_ARR_INSTANCE.stringArrayArray.getValue(); assertEquals(expArr.length, wasArr.length); for(int i = 0; i < expArr.length; ++i) { StringArray expSA = expArr[i]; StringArray wasSA = wasArr[i]; if(expSA == null) { assertNull(wasSA); } else { assertNotNull(wasSA); String[] exp = expSA.getValue(); String[] was = wasSA.getValue(); if(exp == null) { assertNull(was); } else { assertEquals(exp, was); } } } } public void testUnmarshalJBXB79StringArray() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(JBXB79_XSD), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(JBXB79_XML), schema); assertNotNull(o); assertTrue(o instanceof ArrayWrapper); ArrayWrapper aw = (ArrayWrapper)o; assertNotNull(aw.jbxb79); assertEquals(4, aw.jbxb79.length); assertTrue(Arrays.equals(ArrayWrapper.JBXB79_STRING_ARR_INSTANCE.jbxb79, aw.jbxb79)); } // Inner public static class ArrayWrapper { public static final ArrayWrapper STRING_ARR_INSTANCE; public static final ArrayWrapper STRING_ARR_ARR_INSTANCE; public static final ArrayWrapper JBXB79_STRING_ARR_INSTANCE; static { STRING_ARR_INSTANCE = new ArrayWrapper(); STRING_ARR_INSTANCE.stringArray = new StringArray(new String[]{"item1", "item2", "", null}); STRING_ARR_ARR_INSTANCE = new ArrayWrapper(); STRING_ARR_ARR_INSTANCE.stringArrayArray = new StringArrayArray( new StringArray[] { new StringArray(new String[]{"item1"}), new StringArray(new String[]{""}), new StringArray(new String[]{null}), null, STRING_ARR_INSTANCE.stringArray } ); JBXB79_STRING_ARR_INSTANCE = new ArrayWrapper(); JBXB79_STRING_ARR_INSTANCE.jbxb79 = new String[]{"item1", "item2", "", null}; } public StringArray stringArray; public StringArrayArray stringArrayArray; public String[] jbxb79 = new String[10]; public String toString() { return "stringArray=" + stringArray + "; stringArrayArray=" + stringArrayArray; } } public static class StringArray { private String[] value; public StringArray() { } public StringArray(final String[] value) { this.value = value; } public String[] getValue() { return this.value; } public void setValue(final String[] value) { this.value = value; } public String toString() { return (value != null ? Arrays.asList(value).toString() : null); } } public static class StringArrayArray { private StringArray[] value; public StringArrayArray() { } public StringArrayArray(final StringArray[] value) { this.value = value; } public StringArray[] getValue() { return this.value; } public void setValue(final StringArray[] value) { this.value = value; } public String toString() { return (value != null ? Arrays.asList(value).toString() : null); } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/SoapEncUnitTestCase.java0000644000175000017500000005577011026466351032521 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.FileReader; import java.io.InputStream; import java.io.StringWriter; import java.io.StringReader; import java.math.BigDecimal; import java.math.BigInteger; import java.net.URL; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.Arrays; import java.util.TimeZone; import java.lang.reflect.Array; import javax.xml.namespace.QName; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.Marshaller; import org.jboss.xb.binding.AbstractMarshaller; import org.jboss.xb.binding.sunday.unmarshalling.LSInputAdaptor; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.w3c.dom.ls.LSInput; /** * @author Alexey Loubyansky * @version $Revision: 45337 $ */ public class SoapEncUnitTestCase extends AbstractJBossXBTest { private static final SchemaBindingResolver RESOLVER = new SchemaBindingResolver() { public String getBaseURI() { throw new UnsupportedOperationException("getBaseURI is not implemented."); } public void setBaseURI(String baseURI) { throw new UnsupportedOperationException("setBaseURI is not implemented."); } public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation) { throw new UnsupportedOperationException("resolve is not implemented."); } public LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation) { if("http://schemas.xmlsoap.org/soap/encoding/".equals(nsUri)) { InputStream is = getStream("xml/soapenc/soapenc.xsd"); return new LSInputAdaptor(is, null); } throw new IllegalStateException("Unexpected nsUri: " + nsUri); } }; private static final String XML = "" + "String1" + "3512359" + "-2147483648" + "-9223372036854775808" + "-32768" + "3512359.1456" + "1.4E-45" + "4.9E-324" + "false" + "-128" + "String2" + "0096-05-31T23:00:00.000Z" + "String3" + "false" + "1.4E-45" + "4.9E-324" + "3512359.1111" + "-2147483648" + "-32768" + "-128" + "gAB/" + "80007f" + "gAB/" + ""; public SoapEncUnitTestCase(String name) { super(name); } public void testMarshallingXerces() throws Exception { XercesXsMarshaller marshaller = new XercesXsMarshaller(); marshaller.setSchemaResolver(RESOLVER); assertMarshalling(marshaller); } public void testMarshallingSunday() throws Exception { MarshallerImpl marshaller = new MarshallerImpl(); marshaller.setSchemaResolver(RESOLVER); assertMarshalling(marshaller); } public void testUnmarshalling() throws Exception { String xsdPath = getUrl("xml/soapenc/test.xsd").toExternalForm(); SchemaBinding schema = XsdBinder.bind(xsdPath, RESOLVER); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML), schema); assertNotNull(o); assertTrue(o instanceof AllStruct); assertEquals(AllStruct.INSTANCE, o); } // private private void assertMarshalling(AbstractMarshaller marshaller) throws Exception { StringWriter writer = new StringWriter(); marshaller.setProperty(Marshaller.PROP_OUTPUT_XML_VERSION, "false"); marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); marshaller.marshal(new FileReader(getUrl("xml/soapenc/test.xsd").getFile()), new MappingObjectModelProvider(), AllStruct.INSTANCE, writer ); String xml = writer.getBuffer().toString(); assertXmlEqual(XML, xml); } private static URL getUrl(String path) { URL url = Thread.currentThread().getContextClassLoader().getResource(path); if(url == null) { fail("resource not found: " + path); } return url; } private static InputStream getStream(String path) { InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(path); if(is == null) { fail("resource not found: " + path); } return is; } // inner public static class AllStruct { public static final AllStruct INSTANCE; static { byte[] bytes = new byte[]{Byte.MIN_VALUE, 0, Byte.MAX_VALUE}; AllStruct struct = new AllStruct(); struct = new AllStruct(); struct.setVarString(new String("String1")); struct.setVarInteger(new BigInteger("3512359")); struct.setVarInt((int)Integer.MIN_VALUE); struct.setVarLong((long)Long.MIN_VALUE); struct.setVarShort((short)Short.MIN_VALUE); struct.setVarDecimal(new BigDecimal("3512359.1456")); struct.setVarFloat((float)Float.MIN_VALUE); struct.setVarDouble((double)Double.MIN_VALUE); struct.setVarBoolean(false); struct.setVarByte((byte)Byte.MIN_VALUE); struct.setVarQName(new QName("String2")); // This calendar is for 31st May 96 (Not 1996) at 23:00:00.000 // Care needs to be taken to ensure GMT. Calendar varDateTime = new GregorianCalendar(); varDateTime.setTimeZone(TimeZone.getTimeZone("GMT")); varDateTime.set(Calendar.YEAR, 96); varDateTime.set(Calendar.MONTH, 4); varDateTime.set(Calendar.DAY_OF_MONTH, 31); varDateTime.set(Calendar.HOUR_OF_DAY, 23); varDateTime.set(Calendar.MINUTE, 0); varDateTime.set(Calendar.SECOND, 0); varDateTime.set(Calendar.MILLISECOND, 0); struct.setVarDateTime(varDateTime); struct.setVarSoapString("String3"); struct.setVarSoapBoolean(new Boolean(false)); struct.setVarSoapFloat(new Float(Float.MIN_VALUE)); struct.setVarSoapDouble(new Double(Double.MIN_VALUE)); struct.setVarSoapDecimal(new BigDecimal("3512359.1111")); struct.setVarSoapInt(new Integer(Integer.MIN_VALUE)); struct.setVarSoapShort(new Short(Short.MIN_VALUE)); struct.setVarSoapByte(new Byte(Byte.MIN_VALUE)); struct.setVarBase64Binary(bytes); struct.setVarHexBinary(bytes); struct.setVarSoapBase64(bytes); INSTANCE = struct; } private java.lang.String varString; private java.math.BigInteger varInteger; private int varInt; private long varLong; private short varShort; private java.math.BigDecimal varDecimal; private float varFloat; private double varDouble; private boolean varBoolean; private byte varByte; private javax.xml.namespace.QName varQName; private java.util.Calendar varDateTime; private java.lang.String varSoapString; private java.lang.Boolean varSoapBoolean; private java.lang.Float varSoapFloat; private java.lang.Double varSoapDouble; private java.math.BigDecimal varSoapDecimal; private java.lang.Integer varSoapInt; private java.lang.Short varSoapShort; private java.lang.Byte varSoapByte; private byte[] varBase64Binary; private byte[] varHexBinary; private byte[] varSoapBase64; public AllStruct() { } public AllStruct(java.lang.String varString, java.math.BigInteger varInteger, int varInt, long varLong, short varShort, java.math.BigDecimal varDecimal, float varFloat, double varDouble, boolean varBoolean, byte varByte, javax.xml.namespace.QName varQName, java.util.Calendar varDateTime, java.lang.String varSoapString, java.lang.Boolean varSoapBoolean, java.lang.Float varSoapFloat, java.lang.Double varSoapDouble, java.math.BigDecimal varSoapDecimal, java.lang.Integer varSoapInt, java.lang.Short varSoapShort, java.lang.Byte varSoapByte, byte[] varBase64Binary, byte[] varHexBinary, byte[] varSoapBase64) { this.varString = varString; this.varInteger = varInteger; this.varInt = varInt; this.varLong = varLong; this.varShort = varShort; this.varDecimal = varDecimal; this.varFloat = varFloat; this.varDouble = varDouble; this.varBoolean = varBoolean; this.varByte = varByte; this.varQName = varQName; this.varDateTime = varDateTime; this.varSoapString = varSoapString; this.varSoapBoolean = varSoapBoolean; this.varSoapFloat = varSoapFloat; this.varSoapDouble = varSoapDouble; this.varSoapDecimal = varSoapDecimal; this.varSoapInt = varSoapInt; this.varSoapShort = varSoapShort; this.varSoapByte = varSoapByte; this.varBase64Binary = varBase64Binary; this.varHexBinary = varHexBinary; this.varSoapBase64 = varSoapBase64; } public java.lang.String getVarString() { return varString; } public void setVarString(java.lang.String varString) { this.varString = varString; } public java.math.BigInteger getVarInteger() { return varInteger; } public void setVarInteger(java.math.BigInteger varInteger) { this.varInteger = varInteger; } public int getVarInt() { return varInt; } public void setVarInt(int varInt) { this.varInt = varInt; } public long getVarLong() { return varLong; } public void setVarLong(long varLong) { this.varLong = varLong; } public short getVarShort() { return varShort; } public void setVarShort(short varShort) { this.varShort = varShort; } public java.math.BigDecimal getVarDecimal() { return varDecimal; } public void setVarDecimal(java.math.BigDecimal varDecimal) { this.varDecimal = varDecimal; } public float getVarFloat() { return varFloat; } public void setVarFloat(float varFloat) { this.varFloat = varFloat; } public double getVarDouble() { return varDouble; } public void setVarDouble(double varDouble) { this.varDouble = varDouble; } public boolean isVarBoolean() { return varBoolean; } public void setVarBoolean(boolean varBoolean) { this.varBoolean = varBoolean; } public byte getVarByte() { return varByte; } public void setVarByte(byte varByte) { this.varByte = varByte; } public javax.xml.namespace.QName getVarQName() { return varQName; } public void setVarQName(javax.xml.namespace.QName varQName) { this.varQName = varQName; } public java.util.Calendar getVarDateTime() { return varDateTime; } public void setVarDateTime(java.util.Calendar varDateTime) { this.varDateTime = varDateTime; } public java.lang.String getVarSoapString() { return varSoapString; } public void setVarSoapString(java.lang.String varSoapString) { this.varSoapString = varSoapString; } public java.lang.Boolean getVarSoapBoolean() { return varSoapBoolean; } public void setVarSoapBoolean(java.lang.Boolean varSoapBoolean) { this.varSoapBoolean = varSoapBoolean; } public java.lang.Float getVarSoapFloat() { return varSoapFloat; } public void setVarSoapFloat(java.lang.Float varSoapFloat) { this.varSoapFloat = varSoapFloat; } public java.lang.Double getVarSoapDouble() { return varSoapDouble; } public void setVarSoapDouble(java.lang.Double varSoapDouble) { this.varSoapDouble = varSoapDouble; } public java.math.BigDecimal getVarSoapDecimal() { return varSoapDecimal; } public void setVarSoapDecimal(java.math.BigDecimal varSoapDecimal) { this.varSoapDecimal = varSoapDecimal; } public java.lang.Integer getVarSoapInt() { return varSoapInt; } public void setVarSoapInt(java.lang.Integer varSoapInt) { this.varSoapInt = varSoapInt; } public java.lang.Short getVarSoapShort() { return varSoapShort; } public void setVarSoapShort(java.lang.Short varSoapShort) { this.varSoapShort = varSoapShort; } public java.lang.Byte getVarSoapByte() { return varSoapByte; } public void setVarSoapByte(java.lang.Byte varSoapByte) { this.varSoapByte = varSoapByte; } public byte[] getVarBase64Binary() { return varBase64Binary; } public void setVarBase64Binary(byte[] varBase64Binary) { this.varBase64Binary = varBase64Binary; } public byte[] getVarHexBinary() { return varHexBinary; } public void setVarHexBinary(byte[] varHexBinary) { this.varHexBinary = varHexBinary; } public byte[] getVarSoapBase64() { return varSoapBase64; } public void setVarSoapBase64(byte[] varSoapBase64) { this.varSoapBase64 = varSoapBase64; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof AllStruct)) { return false; } final AllStruct struct = (AllStruct)o; if(varBoolean != struct.varBoolean) { return false; } if(varByte != struct.varByte) { return false; } if(varDouble != struct.varDouble) { return false; } if(varFloat != struct.varFloat) { return false; } if(varInt != struct.varInt) { return false; } if(varLong != struct.varLong) { return false; } if(varShort != struct.varShort) { return false; } if(!Arrays.equals(varBase64Binary, struct.varBase64Binary)) { return false; } if(varDateTime != null ? !varDateTime.equals(struct.varDateTime) : struct.varDateTime != null) { return false; } if(varDecimal != null ? !varDecimal.equals(struct.varDecimal) : struct.varDecimal != null) { return false; } if(!Arrays.equals(varHexBinary, struct.varHexBinary)) { return false; } if(varInteger != null ? !varInteger.equals(struct.varInteger) : struct.varInteger != null) { return false; } if(varQName != null ? !varQName.equals(struct.varQName) : struct.varQName != null) { return false; } if(!Arrays.equals(varSoapBase64, struct.varSoapBase64)) { return false; } if(varSoapBoolean != null ? !varSoapBoolean.equals(struct.varSoapBoolean) : struct.varSoapBoolean != null) { return false; } if(varSoapByte != null ? !varSoapByte.equals(struct.varSoapByte) : struct.varSoapByte != null) { return false; } if(varSoapDecimal != null ? !varSoapDecimal.equals(struct.varSoapDecimal) : struct.varSoapDecimal != null) { return false; } if(varSoapDouble != null ? !varSoapDouble.equals(struct.varSoapDouble) : struct.varSoapDouble != null) { return false; } if(varSoapFloat != null ? !varSoapFloat.equals(struct.varSoapFloat) : struct.varSoapFloat != null) { return false; } if(varSoapInt != null ? !varSoapInt.equals(struct.varSoapInt) : struct.varSoapInt != null) { return false; } if(varSoapShort != null ? !varSoapShort.equals(struct.varSoapShort) : struct.varSoapShort != null) { return false; } if(varSoapString != null ? !varSoapString.equals(struct.varSoapString) : struct.varSoapString != null) { return false; } if(varString != null ? !varString.equals(struct.varString) : struct.varString != null) { return false; } return true; } public int hashCode() { int result; long temp; result = (varString != null ? varString.hashCode() : 0); result = 29 * result + (varInteger != null ? varInteger.hashCode() : 0); result = 29 * result + varInt; result = 29 * result + (int)(varLong ^ (varLong >>> 32)); result = 29 * result + (int)varShort; result = 29 * result + (varDecimal != null ? varDecimal.hashCode() : 0); result = 29 * result + varFloat != +0.0f ? Float.floatToIntBits(varFloat) : 0; temp = varDouble != +0.0d ? Double.doubleToLongBits(varDouble) : 0l; result = 29 * result + (int)(temp ^ (temp >>> 32)); result = 29 * result + (varBoolean ? 1 : 0); result = 29 * result + (int)varByte; result = 29 * result + (varQName != null ? varQName.hashCode() : 0); result = 29 * result + (varDateTime != null ? varDateTime.hashCode() : 0); result = 29 * result + (varSoapString != null ? varSoapString.hashCode() : 0); result = 29 * result + (varSoapBoolean != null ? varSoapBoolean.hashCode() : 0); result = 29 * result + (varSoapFloat != null ? varSoapFloat.hashCode() : 0); result = 29 * result + (varSoapDouble != null ? varSoapDouble.hashCode() : 0); result = 29 * result + (varSoapDecimal != null ? varSoapDecimal.hashCode() : 0); result = 29 * result + (varSoapInt != null ? varSoapInt.hashCode() : 0); result = 29 * result + (varSoapShort != null ? varSoapShort.hashCode() : 0); result = 29 * result + (varSoapByte != null ? varSoapByte.hashCode() : 0); return result; } public String toString() { return "[varString=" + varString + "\nvarInteger=" + varInteger + "\nvarInt=" + varInt + "\nvarLong=" + varLong + "\nvarShort=" + varShort + "\nvarDecimal=" + varDecimal + "\nvarFloat=" + varFloat + "\nvarDouble=" + varDouble + "\nvarBoolean=" + varBoolean + "\nvarByte=" + varByte + "\nvarQName=" + varQName + "\nvarDateTime=" + varDateTime + "\nvarSoapString=" + varSoapString + "\nvarSoapBoolean=" + varSoapBoolean + "\nvarSoapFloat=" + varSoapFloat + "\nvarSoapDouble=" + varSoapDouble + "\nvarSoapDecimal=" + varSoapDecimal + "\nvarSoapInt=" + varSoapInt + "\nvarSoapShort=" + varSoapShort + "\nvarSoapByte=" + varSoapByte + "\nvarBase64Binary=" + arrayToString(varBase64Binary) + "\nvarHexBinary=" + arrayToString(varHexBinary) + "\nvarSoapBase64=" + arrayToString(varSoapBase64) + "]"; } } private static String arrayToString(Object arr) { String str; if(arr == null) { str = "null"; } else { StringBuffer buf = new StringBuffer(); buf.append('['); for(int i = 0; i < Array.getLength(arr); ++i) { if(i > 0) { buf.append(", "); } buf.append(Array.get(arr, i)); } buf.append(']'); str = buf.toString(); } return str; } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/IgnorableWhitespaceUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/IgnorableWhitespaceUnitTest0000644000175000017500000001713211061473704033361 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, Red Hat Middleware LLC, and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.io.StringWriter; import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import junit.framework.TestSuite; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.UnmarshallingContext; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.xml.sax.Attributes; /** * IgnorableWhitespaceUnitTestCase. * * @author Carlo de Wolf * @version $Revision$ */ public class IgnorableWhitespaceUnitTestCase extends AbstractJBossXBTest { private static final String NS = "http://www.jboss.org/test/xml/simpleContent"; private static final String XSD = "" + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; public static final TestSuite suite() { return new TestSuite(IgnorableWhitespaceUnitTestCase.class); } public IgnorableWhitespaceUnitTestCase(String name) { super(name); } public void testWhitespaceUnmarshalling() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(XSD), null); schema.setIgnoreUnresolvedFieldOrClass(false); schema.setIgnoreWhitespacesInMixedContent(false); ClassMetaData classMetaData = new ClassMetaData(); classMetaData.setImpl(Top.class.getName()); ElementBinding element = schema.getElement(new QName(NS, "top")); assertNotNull(element); element.setClassMetaData(classMetaData); Top top = (Top) unmarshal("IgnorableWhitespaceContent.xml", schema, Top.class); assertNotNull(top.string); assertEquals(2, top.string.size()); assertEquals(" ", top.string.get(0)); assertEquals("\n newline, 6 spaces, newline, 3 spaces\n ", top.string.get(1)); } public void testWhitespaceMarshalling() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(XSD), null); schema.setIgnoreUnresolvedFieldOrClass(false); schema.setIgnoreWhitespacesInMixedContent(false); ClassMetaData classMetaData = new ClassMetaData(); classMetaData.setImpl(Top.class.getName()); ElementBinding element = schema.getElement(new QName(NS, "top")); assertNotNull(element); element.setClassMetaData(classMetaData); Top top = new Top(); top.string = new ArrayList(); top.string.add(" "); top.string.add("\n newline, 6 spaces, newline, 3 spaces\n "); MarshallerImpl marshaller = new MarshallerImpl(); StringWriter writer = new StringWriter(); marshaller.marshal(schema, null, top, writer); // TODO: the xml diff trims whitespaces... //assertXmlFileContent("IgnorableWhitespaceContent.xml", writer.getBuffer().toString()); //System.out.println(writer.getBuffer().toString()); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(writer.getBuffer().toString()), schema); assertEquals(top, o); } public void testObjectModelFactory() throws Exception { String url = findXML("IgnorableWhitespaceContent.xml"); ObjectModelFactory omf = new OMF(); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(url, omf, null); assertNotNull(o); assertTrue(o instanceof Top); Top top = (Top) o; assertEquals(2, top.string.size()); assertEquals(" ", top.string.get(0)); assertEquals("\n newline, 6 spaces, newline, 3 spaces\n ", top.string.get(1)); } public static final class OMF implements ObjectModelFactory { public Object completeRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName) { return root; } public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs) { ctx.setTrimTextContent(false); return new Top(); } public void setValue(Top top, UnmarshallingContext ctx, String ns, String name, String value) { if(name.equals("string")) { if(top.string == null) { top.string = new ArrayList(); } top.string.add(value); } } } public static class Top { public List string; public int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + ((string == null) ? 0 : string.hashCode()); return result; } public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final Top other = (Top) obj; if (string == null) { if (other.string != null) return false; } else if (!string.equals(other.string)) return false; return true; } public String toString() { return "[top: string=" + string + "]"; } } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/ModelGroupBindingUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/ModelGroupBindingUnitTestCa0000644000175000017500000003126311061473704033257 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.io.StringWriter; import java.util.Arrays; import java.util.Collection; import java.util.List; import org.jboss.xb.binding.AbstractMarshaller; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.Marshaller; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; /** * @author Alexey Loubyansky * @version $Revision: 45337 $ */ public class ModelGroupBindingUnitTestCase extends AbstractJBossXBTest { private static final String XSD = "" + "" + "" + "" + "" + "" + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + "" + ""; private static SchemaBinding SCHEMA; private static final String XML = "" + "item11" + "item12" + "item13" + "item21" + "item22" + "item23" + "choice1" + "choice3" + ""; private static final String LIST_OF_LISTS_XML = "" + "item11" + "item12" + "item21" + "item22" + "item31" + "item32" + ""; private static final List LIST_OF_LISTS = Arrays.asList(new Object[]{ Arrays.asList(new String[]{"item11", "item12"}), Arrays.asList(new String[]{"item21", "item22"}), Arrays.asList(new String[]{"item31", "item32"}) } ); public ModelGroupBindingUnitTestCase(String name) { super(name); } protected void configureLogging() { if(SCHEMA == null) { SCHEMA = XsdBinder.bind(new StringReader(XSD), null); SCHEMA.setIgnoreUnresolvedFieldOrClass(false); } } public void testUnmarshalling() throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); GlobalElement global = (GlobalElement)unmarshaller.unmarshal(new StringReader(XML), SCHEMA); assertEquals(GlobalElement.INSTANCE, global); } /** * XercesXsMarshaller does not support marshalling of model groups since * it is not based on annotations */ public void testMarshallingSunday() throws Exception { marshallingTest(new MarshallerImpl()); } public void testListOfListsUnmarshalling() throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); GlobalElement global = (GlobalElement)unmarshaller.unmarshal(new StringReader(LIST_OF_LISTS_XML), SCHEMA); assertNull(global.choices); assertNull(global.sequences); assertEquals(LIST_OF_LISTS, global.listOfLists); } public void testListOfListsMarshalling() throws Exception { GlobalElement global = new GlobalElement(); global.listOfLists = LIST_OF_LISTS; MarshallerImpl marshaller = new MarshallerImpl(); marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); StringWriter writer = new StringWriter(); marshaller.marshal(SCHEMA, null, global, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(LIST_OF_LISTS_XML, marshalled); } // Private private void marshallingTest(AbstractMarshaller marshaller) throws Exception { marshaller.setProperty(Marshaller.PROP_OUTPUT_INDENTATION, "false"); StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(XSD), new MappingObjectModelProvider(), GlobalElement.INSTANCE, writer); String marshalled = writer.getBuffer().toString(); assertXmlEqual(XML, marshalled); } // Inner public static class GlobalElement { public static final GlobalElement INSTANCE; static { GlobalElement global = new GlobalElement(); global.sequences = Arrays.asList(new Object[]{ new Sequence("item11", "item12", "item13"), new Sequence("item21", "item22", "item23") } ); global.choices = Arrays.asList(new Object[]{ new Choice("choice1", null, null), new Choice(null, null, "choice3") } ); INSTANCE = global; } public Collection sequences; public Collection choices; public Collection listOfLists; public String toString() { return "[global sequences=" + sequences + ", choices=" + choices + ", listOfLists=" + listOfLists + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof GlobalElement)) { return false; } final GlobalElement globalElement = (GlobalElement)o; if(choices != null ? !choices.equals(globalElement.choices) : globalElement.choices != null) { return false; } if(sequences != null ? !sequences.equals(globalElement.sequences) : globalElement.sequences != null) { return false; } return true; } public int hashCode() { int result; result = (sequences != null ? sequences.hashCode() : 0); result = 29 * result + (choices != null ? choices.hashCode() : 0); return result; } // Inner public static class Sequence { public String item1; public String item2; public String item3; public Sequence() { } public Sequence(String item1, String item2, String item3) { this.item1 = item1; this.item2 = item2; this.item3 = item3; } public String toString() { return "[sequence item1=" + item1 + ", item2=" + item2 + ", item3=" + item3 + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Sequence)) { return false; } final Sequence sequence = (Sequence)o; if(item1 != null ? !item1.equals(sequence.item1) : sequence.item1 != null) { return false; } if(item2 != null ? !item2.equals(sequence.item2) : sequence.item2 != null) { return false; } if(item3 != null ? !item3.equals(sequence.item3) : sequence.item3 != null) { return false; } return true; } public int hashCode() { int result; result = (item1 != null ? item1.hashCode() : 0); result = 29 * result + (item2 != null ? item2.hashCode() : 0); result = 29 * result + (item3 != null ? item3.hashCode() : 0); return result; } } public static class Choice { public String choice1; public String choice2; public String choice3; public Choice() { } public Choice(String choice1, String choice2, String choice3) { this.choice1 = choice1; this.choice2 = choice2; this.choice3 = choice3; } public String toString() { return "[choice choice1=" + choice1 + ", choice2=" + choice2 + ", choice3=" + choice3 + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Choice)) { return false; } final Choice choice = (Choice)o; if(choice1 != null ? !choice1.equals(choice.choice1) : choice.choice1 != null) { return false; } if(choice2 != null ? !choice2.equals(choice.choice2) : choice.choice2 != null) { return false; } if(choice3 != null ? !choice3.equals(choice.choice3) : choice.choice3 != null) { return false; } return true; } public int hashCode() { int result; result = (choice1 != null ? choice1.hashCode() : 0); result = 29 * result + (choice2 != null ? choice2.hashCode() : 0); result = 29 * result + (choice3 != null ? choice3.hashCode() : 0); return result; } } } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/WildcardWrapperUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/WildcardWrapperUnitTestCase0000644000175000017500000001003411154172516033322 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import junit.framework.Test; import org.jboss.test.xml.initializer.Simple; import org.jboss.test.xml.initializer.SimpleInitializer; import org.jboss.test.xml.pojoserver.metadata.AbstractValueMetaData; import org.jboss.test.xml.pojoserver.metadata.PropertyInitializer; import org.jboss.test.xml.pojoserver.metadata.PropertyMetaData; import org.jboss.test.xml.pojoserver.metadata.StringValueMetaData; import org.jboss.test.xml.pojoserver.metadata.ValueMetaData; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; /** * WildcardWrapperUnitTestCase. * * @author Adrian Brock * @version $Revision: 40741 $ */ public class WildcardWrapperUnitTestCase extends AbstractJBossXBTest { public static SchemaBindingResolver initResolver() throws Exception { Class clazz = WildcardWrapperUnitTestCase.class; MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); resolver.mapSchemaInitializer(PropertyInitializer.NS, PropertyInitializer.class.getName()); String location = getSchemaLocation(clazz, "WildcardWrapperUnitTestCase.xsd"); resolver.mapSchemaLocation(PropertyInitializer.NS, location); resolver.mapSchemaInitializer(SimpleInitializer.NS, SimpleInitializer.class.getName()); location = getSchemaLocation(clazz, "SchemaBindingInitializerUnitTestCaseSimple.xsd"); resolver.mapSchemaLocation(SimpleInitializer.NS, location); return resolver; } public void testSimple() throws Exception { PropertyMetaData property = (PropertyMetaData) unmarshal(rootName + "Simple.xml", PropertyMetaData.class); ValueMetaData value = property.getValue(); assertNotNull("Should have a value", value); assertTrue(value instanceof StringValueMetaData); StringValueMetaData stringValue = (StringValueMetaData) value; assertEquals("testSimple", stringValue.getValue()); } public void testWildcard() throws Exception { PropertyMetaData property = (PropertyMetaData) unmarshal(rootName + "Wildcard.xml", PropertyMetaData.class); ValueMetaData value = property.getValue(); assertNotNull("Should have a value", value); assertTrue(value instanceof AbstractValueMetaData); AbstractValueMetaData abstractValue = (AbstractValueMetaData) value; Object anyValue = abstractValue.getValue(); assertNotNull("AbstractValue should have a value", anyValue); assertTrue(anyValue instanceof Simple); Simple simple = (Simple) anyValue; assertEquals("testWildcard", simple.getValue()); } /** * Setup the test * * @return the test */ public static Test suite() { return suite(WildcardWrapperUnitTestCase.class); } /** * Create a new WildcardWrapperUnitTestCase. * * @param name the test name */ public WildcardWrapperUnitTestCase(String name) { super(name); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/XMLNameToJavaIdentifierUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/XMLNameToJavaIdentifierUnit0000644000175000017500000001230310513427451033145 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import junit.framework.TestCase; import org.jboss.xb.binding.Util; /** * Tests XML names to various Java identifiers conversion. * * @author Alexey Loubyansky * @version $Revision: 37940 $ */ public class XMLNameToJavaIdentifierUnitTestCase extends TestCase { private static final String[] xmlNames = new String[] { "mixedCaseName", "Answer42", "name-with-dashes", "other_punct-chars", "one2three", "__-invalids-at-the-end---", "ID", "iD" }; private static final String[] clsNames = new String[] { "MixedCaseName", "Answer42", "NameWithDashes", "OtherPunctChars", "One2Three", "InvalidsAtTheEnd", "ID", "ID" }; private static final String[] clsNamesWithLowLines = new String[] { "MixedCaseName", "Answer42", "NameWithDashes", "Other_PunctChars", "One2Three", "__InvalidsAtTheEnd", "ID", "ID" }; private static final String[] fieldNames = new String[] { "mixedCaseName", "answer42", "nameWithDashes", "otherPunctChars", "one2Three", "invalidsAtTheEnd", "ID", "iD" }; private static final String[] getNames = new String[] { "getMixedCaseName", "getAnswer42", "getNameWithDashes", "getOtherPunctChars", "getOne2Three", "getInvalidsAtTheEnd", "getID", "getID" }; private static final String[] setNames = new String[] { "setMixedCaseName", "setAnswer42", "setNameWithDashes", "setOtherPunctChars", "setOne2Three", "setInvalidsAtTheEnd", "setID", "setID" }; private static final String[] constNames = new String[] { "MIXED_CASE_NAME", "ANSWER_42", "NAME_WITH_DASHES", "OTHER_PUNCT_CHARS", "ONE_2_THREE", "INVALIDS_AT_THE_END", "ID", "I_D" }; public XMLNameToJavaIdentifierUnitTestCase(String localName) { super(localName); } public void testXmlNameToClassName() throws Exception { for(int i = 0; i < xmlNames.length; ++i) { String clsName = Util.xmlNameToClassName(xmlNames[i], true); assertEquals(clsNames[i], clsName); } } public void testXmlNameToClassNameWithLowLines() throws Exception { for(int i = 0; i < xmlNames.length; ++i) { String clsName = Util.xmlNameToClassName(xmlNames[i], false); assertEquals(clsNamesWithLowLines[i], clsName); } } public void testXmlNameToGetMethodName() throws Exception { for(int i = 0; i < xmlNames.length; ++i) { String clsName = Util.xmlNameToGetMethodName(xmlNames[i], true); assertEquals(getNames[i], clsName); } } public void testXmlNameToSetMethodName() throws Exception { for(int i = 0; i < xmlNames.length; ++i) { String clsName = Util.xmlNameToSetMethodName(xmlNames[i], true); assertEquals(setNames[i], clsName); } } public void testXmlNameToConstantName() throws Exception { for(int i = 0; i < xmlNames.length; ++i) { String constName = Util.xmlNameToConstantName(xmlNames[i]); assertEquals(constNames[i], constName); } } public void testXmlNameToFieldName() throws Exception { for(int i = 0; i < xmlNames.length; ++i) { String fieldName = Util.xmlNameToFieldName(xmlNames[i], true); assertEquals(fieldNames[i], fieldName); } } public void testXmlNamespaceToJavaPackage() throws Exception { String[] ns = new String[]{ "http://www.acme.com/go/espeak.xsd", "http://example.org/ns/books/", "http://www.w3.org/2001/XMLSchema", "http://example.org/", "http://example.org", "http://www.kloop.com.ua/xsd-schemas/schema1.xsd" }; String[] pkg = new String[]{ "com.acme.go.espeak", "org.example.ns.books", "org.w3._2001.xmlschema", "org.example", "org.example", "ua.com.kloop.xsd_schemas.schema1" }; for(int i = 0; i < ns.length; ++i) { assertEquals(pkg[i], Util.xmlNamespaceToJavaPackage(ns[i])); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/IntrospectionUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/IntrospectionUnitTestCase.j0000644000175000017500000001153010513427451033321 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.beans.PropertyDescriptor; import java.beans.SimpleBeanInfo; import java.beans.IntrospectionException; import org.jboss.xb.binding.introspection.ClassInfo; import org.jboss.xb.binding.introspection.ClassInfos; import org.jboss.xb.binding.introspection.FieldInfo; import junit.framework.TestCase; /** * @author Alexey Loubyansky * @version $Revision: 56570 $ */ public class IntrospectionUnitTestCase extends TestCase { public IntrospectionUnitTestCase(String localName) { super(localName); } public void testClassInfoNANonRequired() throws Exception { assertNull(ClassInfos.getClassInfo("na.package.A", false)); } public void testClassInfoNARequired() throws Exception { try { ClassInfos.getClassInfo("na.package.B", true); fail("Exception must be thrown for not available ClassInfo."); } catch(RuntimeException e) { } } public void testFieldInfoNANonRequired() throws Exception { ClassInfo classInfo = ClassInfos.getClassInfo(A.class); assertNull(classInfo.getFieldInfo("field99", false)); } public void testFieldInfoNARequired() throws Exception { ClassInfo classInfo = ClassInfos.getClassInfo(A.class); try { classInfo.getFieldInfo("field99", true); fail("Exception must be thrown for not availble FieldInfo."); } catch(RuntimeException e) { } } public void testGetterSetterAccess() throws Exception { FieldInfo fieldInfo = ClassInfos.getClassInfo(A.class).getFieldInfo("field1", true); A a = new A(); assertNull(fieldInfo.getValue(a)); a.setField1("val1"); assertEquals("val1", fieldInfo.getValue(a)); fieldInfo.setValue(a, "val2"); assertEquals("val2", fieldInfo.getValue(a)); assertEquals("val2", a.getField1()); } public void testFieldAccess() throws Exception { FieldInfo fieldInfo = ClassInfos.getClassInfo(A.class).getFieldInfo("field2", true); A a = new A(); assertNull(fieldInfo.getValue(a)); a.field2 = "val1"; assertEquals("val1", fieldInfo.getValue(a)); fieldInfo.setValue(a, "val2"); assertEquals("val2", fieldInfo.getValue(a)); assertEquals("val2", a.field2); } public void testReadWriteMethodAccess() throws Exception { FieldInfo fieldInfo = ClassInfos.getClassInfo(A.class).getFieldInfo("field3", true); A a = new A(); assertNull(fieldInfo.getValue(a)); a.writeField3("val1"); assertEquals("val1", fieldInfo.getValue(a)); fieldInfo.setValue(a, "val2"); assertEquals("val2", fieldInfo.getValue(a)); assertEquals("val2", a.readField3()); } public static class A { private String field1; public String field2; private String field3; public String getField1() { return field1; } public void setField1(String field1) { this.field1 = field1; } public String readField3() { return field3; } public void writeField3(String field3) { this.field3 = field3; } } public static class ABeanInfo extends SimpleBeanInfo { public PropertyDescriptor[] getPropertyDescriptors() { try { return new PropertyDescriptor[] { new PropertyDescriptor("field3", A.class, "readField3", "writeField3") }; } catch(IntrospectionException e) { throw new IllegalStateException("Failed to create property descriptors."); } } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/AbstractJBossXBTest.java0000644000175000017500000002306511061473704032462 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.net.URL; import org.jboss.test.AbstractTestCaseWithSetup; import org.jboss.test.AbstractTestDelegate; import org.jboss.util.Classes; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; /** * AbstractJBossXBTest. * * @author Adrian Brock * @version $Revision: 45077 $ */ public class AbstractJBossXBTest extends AbstractTestCaseWithSetup { private static final XmlDiff DIFF = new XmlDiff(); protected String rootName = getRootName(); /** * Create a new AbstractJBossXBTest. * * @param name the name of the test */ public AbstractJBossXBTest(String name) { super(name); } /** * Validates XML content passed in the second argument * against the XML content in the file. * * @param xmlFileName the name of the XML file * @param content the content to validate */ public void assertXmlFileContent(String xmlFileName, String content) { URL expectedUrl = getResource(xmlFileName); if(expectedUrl == null) { fail("File not found: " + xmlFileName); } java.io.InputStream is = null; String expectedContent = null; try { is = expectedUrl.openStream(); byte[] bytes = new byte[is.available()]; is.read(bytes); expectedContent = new String(bytes); } catch(java.io.IOException e) { fail("Failed to read file " + xmlFileName + ": " + e.getMessage()); } finally { if(is != null) { try { is.close(); } catch(Exception ignore) { } } } assertXmlEqual(expectedContent, content); } /** * Validates XML content passed in the second argument * against the expected XML content passed in the first argument. * * @param expected expected content * @param was the content to validate */ public void assertXmlEqual(String expected, String was) { String diff = DIFF.diff(expected, was); if(diff != null) { fail(diff); } } /** * Unmarshal some xml * * @param name the name * @param expected the expected type * @return the unmarshalled object * @throws Exception for any error */ protected Object unmarshal(String name, Class expected) throws Exception { Object object = unmarshal(name); if (object == null) fail("No object from " + name); assertTrue("Object '" + object + "' cannot be assigned to " + expected.getName(), expected.isAssignableFrom(object.getClass())); return object; } /** * Unmarshal some xml * * @param name the name * @param expected the expected type * @param resolver the resolver * @return the unmarshalled object * @throws Exception for any error */ protected Object unmarshal(String name, Class expected, SchemaBindingResolver resolver) throws Exception { Object object = unmarshal(name, resolver); if (object == null) fail("No object from " + name); assertTrue("Object '" + object + "' cannot be assigned to " + expected.getName(), expected.isAssignableFrom(object.getClass())); return object; } /** * Unmarshal some xml * * @param name the name * @return the unmarshalled object * @throws Exception for any error */ protected Object unmarshal(String name) throws Exception { return unmarshal(name, (SchemaBindingResolver) null); } /** * Unmarshal some xml * * @param name the name * @param resolver the resolver * @return the unmarshalled object * @throws Exception for any error */ protected Object unmarshal(String name, SchemaBindingResolver resolver) throws Exception { String url = findXML(name); return getJBossXBDelegate().unmarshal(url, resolver); } /** * Unmarshall some xml

* * The xsd name is UnitTestClass_testName.xsd

* * The xml name is UnitTestClass_testName.xml * * @return the object * @throws Exception for any problem */ protected Object unmarshal() throws Exception { String testXsd = rootName + "_" + getName() + ".xsd"; SchemaBinding schema = bind(testXsd); schema.setIgnoreUnresolvedFieldOrClass(false); String name = rootName + "_" + getName() + ".xml"; return unmarshal(name, schema); } /** * Unmarshall some xml

* * The xsd name is UnitTestClass_testName.xsd

* * The xml name is UnitTestClass_testName.xml * * @param expected the expected class * @return the object * @throws Exception for any problem */ protected Object unmarshal(Class expected) throws Exception { Object object = unmarshal(); if (object == null) fail("No object"); assertTrue("Object '" + object + "' cannot be assigned to " + expected.getName(), expected.isAssignableFrom(object.getClass())); return object; } /** * Unmarshal some xml * * @param name the name * @param schema the schema * @return the unmarshalled object * @throws Exception for any error */ protected Object unmarshal(String name, SchemaBinding schema) throws Exception { String url = findXML(name); return getJBossXBDelegate().unmarshal(url, schema); } /** * Unmarshal some xml * * @param name the name * @param schema the schema * @param expected the expected class * @return the unmarshalled object * @throws Exception for any error */ protected Object unmarshal(String name, SchemaBinding schema, Class expected) throws Exception { Object object = unmarshal(name, schema); if (object == null) fail("No object for " + name); assertTrue("Object '" + object + "' cannot be assigned to " + expected.getName(), expected.isAssignableFrom(object.getClass())); return object; } /** * Bind a schema * * @param name the name * @return the object * @throws Exception for any error */ public SchemaBinding bind(String name) throws Exception { return bind(name, null); } /** * Bind a schema * * @param name the name * @param resolver the resolver * @return the object * @throws Exception for any error */ public SchemaBinding bind(String name, SchemaBindingResolver resolver) throws Exception { String url = findXML(name); return getJBossXBDelegate().bind(url, resolver); } /** * Find the xml * * @param name the name * @return the url of the xml */ protected String findXML(String name) { URL url = getResource(name); if (url == null) fail(name + " not found"); return url.toString(); } /** * Get a schema location * * @param clazz used to get the package * @param schema the schema name * @return the location in the "classpath" */ protected static String getSchemaLocation(Class clazz, String schema) { String packageName = Classes.getPackageName(clazz); packageName = packageName.replace('.', '/'); String name = packageName + '/' + schema; return name; } /** * Setup the test delegate * * @param clazz the class * @return the delegate * @throws Exception for any error */ public static AbstractTestDelegate getDelegate(Class clazz) throws Exception { return new JBossXBTestDelegate(clazz); } protected JBossXBTestDelegate getJBossXBDelegate() { return (JBossXBTestDelegate) getDelegate(); } protected void setUp() throws Exception { super.setUp(); configureLogging(); } /** * Get the package root name * * @return the root name */ protected String getRootName() { String longName = getClass().getName(); int dot = longName.lastIndexOf('.'); if (dot != -1) return longName.substring(dot + 1); return longName; } protected void configureLogging() { //enableTrace("org.jboss.xb"); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/po/0000755000175000017500000000000011620316742026430 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/po/Item.java0000644000175000017500000001063110513427451030172 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.po; import java.math.BigInteger; import java.math.BigDecimal; import java.util.Calendar; import java.text.SimpleDateFormat; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Item { private String productName; private BigInteger quantity; private BigDecimal USPrice; private String comment; private Calendar shipDate; private String partNum; public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } public BigInteger getQuantity() { return quantity; } public void setQuantity(BigInteger quantity) { this.quantity = quantity; } public BigDecimal getUSPrice() { return USPrice; } public void setUSPrice(BigDecimal USPrice) { this.USPrice = USPrice; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } public Calendar getShipDate() { return shipDate; } public void setShipDate(Calendar shipDate) { this.shipDate = shipDate; } public String getPartNum() { return partNum; } public void setPartNum(String partNum) { this.partNum = partNum; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Item)) { return false; } final Item item = (Item)o; if(USPrice != null ? !USPrice.equals(item.USPrice) : item.USPrice != null) { return false; } if(comment != null ? !comment.equals(item.comment) : item.comment != null) { return false; } if(partNum != null ? !partNum.equals(item.partNum) : item.partNum != null) { return false; } if(productName != null ? !productName.equals(item.productName) : item.productName != null) { return false; } if(quantity != null ? !quantity.equals(item.quantity) : item.quantity != null) { return false; } if(shipDate != null ? !shipDate.equals(item.shipDate) : item.shipDate != null) { return false; } return true; } public int hashCode() { int result; result = (productName != null ? productName.hashCode() : 0); result = 29 * result + (quantity != null ? quantity.hashCode() : 0); result = 29 * result + (USPrice != null ? USPrice.hashCode() : 0); result = 29 * result + (comment != null ? comment.hashCode() : 0); result = 29 * result + (shipDate != null ? shipDate.hashCode() : 0); result = 29 * result + (partNum != null ? partNum.hashCode() : 0); return result; } public String toString() { return "[Item productName=" + productName + ", quantity=" + quantity + ", USPrice=" + USPrice + ", comment=" + comment + ", shipDate=" + (shipDate == null ? "null" : new SimpleDateFormat("yyyy.MM.dd HH:mm:ss").format( shipDate.getTime()) ) + ", partNum=" + partNum + "]"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/po/PurchaseOrder.java0000644000175000017500000001255411061473704032051 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.po; import java.util.Collection; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.ArrayList; import java.text.SimpleDateFormat; import java.math.BigDecimal; import java.math.BigInteger; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class PurchaseOrder { public static final PurchaseOrder DEFAULT_INSTANCE = createDefaultInstance(); public static final PurchaseOrder createDefaultInstance() { PurchaseOrder po = new PurchaseOrder(); po.orderDate = new GregorianCalendar(1999, 9, 20); po.shipTo = new USAddress(); po.shipTo.setName("Alice Smith"); po.shipTo.setStreet("123 Maple Street"); po.shipTo.setCity("Mill Valley"); po.shipTo.setState("CA"); po.shipTo.setZip(new BigDecimal((double)90952)); po.billTo = new USAddress(); po.billTo.setName("Robert Smith"); po.billTo.setStreet("8 Oak Avenue"); po.billTo.setCity("Old Town"); po.billTo.setState("PA"); po.billTo.setZip(new BigDecimal((double)95819)); po.comment = "Hurry, my lawn is going wild!"; po.items = new ArrayList(); Item item = new Item(); item.setPartNum("872-AA"); item.setProductName("Lawnmower"); item.setQuantity(BigInteger.valueOf(1)); item.setUSPrice(new BigDecimal("148.95")); item.setComment("Confirm this is electric"); po.items.add(item); item = new Item(); item.setPartNum("926-AA"); item.setProductName("Baby Monitor"); item.setQuantity(BigInteger.valueOf(1)); item.setUSPrice(new BigDecimal("39.98")); item.setShipDate(new GregorianCalendar(1999, 4, 21)); po.items.add(item); return po; } public USAddress shipTo; private USAddress billTo; private String comment; private Collection items; private Calendar orderDate; public USAddress getBillTo() { return billTo; } public void setBillTo(USAddress billTo) { this.billTo = billTo; } public String getComment() { return comment; } public void setComment(String comment) { this.comment = comment; } public Collection getItems() { return items; } public void setItems(Collection items) { this.items = items; } public Calendar getOrderDate() { return orderDate; } public void setOrderDate(Calendar orderDate) { this.orderDate = orderDate; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof PurchaseOrder)) { return false; } final PurchaseOrder purchaseOrder = (PurchaseOrder)o; if(billTo != null ? !billTo.equals(purchaseOrder.billTo) : purchaseOrder.billTo != null) { return false; } if(comment != null ? !comment.equals(purchaseOrder.comment) : purchaseOrder.comment != null) { return false; } if(items != null ? !items.equals(purchaseOrder.items) : purchaseOrder.items != null) { return false; } if(orderDate != null ? !orderDate.equals(purchaseOrder.orderDate) : purchaseOrder.orderDate != null) { return false; } if(shipTo != null ? !shipTo.equals(purchaseOrder.shipTo) : purchaseOrder.shipTo != null) { return false; } return true; } public int hashCode() { int result; result = (shipTo != null ? shipTo.hashCode() : 0); result = 29 * result + (billTo != null ? billTo.hashCode() : 0); result = 29 * result + (comment != null ? comment.hashCode() : 0); result = 29 * result + (items != null ? items.hashCode() : 0); result = 29 * result + (orderDate != null ? orderDate.hashCode() : 0); return result; } public String toString() { return "[purchaseOrder shipto=" + shipTo + ", billTo=" + billTo + ", comment=" + comment + ", items=" + items + ", orderDate=" + (orderDate == null ? "null" : new SimpleDateFormat("yyyy.MM.dd HH:mm:ss").format( orderDate.getTime())) + "]"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/po/USAddress.java0000644000175000017500000000742710513427451031142 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.po; import java.math.BigDecimal; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class USAddress { private final String country = "US"; private String name; private String street; private String city; private String state; private BigDecimal zip; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getStreet() { return street; } public void setStreet(String street) { this.street = street; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getState() { return state; } public void setState(String state) { this.state = state; } public BigDecimal getZip() { return zip; } public void setZip(BigDecimal zip) { this.zip = zip; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof USAddress)) { return false; } final USAddress usAddress = (USAddress)o; if(city != null ? !city.equals(usAddress.city) : usAddress.city != null) { return false; } if(country != null ? !country.equals(usAddress.country) : usAddress.country != null) { return false; } if(name != null ? !name.equals(usAddress.name) : usAddress.name != null) { return false; } if(state != null ? !state.equals(usAddress.state) : usAddress.state != null) { return false; } if(street != null ? !street.equals(usAddress.street) : usAddress.street != null) { return false; } if(zip != null ? !zip.equals(usAddress.zip) : usAddress.zip != null) { return false; } return true; } public int hashCode() { int result; result = (country != null ? country.hashCode() : 0); result = 29 * result + (name != null ? name.hashCode() : 0); result = 29 * result + (street != null ? street.hashCode() : 0); result = 29 * result + (city != null ? city.hashCode() : 0); result = 29 * result + (state != null ? state.hashCode() : 0); result = 29 * result + (zip != null ? zip.hashCode() : 0); return result; } public String toString() { return "[USAddress name=" + name + ", street=" + street + ", city=" + city + ", state=" + state + ", zip=" + zip + "]"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/immutable/0000755000175000017500000000000011620316742027771 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/immutable/Child3.java0000644000175000017500000000362410513427451031747 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.immutable; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Child3 { private final String name; public Child3(String name) { this.name = name; } public String getName() { return name; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Child3)) { return false; } final Child3 child3 = (Child3)o; if(name != null ? !name.equals(child3.name) : child3.name != null) { return false; } return true; } public int hashCode() { return (name != null ? name.hashCode() : 0); } public String toString() { return "[" + name + "]"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/immutable/Parent.java0000644000175000017500000000673211061473704032076 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.immutable; import java.util.Collection; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Parent { private final Child1 child1; private final Collection child2; private final Collection otherChildren; private final Collection immutableChoice; public Parent(Child1 child1, Collection child2, Collection otherChildren, Collection immutableChoice) { this.child1 = child1; this.child2 = child2; this.otherChildren = otherChildren; this.immutableChoice = immutableChoice; } public Child1 getChild1() { return child1; } public Collection getChild2() { return child2; } public Collection getOtherChildren() { return otherChildren; } public Collection getImmutableChoice() { return immutableChoice; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Parent)) { return false; } final Parent parent = (Parent)o; if(child1 != null ? !child1.equals(parent.child1) : parent.child1 != null) { return false; } if(child2 != null ? !child2.equals(parent.child2) : parent.child2 != null) { return false; } if(immutableChoice != null ? !immutableChoice.equals(parent.immutableChoice) : parent.immutableChoice != null) { return false; } if(otherChildren != null ? !otherChildren.equals(parent.otherChildren) : parent.otherChildren != null) { return false; } return true; } public int hashCode() { int result; result = (child1 != null ? child1.hashCode() : 0); result = 29 * result + (child2 != null ? child2.hashCode() : 0); result = 29 * result + (otherChildren != null ? otherChildren.hashCode() : 0); result = 29 * result + (immutableChoice != null ? immutableChoice.hashCode() : 0); return result; } public String toString() { return "[child1=" + child1 + ", child2=" + child2 + ", otherChildren=" + otherChildren + ", immutableChoice=" + immutableChoice + "]"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/immutable/Child1.java0000644000175000017500000000362410513427451031745 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.immutable; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Child1 { private final String name; public Child1(String name) { this.name = name; } public String getName() { return name; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Child1)) { return false; } final Child1 child1 = (Child1)o; if(name != null ? !name.equals(child1.name) : child1.name != null) { return false; } return true; } public int hashCode() { return (name != null ? name.hashCode() : 0); } public String toString() { return "[" + name + "]"; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/immutable/Child2.java0000644000175000017500000000362410513427451031746 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.immutable; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class Child2 { private final String name; public Child2(String name) { this.name = name; } public String getName() { return name; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Child2)) { return false; } final Child2 child2 = (Child2)o; if(name != null ? !name.equals(child2.name) : child2.name != null) { return false; } return true; } public int hashCode() { return (name != null ? name.hashCode() : 0); } public String toString() { return "[" + name + "]"; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/immutable/ImmutableChoice.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/immutable/ImmutableChoice.j0000644000175000017500000000502610513427451033201 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml.immutable; /** * @author Alexey Loubyansky * @version $Revision: 37406 $ */ public class ImmutableChoice { private final String choice1; private final Child1 child1; public ImmutableChoice(String choice1) { this.choice1 = choice1; this.child1 = null; } public ImmutableChoice(Child1 choice2) { this.choice1 = null; this.child1 = choice2; } public String getChoice1() { return choice1; } public Child1 getChild1() { return child1; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof ImmutableChoice)) { return false; } final ImmutableChoice immutableChoice = (ImmutableChoice)o; if(choice1 != null ? !choice1.equals(immutableChoice.choice1) : immutableChoice.choice1 != null) { return false; } if(child1 != null ? !child1.equals(immutableChoice.child1) : immutableChoice.child1 != null) { return false; } return true; } public int hashCode() { int result; result = (choice1 != null ? choice1.hashCode() : 0); result = 29 * result + (child1 != null ? child1.hashCode() : 0); return result; } public String toString() { return "[choice1=" + choice1 + ", child1=" + child1 + "]"; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/QNameAttributesUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/QNameAttributesUnitTestCase0000644000175000017500000001620310513427451033303 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import java.io.StringWriter; import java.io.IOException; import javax.xml.namespace.QName; import javax.xml.parsers.ParserConfigurationException; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.MappingObjectModelProvider; import org.jboss.xb.binding.XercesXsMarshaller; import org.jboss.xb.binding.AbstractMarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.sunday.marshalling.MarshallerImpl; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.xml.sax.SAXException; /** * @author Alexey Loubyansky * @version $Revision: 46059 $ */ public class QNameAttributesUnitTestCase extends AbstractJBossXBTest { private static final String XSD = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; private static final String XML = "" + ""; private static final String ARR_XML = "" + " local2_ns:local2" + " ns3:local3" + " ns4:local4" + ""; private static final MappingObjectModelProvider OM_PROVIDER = new MappingObjectModelProvider(); public QNameAttributesUnitTestCase(String name) { super(name); } // Tests public void testMarshallingXerces() throws Exception { assertMarshalling(new XercesXsMarshaller()); } public void testMarshallingSunday() throws Exception { assertMarshalling(new MarshallerImpl()); } public void testUnmarshalling() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(XSD), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(XML), schema); assertNotNull(o); assertTrue(o instanceof UserType); UserType ut = (UserType)o; assertNotNull(ut.qname); assertEquals("local1", ut.qname.getLocalPart()); assertEquals("http://ns1", ut.qname.getNamespaceURI()); assertNotNull(ut.qname2); assertEquals("local2", ut.qname2.getLocalPart()); assertEquals("", ut.qname2.getNamespaceURI()); assertNotNull(ut.qname3); assertEquals("local3", ut.qname3.getLocalPart()); assertEquals("http://x", ut.qname3.getNamespaceURI()); } public void testUnmarshallingArray() throws Exception { SchemaBinding schema = XsdBinder.bind(new StringReader(XSD), null); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(ARR_XML), schema); assertNotNull(o); assertTrue(o instanceof UserType); UserType ut = (UserType)o; assertNull(ut.qname); assertNull(ut.qname2); assertNull(ut.qname3); assertNotNull(ut.arr); assertEquals(3, ut.arr.length); assertEquals(new QName("http://ns2", "local2"), ut.arr[0]); assertEquals(new QName("http://ns3", "local3"), ut.arr[1]); assertEquals(new QName("http://ns4", "local4"), ut.arr[2]); } public void testMarshallingArrayXerces() throws Exception { assertMarshallingArray(new XercesXsMarshaller()); } public void testMarshallingArraySunday() throws Exception { assertMarshallingArray(new MarshallerImpl()); } // Private private void assertMarshallingArray(AbstractMarshaller marshaller) throws IOException, SAXException, ParserConfigurationException { UserType ut = new UserType(); ut.arr = new QName[]{ new QName("http://ns2", "local2"), new QName("http://ns3", "local3", "ns3"), new QName("http://ns4", "local4", "ns4") }; StringWriter writer = new StringWriter(); marshaller.marshal(new StringReader(XSD), OM_PROVIDER, ut, writer); assertXmlEqual(ARR_XML, writer.getBuffer().toString()); } private void assertMarshalling(AbstractMarshaller marshaller) throws IOException, SAXException, ParserConfigurationException { UserType ut = new UserType(); ut.qname = new QName("http://ns1", "local1"); ut.qname2 = new QName("local2"); ut.qname3 = new QName("http://x", "local3"); StringWriter writer = new StringWriter(); marshaller.declareNamespace("x", "http://x"); marshaller.marshal(new StringReader(XSD), OM_PROVIDER, ut, writer); assertXmlEqual(XML, writer.getBuffer().toString()); } public static final class UserType { public QName qname; public QName qname2; public QName qname3; public QName[] arr; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/JNDIBindingUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/JNDIBindingUnitTestCase.jav0000644000175000017500000001062211357571642033041 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.net.InetAddress; import java.net.URL; import java.util.Properties; import org.jboss.test.xml.naming.JNDIBinding; import org.jboss.test.xml.naming.JNDIBindings; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; /** * A JNDIBindingUnitTestCase. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class JNDIBindingUnitTestCase extends AbstractJBossXBTest { public JNDIBindingUnitTestCase(String name) { super(name); } public void testJNDIBinding() throws Exception { MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); resolver.mapSchemaLocation("urn:jboss:jndi-binding-service:1.0", "xml/naming/jndi-binding-service_1_0.xsd"); resolver.mapSchemaLocation("urn:jboss:custom-object-binding", "xml/naming/custom-object-binding.xsd"); String xml = getFullPath("xml/naming/testBindings.xml"); Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); JNDIBindings jndiBindings = (JNDIBindings) unmarshaller.unmarshal(xml, resolver); assertNotNull(jndiBindings); JNDIBinding[] bindings = jndiBindings.getBindings(); assertNotNull(bindings); assertEquals(5, bindings.length); JNDIBinding binding = bindings[0]; assertNotNull(binding); assertEquals("ctx1/key1", binding.getName()); assertEquals("value1", binding.getValue()); assertNull(binding.getEditor()); assertNull(binding.getType()); assertTrue(binding.isTrim()); binding = bindings[1]; assertNotNull(binding); assertEquals("ctx1/user.home", binding.getName()); assertEquals(System.getProperty("user.home"), binding.getValue()); assertNull(binding.getEditor()); assertNull(binding.getType()); assertTrue(binding.isTrim()); binding = bindings[2]; assertNotNull(binding); assertEquals("ctx1/key2", binding.getName()); assertEquals(new URL("http://www.jboss.org"), binding.getValue()); assertNull(binding.getEditor()); assertEquals("java.net.URL", binding.getType()); assertTrue(binding.isTrim()); binding = bindings[3]; assertNotNull(binding); assertEquals("ctx2/key1", binding.getName()); Properties props = (Properties) binding.getValue(); assertNotNull(props); assertEquals(2, props.size()); assertEquals("value1", props.getProperty("key1")); assertEquals("value2", props.getProperty("key2")); assertNull(binding.getEditor()); assertNull(binding.getType()); assertFalse(binding.isTrim()); binding = bindings[4]; assertNotNull(binding); assertEquals("hosts/localhost", binding.getName()); assertEquals(InetAddress.getByName("127.0.0.1"), binding.getValue()); assertEquals("org.jboss.util.propertyeditor.InetAddressEditor", binding.getEditor()); assertNull(binding.getType()); assertTrue(binding.isTrim()); } private String getFullPath(String name) { URL url = Thread.currentThread().getContextClassLoader().getResource(name); if(url == null) { fail("Resource not found: " + name); } return url.getFile(); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/ExceptionUnitTestCase.java0000644000175000017500000001315310513427451033112 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.io.StringReader; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; /** * @author Alexey Loubyansky * @version $Revision: 41107 $ */ public class ExceptionUnitTestCase extends AbstractJBossXBTest { private static final String XSD = "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; private static final String EXC_XML = ""; private static final String EXC_MSG_XML = "" + " didn't work" + ""; private static final String EXC_CAUSE_XML = "" + " " + " didn't work" + " " + ""; private static final String EXC_MSG_CAUSE_XML = "" + " see cause" + " " + " didn't work" + " " + ""; private static SchemaBinding SCHEMA; static { /* Validator.assertValidXml(XSD, EXC_XML); Validator.assertValidXml(XSD, EXC_MSG_XML); Validator.assertValidXml(XSD, EXC_CAUSE_XML); Validator.assertValidXml(XSD, EXC_MSG_CAUSE_XML); */ } public ExceptionUnitTestCase(String name) { super(name); } protected void configureLogging() { //enableTrace(XsdBinder.class.getName()); if(SCHEMA == null) { SCHEMA = XsdBinder.bind(new StringReader(XSD), null); } } public void testUnmarshallingExcXml() throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(EXC_XML), SCHEMA); assertNotNull(o); assertTrue(o instanceof Exception); Exception e = (Exception)o; assertNull(e.getMessage()); assertNull(e.getCause()); } public void testUnmarshallingExcMsgXml() throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(EXC_MSG_XML), SCHEMA); assertNotNull(o); assertTrue(o instanceof Exception); Exception e = (Exception)o; assertEquals("didn't work", e.getMessage()); assertNull(e.getCause()); } public void testUnmarshallingExcCauseXml() throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(EXC_CAUSE_XML), SCHEMA); assertNotNull(o); assertTrue(o instanceof Exception); Exception e = (Exception)o; assertEquals("java.lang.Exception: didn't work", e.getMessage()); assertNotNull(e.getCause()); e = (Exception)e.getCause(); assertEquals("didn't work", e.getMessage()); assertNull(e.getCause()); } public void testUnmarshallingExcMsgCauseXml() throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); Object o = unmarshaller.unmarshal(new StringReader(EXC_MSG_CAUSE_XML), SCHEMA); assertNotNull(o); assertTrue(o instanceof Exception); Exception e = (Exception)o; assertEquals("see cause", e.getMessage()); assertNotNull(e.getCause()); e = (Exception)e.getCause(); assertEquals("didn't work", e.getMessage()); assertNull(e.getCause()); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/test/java/org/jboss/test/xml/RepeatableTermsUnitTestCase0000644000175000017500000002023311062060756033311 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.test.xml; import java.util.Arrays; import java.util.List; import org.jboss.test.xml.repeatableterms.AbstractProduct; import org.jboss.test.xml.repeatableterms.Product; import org.jboss.test.xml.repeatableterms.ProductArray; import junit.framework.TestSuite; /** * @author Alexey Loubyansky * @version $Revision: $ */ public class RepeatableTermsUnitTestCase extends AbstractJBossXBTest { public RepeatableTermsUnitTestCase(String name) { super(name); } public static final TestSuite suite() { return new TestSuite(RepeatableTermsUnitTestCase.class); } protected void configureLogging() { //enableTrace("org.jboss.xb.binding.sunday"); //enableTrace("org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding"); //enableTrace("org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding"); } public void testUnmarshal1() throws Exception { Object o = unmarshal(); assertNotNull(o); assertTrue(o instanceof Top); Top top = (Top)o; assertNotNull(top.item); assertEquals(3, top.item.length); assertEquals(new String[]{"item1", "item2", "item3"}, top.item); assertNotNull(top.sequence); //assertEquals(5, top.sequence.length); assertEquals( new Sequence[] { new Sequence("sequenceChoice1_1", null), new Sequence(null, "sequenceChoice2_1"), new Sequence("sequenceChoice1_2", null), new Sequence("sequenceChoice1_3", null), new Sequence(null, "sequenceChoice2_2") }, top.sequence ); assertNotNull(top.choice); assertEquals(3, top.choice.length); assertEquals( new Choice[] { new Choice(new String[]{"choiceChoice1_1", "choiceChoice1_2"}, null), new Choice(null, new String[]{"choiceChoice2_1", "choiceChoice2_2"}), new Choice(new String[]{"choiceChoice1_3", "choiceChoice1_4"}, null), }, top.choice ); } public void testUnmarshal2() throws Exception { Object o = unmarshal(); assertNotNull(o); assertTrue(o instanceof Top); Top top = (Top)o; assertNull(top.item); assertNull(top.choice); assertNull(top.sequence); assertEquals("item1", top.item1); assertEquals("item2", top.item2); } public void testPolymorphicArray() throws Exception { Object o = unmarshal(); assertNotNull(o); assertTrue(o instanceof ProductArray); ProductArray arr = (ProductArray) o; List products = arr.getProduct(); assertNotNull(products); assertEquals(3, products.size()); int i = 0; while(i < products.size()) { Product product = (Product) products.get(i++); assertNotNull(product); assertEquals("product" + i, product.getName()); assertEquals(i, product.getPrice()); } } public void testPolymorphicArray2() throws Exception { Object o = unmarshal(); assertNotNull(o); assertTrue(o instanceof ProductArray); ProductArray arr = (ProductArray) o; List products = arr.getProduct(); assertNotNull(products); assertEquals(3, products.size()); int i = 0; AbstractProduct product = products.get(i++); assertNotNull(product); assertEquals("product" + i, product.getName()); assertFalse(product instanceof Product); product = products.get(i++); assertNotNull(product); assertEquals("product" + i, product.getName()); assertTrue(product instanceof Product); assertEquals(i, ((Product)product).getPrice()); product = products.get(i++); assertNotNull(product); assertEquals("product" + i, product.getName()); assertFalse(product instanceof Product); } // Inner public static final class Top { public String[] item; public Sequence[] sequence; public Choice[] choice; public String item1; public String item2; public String toString() { return "[top item=" + (item == null ? null : Arrays.asList(item)) + " sequence=" + (sequence == null ? null : Arrays.asList(sequence)) + " choice=" + (choice == null ? null : Arrays.asList(choice)) + " item1=" + item1 + " item2=" + item2 + "]"; } } public static final class Sequence { public String sequenceChoice1; public String sequenceChoice2; public Sequence() { } public Sequence(String sequenceChoice1, String sequenceChoice2) { this.sequenceChoice1 = sequenceChoice1; this.sequenceChoice2 = sequenceChoice2; } public String toString() { return "[" + sequenceChoice1 + " " + sequenceChoice2 + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Sequence)) { return false; } final Sequence sequence = (Sequence)o; if(sequenceChoice1 != null ? !sequenceChoice1.equals(sequence.sequenceChoice1) : sequence.sequenceChoice1 != null) { return false; } if(sequenceChoice2 != null ? !sequenceChoice2.equals(sequence.sequenceChoice2) : sequence.sequenceChoice2 != null) { return false; } return true; } public int hashCode() { int result; result = (sequenceChoice1 != null ? sequenceChoice1.hashCode() : 0); result = 29 * result + (sequenceChoice2 != null ? sequenceChoice2.hashCode() : 0); return result; } } public static final class Choice { public String[] choiceChoice1; public String[] choiceChoice2; public Choice() { } public Choice(String[] choiceChoice1, String[] choiceChoice2) { this.choiceChoice1 = choiceChoice1; this.choiceChoice2 = choiceChoice2; } public String toString() { return "[" + (choiceChoice1 == null ? null : Arrays.asList(choiceChoice1)) + " " + (choiceChoice2 == null ? null : Arrays.asList(choiceChoice2)) + "]"; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof Choice)) { return false; } final Choice choice = (Choice)o; if(!Arrays.equals(choiceChoice1, choice.choiceChoice1)) { return false; } if(!Arrays.equals(choiceChoice2, choice.choiceChoice2)) { return false; } return true; } public int hashCode() { return 0; } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/etc/0000755000175000017500000000000011620316770021200 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/etc/default.mf0000644000175000017500000000067110470642610023151 0ustar twernertwernerManifest-Version: 1.0 Created-By: @java.vm.version@ (@java.vm.vendor@) Specification-Title: @specification.title@ Specification-Version: @specification.version@ Specification-Vendor: @specification.vendor@ Implementation-Title: @implementation.title@ Implementation-URL: @implementation.url@ Implementation-Version: @implementation.version@ Implementation-Vendor: @implementation.vendor@ Implementation-Vendor-Id: @implementation.vendor.id@ libjboss-xml-binding-java-2.0.3.GA.orig/src/main/0000755000175000017500000000000011620316770021351 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/resources/0000755000175000017500000000000011620316770023363 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/resources/schema/0000755000175000017500000000000011620316770024623 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/resources/schema/javabean_2_0.xsd0000644000175000017500000001367111260156126027557 0ustar twernertwerner SomeValue ... ]]> ]]> String value e.g. static factory - com.acme.Factory.newInstance(new String("String value")); String value ]]> Some value e.g. Overridding the injected type Some value ]]> An extension value The elements that use this type designate the name of a Java class or interface. The name is in the form of a "binary name", as defined in the JLS and as used in Class.forName(). libjboss-xml-binding-java-2.0.3.GA.orig/src/main/resources/schema/jbxb_1_0.xsd0000644000175000017500000005165110763015442026736 0ustar twernertwerner The JBossXB schema customization elements This element defines default bindings for the schema The ignoreUnresolvedFieldOrClass specifies the behavior the parser chooses when a field is not found in the parent class for a child value, or when an element does not have any class assignement. If false, an exception will be thrown when either situation is encountered. If true, the missing mapping is ignored and the parse continues. The replacePropertyRefs flag indicates whether the text content of values has ${x} system property references replaced during parsing. The default is true. Defines the default package for the schema which is used for searching classes when unmarshalling elements of complex types. If jbxb:package is not present, schema's namespace URI will be used as the base to generate the default package name for the schema (the mapping is defined in JAXB2.0 spec D.5.1 Mapping from a Namespace URI). Example: ]]> Binds text content of complex types. This element is just a container for jbxb:value, jbxb:property, jbxb:mapEntryKey, jbxb:mapEntryValue elements, all of them are optional. This element can only appear inside complex type definitions. Example: ... ]]> Binds XML element or complex type to a Java class which is specified as a value of attribute 'impl'. If jbxb:class is used inside complex type definition, all elements of this complex type will be unmarshalled into the specified Java type unless there is overriding jbxb:class in an element declaration. Example: ... ]]> Binds an element to property/field in a class. This element can appear inside an element definition or inside jbxb:characters. If jbxb:property is not specified for an element, the property name is resolved based on the element's name using "D.2 The Name to Identifier Mapping Algorithm" defined in JAXB2.0 spec. Example: ]]> Binds text value (attribute value or text content) to a Java value. There are two attributes: unmarshalMethod which specfies a public static method that is used to unmarshal text values and marshalMethod which also a public static method that is used to marshal Java values. Both methods are defined as concatenation of fully-qualified class name, '.' and the method name. unmarshalMethod must have two parameters: the first one of type java.lang.String and the second one is of type javax.xml.namespace.NamespaceContext. marshalMethod must also have two parameters: the first one is of type java.lang.Object and the second one is of type javax.xml.namespace.NamespaceContext. jbxb:value can appear inside simple type definitions, attribute declarations and jbxb:characters. If jbxb:value is not used, text values are unmarshalled using default simple types to Java bindings defained in JAXB2.0 spec. If simple type is a user-defined, by default it is not unmarshalled and passed as a string. Example: public class KernelControllerStateDatatypeConverter { public static KernelControllerState unmarshal(String text, NamespaceContext nsCtx) { KernelControllerState state; if(KernelControllerState.NOT_INSTALLED.getStateString().equals(text)) { state = KernelControllerState.NOT_INSTALLED; } else ... ]]> Specified on an element that should be added to its parent not with a setter (is not a property) and not with a field but with a custom method. The attributes are: * name - the name of the method. There is not default value for this attribute. It must be set. * valueType - the type of the argument. If not present, the default is java.lang.Object. And there is a special value 'child' which means the type of the child should be used as the argument's type. Example: ]]> This required attribute specifies the name of the add method the type of the add method argument. If not present, the default is java.lang.Object. And there is a special value 'child' which means the type of the child should be used as the argument's type. the method name in the parent object's class that adds child to to its parent object. If not present, the default is 'put'. fully qualified type name of the key-parameter to the put-method. If not present, the default is java.lang.Object. fully qualified type name of the value-parameter to the put-method. If not present, the default is java.lang.Object. Specified on an element or a complex type definition that is bound to a map entry. jbxb:class and jbxb:mapEntry are mutually exclusive, meanning an element or a complex type cannot be annotated with both jbxb:class and jbxb:mapEntry at the same time. Otherwise, it will result in an exception during binding. an optional element that specifies a fully qualified name of the class that will represent map entry. If absent, a special class will be used by the framework internally. an optional attribute that specifies the name of the method that is used to get the key out of the object that represents a map entry. an optional attribute that specifies the name of the method that is used to set the key value on the object that represents a map entry. an optional element that specifies the name of the method that is used to get the value out of the object that represents a map entry. If absent and impl attribute is absent too, the default value is "getValue". If absent and impl attribute is present, the value will be the object that reprents the map entry itself. an optional element that specifies the name of the method that is used to set the value on the object that represents a map entry. an optional attribute that specifies the type of the map entry value. Used when map entry value should be a parent for element/type's content. If true, when a map entry is created, a non-null map entry value will also be created and set on the map entry. Otherwise, a map entry object is created with null value and the value will be created and set later when it is actually parsed. This attribute is used in combination with valueType. This element is a marker element that has no attributes. It is specified on an element, attribute or inside jbxb:characters to specify that the element, attribute or characters should be used as the key in map entry. This element is a marker element that has no attributes. It is specified on an element, attribute or inside jbxb:characters to specify that the element, attribute or characters should be used as the value in map entry. Example: ]]> This element can be used on an element declaration or a complex type definition. Unmarshaller will not try to create new objects for elements (or elements of complex types) that are annotated with jbxb:skip. Instead, the object that was created for the parent of such elements will be propagated and values of attributes, character contents and child elements of such elements will be set on their parent's object. Example: ]]>In the example above, login-modules will be added to the parent of authentication element. libjboss-xml-binding-java-2.0.3.GA.orig/src/main/resources/schema/javabean_1_0.xsd0000644000175000017500000000671511260156126027557 0ustar twernertwerner SomeValue ... ]]> ]]> Some value e.g. Overridding the injected type Some value ]]> An extension value The elements that use this type designate the name of a Java class or interface. The name is in the form of a "binary name", as defined in the JLS and as used in Class.forName(). libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/0000755000175000017500000000000011620316762022273 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/0000755000175000017500000000000011620316762023062 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/0000755000175000017500000000000011620316762024202 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/0000755000175000017500000000000011620316762025751 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/0000755000175000017500000000000011620316762027432 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/0000755000175000017500000000000011620316762030356 5ustar twernertwerner././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/Parameter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/Parameter.java0000644000175000017500000000316110763033236033141 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.javabean.plugins.jaxb; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; /** * Parameter. * * @author Ales Justin * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlType(name="propertyType") public class Parameter extends AbstractParameter { private String paramType; public String getParamType() { return paramType; } @XmlAttribute(name="paramClass") public void setParamType(String type) { this.paramType = type; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/AbstractParameter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/AbstractParame0000644000175000017500000000344610763033236033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.javabean.plugins.jaxb; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlValue; /** * Abstrat Parameter. * * @author Ales Justin * @author Adrian Brock * @version $Revision: 1.1 $ */ public class AbstractParameter { private String type; private Object value; public String getType() { return type; } @XmlAttribute(name="class") public void setType(String type) { this.type = type; } public Object getValue() { return value; } @XmlValue @XmlAnyElement public void setValue(Object value) { this.value = value; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/Property.java0000644000175000017500000000311510763033236033044 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.javabean.plugins.jaxb; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; /** * Property. * * @author Ales Justin * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlType(name="propertyType") public class Property extends AbstractParameter { private String name; public String getName() { return name; } @XmlAttribute(name="name") public void setName(String name) { this.name = name; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/JavaBeanBuilder10.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/JavaBeanBuilde0000644000175000017500000000314110763015442033072 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.javabean.plugins.jaxb; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.xb.spi.BeanAdapterBuilder; import org.jboss.xb.spi.BeanAdapterFactory; /** * JavaBeanBuilder version 1. * * @author Ales Justin * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JavaBeanBuilder10 implements BeanAdapterBuilder { public BeanAdapterFactory newFactory(BeanInfo beanInfo, MethodInfo factory) { return new JavaBeanFactory10(); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/JavaBeanBuilder20.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/JavaBeanBuilde0000644000175000017500000000314110763015442033072 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.javabean.plugins.jaxb; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.xb.spi.BeanAdapterBuilder; import org.jboss.xb.spi.BeanAdapterFactory; /** * JavaBeanBuilder version 2. * * @author Ales Justin * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JavaBeanBuilder20 implements BeanAdapterBuilder { public BeanAdapterFactory newFactory(BeanInfo beanInfo, MethodInfo factory) { return new JavaBeanFactory20(); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/JavaBeanFactory10.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/JavaBeanFactor0000644000175000017500000000272410763015442033112 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.javabean.plugins.jaxb; import org.jboss.xb.spi.BeanAdapter; import org.jboss.xb.spi.BeanAdapterFactory; /** * JavaBeanFactory version 1. * * @author Ales Justin * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JavaBeanFactory10 extends BeanAdapterFactory { public BeanAdapter newInstance() { return new JavaBean10(this); } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/JavaBeanFactory20.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/JavaBeanFactor0000644000175000017500000000272410763015442033112 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.javabean.plugins.jaxb; import org.jboss.xb.spi.BeanAdapter; import org.jboss.xb.spi.BeanAdapterFactory; /** * JavaBeanFactory version 2. * * @author Ales Justin * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JavaBeanFactory20 extends BeanAdapterFactory { public BeanAdapter newInstance() { return new JavaBean20(this); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/JavaBean.java0000644000175000017500000002002210763033236032663 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.javabean.plugins.jaxb; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.List; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlTransient; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.config.plugins.property.PropertyConfiguration; import org.jboss.config.spi.Configuration; import org.jboss.joinpoint.plugins.Config; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.util.propertyeditor.PropertyEditors; import org.jboss.xb.spi.BeanAdapter; import org.jboss.xb.spi.BeanAdapterFactory; /** * JavaBean. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JavaBean extends BeanAdapter { private static Configuration configuration; static { init(); } static synchronized void init() { if(configuration == null) { configuration = AccessController.doPrivileged(new PrivilegedAction() { public Configuration run() { return new PropertyConfiguration(System.getProperties()); } }); PropertyEditors.init(); } } private String className; private Constructor constructor; private Property[] properties; public JavaBean(BeanAdapterFactory beanAdapterFactory) { super(beanAdapterFactory); } public String getClassName() { return className; } @XmlAttribute(name="class") public void setClassName(String className) { this.className = className; } public Constructor getConstructor() { return constructor; } public void setConstructor(Constructor constructor) { this.constructor = constructor; } public Property[] getProperties() { return properties; } @XmlElement(name="property") public void setProperties(Property[] properties) { this.properties = properties; } @XmlTransient public Object getValue() { ClassLoader cl = Thread.currentThread().getContextClassLoader(); try { Object result; BeanInfo beanInfo = null; if (className != null) beanInfo = configuration.getBeanInfo(className, cl); if (constructor != null) { String factoryMethod = constructor.getFactoryMethod(); if (factoryMethod != null) { String factoryClass = constructor.getFactoryClass(); BeanInfo factoryBeanInfo = beanInfo; if (factoryClass != null) factoryBeanInfo = configuration.getBeanInfo(factoryClass, cl); if (factoryBeanInfo == null) throw new IllegalArgumentException("Missing className or factoryClass: " + this); String[] signature = getSignature(constructor.getParameters()); MethodInfo factory = Config.findMethodInfo(factoryBeanInfo.getClassInfo(), factoryMethod, signature, true, true); Object[] params = getParams(constructor.getParameters(), factory.getParameterTypes()); result = factory.invoke(null, params); } else { if (beanInfo == null) throw new IllegalArgumentException("Missing className: " + this); String[] signature = getSignature(constructor.getParameters()); ConstructorInfo constructorInfo = Config.findConstructorInfo(beanInfo.getClassInfo(), signature); Object[] params = getParams(constructor.getParameters(), constructorInfo.getParameterTypes()); result = constructorInfo.newInstance(params); } } else { if (beanInfo == null) throw new IllegalArgumentException("Missing className: " + this); result = beanInfo.newInstance(); } if (beanInfo == null) beanInfo = configuration.getBeanInfo(result.getClass()); if (properties != null) { for (Property property : properties) { Object value = property.getValue(); if (value != null) { PropertyInfo propertyInfo = beanInfo.getProperty(property.getName()); TypeInfo typeInfo = propertyInfo.getType(); String type = property.getType(); if (type != null) typeInfo = configuration.getTypeInfo(type, cl); value = typeInfo.convertValue(value, false); propertyInfo.set(result, value); } } } return result; } catch (Throwable t) { throw new RuntimeException("Error constructing javabean", t); } } public Object get(PropertyInfo propertyInfo) throws Throwable { return propertyInfo.get(this); } public void set(PropertyInfo propertyInfo, Object child) throws Throwable { propertyInfo.set(this, child); } /** * Get parameter types. * * @param parameters the parameters * @return parameter types */ protected String[] getSignature(List parameters) { if (parameters == null) return new String[0]; String[] signature = new String[parameters.size()]; for (int i = 0; i < signature.length; ++i) { AbstractParameter parameter = parameters.get(i); if (parameter instanceof Parameter) signature[i] = ((Parameter) parameter).getParamType(); } return signature; } /** * Get parameter values. * * @param parameters the parameters * @param paramTypes the types * @return parameter values */ protected Object[] getParams(List parameters, TypeInfo[] paramTypes) { if (parameters == null) return new String[0]; Object[] params = new Object[parameters.size()]; for (int i = 0; i < params.length; ++i) { AbstractParameter parameter = parameters.get(i); Object value = parameter.getValue(); try { TypeInfo parameterType = paramTypes[i]; String type = parameter.getType(); if (type != null) parameterType = parameterType.getTypeInfoFactory().getTypeInfo(type, null); params[i] = parameterType.convertValue(value, false); } catch (Throwable t) { throw new RuntimeException("Error converting parameter #" + i + " value=" + value + " to type " + paramTypes[i]); } } return params; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/JavaBean20.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/JavaBean20.jav0000644000175000017500000000371111171577572032704 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.javabean.plugins.jaxb; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlSchema; import org.jboss.xb.annotations.JBossXmlType; import org.jboss.xb.spi.BeanAdapterFactory; /** * JavaBean version 2. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @JBossXmlSchema(namespace="urn:jboss:javabean:2.0", elementFormDefault=XmlNsForm.QUALIFIED) @XmlRootElement(name="javabean") @XmlType(name="javabeanType", propOrder={"constructor", "properties"}) @JBossXmlType(beanAdapterBuilder=JavaBeanBuilder20.class) public class JavaBean20 extends JavaBean { /** * Create a new JavaBean20. * * @param beanAdapterFactory the bean adapter factory */ public JavaBean20(BeanAdapterFactory beanAdapterFactory) { super(beanAdapterFactory); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/Constructor.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/Constructor.ja0000644000175000017500000000514611260156126033221 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.javabean.plugins.jaxb; import java.util.List; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlType; /** * Constructor. * * @author Ales Justin * @author Adrian Brock * @version $Revision: 1.1 $ */ @XmlType(name="constructorType") @JBossXmlType(modelGroup = JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE) public class Constructor { private String factoryClass; private String factoryMethod; private List parameters; public String getFactoryClass() { return factoryClass; } @XmlAttribute(name="factoryClass") public void setFactoryClass(String factoryClass) { this.factoryClass = factoryClass; } public String getFactoryMethod() { return factoryMethod; } @XmlAttribute(name="factoryMethod") public void setFactoryMethod(String factoryMethod) { this.factoryMethod = factoryMethod; } public List getParameters() { return parameters; } @XmlElements ({ @XmlElement(name="parameter", type=Parameter.class), @XmlElement(name="property", type=Property.class) }) public void setParameters(List parameters) { this.parameters = parameters; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/JavaBean10.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/javabean/plugins/jaxb/JavaBean10.jav0000644000175000017500000000417110763015442032671 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.javabean.plugins.jaxb; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import org.jboss.xb.annotations.JBossXmlSchema; import org.jboss.xb.annotations.JBossXmlType; import org.jboss.xb.spi.BeanAdapterFactory; /** * JavaBean version 1. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @JBossXmlSchema(namespace="urn:jboss:javabean:1.0", elementFormDefault=XmlNsForm.QUALIFIED) @XmlRootElement(name="javabean") @XmlType(name="javabeanType") @JBossXmlType(beanAdapterBuilder=JavaBeanBuilder10.class) public class JavaBean10 extends JavaBean { /** * Create a new JavaBean10. * * @param beanAdapterFactory the bean adapter factory */ public JavaBean10(BeanAdapterFactory beanAdapterFactory) { super(beanAdapterFactory); } @XmlTransient // Version 1 didn't have a constructor public void setConstructor(Constructor constructor) { super.setConstructor(constructor); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/0000755000175000017500000000000011620316770024612 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/0000755000175000017500000000000011620316770025567 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/SchemaBindingValidator.java0000644000175000017500000000654511225366646033015 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.util; import javax.xml.namespace.QName; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.xml.sax.InputSource; /** * Simple schema binding interface. * * @author Alexey Loubyansky * @author Ales Justin */ public interface SchemaBindingValidator { /** * Types and elements from the namespace passed into this method will be excluded from validation. * * @param ns namespace to exclude */ void excludeNs(String ns); /** * Checks if the specified namespace is excluded from validation. * * @param ns the namespace to check * @return true if the namespace is excluded */ boolean isNsExcluded(String ns); /** * Removes the namespace from the excluded set. If the namespace has not been excluded, the method does nothing. * * @param ns the namespace to remove from the excluded set. */ void includeNs(String ns); /** * Excludes the specified type from validation. * * @param qName the QName of the type to exclude from validation */ void excludeType(QName qName); /** * Checks if the type is excluded from validation. * * @param qName the QName of the type to check * @return true if the type is excluded from validation */ boolean isTypeExcluded(QName qName); /** * Removes the specified type from the excluded set. If the type has not been excluded, the method does nothing. * * @param qName the QName of type to remove from the excluded set. */ void includeType(QName qName); /** * This method will check that the XSD represented with InputSource and SchemaBinding are consistent. * The consistency is checked to certain degree and is far from 100%. Currently it checks just for basic things * such as the existence of type definitions, attribute and element declarations and element ordering. * * @param is InputSource of the XSD * @param binding SchemaBinding */ void validate(InputSource is, SchemaBinding binding); /** * Validate xsd schema against classes. * * @param xsdName the schema name * @param cls the classes to check */ void validate(String xsdName, Class... cls); } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/SchemaBindingPropertyInitializer.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/SchemaBindingPropertyInitial0000644000175000017500000000623711502160742033267 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2010, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.util; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingInitializer; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class SchemaBindingPropertyInitializer implements SchemaBindingInitializer { /** Must all content have a valid binding */ private Boolean strictSchema; /** Should ${x} references be replaced with x system property */ private Boolean replacePropertyRefs; /** if all the characters in the mixed content are whitespaces * should they be considered indentation and ignored? * the default is true for the backwards compatibility */ private Boolean ignoreWhitespacesInMixedContent; /** whether to trim string values */ private Boolean normalizeSpace; public Boolean getStrictSchema() { return strictSchema; } public void setStrictSchema(Boolean strictSchema) { this.strictSchema = strictSchema; } public Boolean isIgnoreWhitespacesInMixedContent() { return ignoreWhitespacesInMixedContent; } public void setIgnoreWhitespacesInMixedContent(Boolean ignoreWhitespacesInMixedContent) { this.ignoreWhitespacesInMixedContent = ignoreWhitespacesInMixedContent; } public Boolean isNormalizeSpace() { return normalizeSpace; } public void setNormalizeSpace(Boolean normalizeSpace) { this.normalizeSpace = normalizeSpace; } public Boolean isReplacePropertyRefs() { return replacePropertyRefs; } public void setReplacePropertyRefs(Boolean replacePropertyRefs) { this.replacePropertyRefs = replacePropertyRefs; } public SchemaBinding init(SchemaBinding schema) { if(strictSchema != null) schema.setStrictSchema(strictSchema); if(replacePropertyRefs != null) schema.setReplacePropertyRefs(replacePropertyRefs); if(ignoreWhitespacesInMixedContent != null) schema.setIgnoreWhitespacesInMixedContent(ignoreWhitespacesInMixedContent); if(normalizeSpace != null) schema.setNormalizeSpace(normalizeSpace); return schema; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/DomCharactersHandler.java0000644000175000017500000000544510605210763032454 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.util; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.w3c.dom.Element; import org.w3c.dom.Text; /** * CharactersHandler that unmarshals into org.w3c.dom.Element. * * @author Alexey Loubyansky * @version $Revision: 46112 $ */ public class DomCharactersHandler extends CharactersHandler { public static final DomCharactersHandler INSTANCE = new DomCharactersHandler(); public Object unmarshalEmpty(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData) { return ""; } public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { return value; } public void setValue(QName qName, ElementBinding element, Object owner, Object value) { if(!(owner instanceof Element)) { throw new JBossXBRuntimeException("The parent must be an instance of " + Element.class + ": parent=" + owner); } Element e = (Element)owner; Text textNode = e.getOwnerDocument().createTextNode((String)value); e.appendChild(textNode); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/DefaultSchemaBindingValidator.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/DefaultSchemaBindingValidato0000644000175000017500000007722511260156052033206 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.util; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import org.apache.xerces.xs.XSAttributeDeclaration; import org.apache.xerces.xs.XSAttributeUse; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSModel; import org.apache.xerces.xs.XSModelGroup; import org.apache.xerces.xs.XSNamedMap; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTerm; import org.apache.xerces.xs.XSTypeDefinition; import org.apache.xerces.xs.XSWildcard; import org.jboss.xb.binding.resolver.MutableSchemaResolver; import org.jboss.xb.binding.sunday.unmarshalling.AllBinding; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.jboss.xb.binding.Constants; /** * This class is used to check consistency between SchemaBinding instances and their corresponding XSD schemas. * It can be configured to exclude (or include) validation of certain namespaces * (i.e. types, elements and model groups from certain namespaces). * By default, namespace "http://www.w3.org/2001/XMLSchema" is excluded. * * Also specific types identified by their QName can be excluded or included from validation. * Simple XSD types are validated only if present in SchemaBinding. The reason for that is * many simple types are bound/represented in Java model by java.lang.String * which when building SchemaBinding is bound to xsd:string. * * Current implementation does not ensures complete consistency but only the basics such as * existence of type definitions, element declarations, element ordering in groups and * possible occurences of particles. * * When an inconsistency is found handleError(String msg) is called. The default implementation * of which throws IllegalStateException. Subclasses can override this method to report errors * differently. * * Sometimes the error itself may not be informative enough to e.g. identify the location * of the inconsistency in the schema. In this case logging should be enabled. * Default logger is an instance of org.jboss.logging.Logger with category org.jboss.xb.util.SchemaBindingValidator. * All the messages are logged from method log(String msg) which subclasses can override. * * @author Alexey Loubyansky * @author Ales Justin * @version $Revision: 1.1 $ */ public class DefaultSchemaBindingValidator extends AbstractSchemaBindingValidator { public DefaultSchemaBindingValidator() { this(null); } public DefaultSchemaBindingValidator(SchemaBindingResolver resolver) { super(resolver); reset(); excludeNs(Constants.NS_XML_SCHEMA); } protected void validate(XSModel xsSchema, SchemaBinding schemaBinding) { try { /* TODO groups are not properly bound XSNamedMap groups = xsSchema.getComponents(XSConstants.MODEL_GROUP_DEFINITION); for(int i = 0; i < groups.getLength(); ++i) { XSModelGroupDefinition xsGroupDef = (XSModelGroupDefinition)groups.item(i); System.out.println(xsGroupDef.getName()); QName groupQName = new QName(xsGroupDef.getNamespace(), xsGroupDef.getName()); ModelGroupBinding groupBinding = schemaBinding.getGroup(groupQName); assertNotNull("Group " + groupQName + " exists in the schema binding.", groupBinding); } */ XSNamedMap types = xsSchema.getComponents(XSConstants.TYPE_DEFINITION); for (int i = 0; i < types.getLength(); ++i) { XSTypeDefinition xsType = (XSTypeDefinition) types.item(i); if (excludedNs.contains(xsType.getNamespace())) continue; QName typeQName = new QName(xsType.getNamespace(), xsType.getName()); if (excludedTypes.contains(typeQName)) continue; TypeBinding typeBinding = schemaBinding.getType(typeQName); if (typeBinding == null) { SchemaBindingResolver resolver = getSchemaResolver(); if(resolver != null) { SchemaBinding foreignSchema = resolver.resolve(typeQName.getNamespaceURI(), null, null); if(foreignSchema != null && foreignSchema != schemaBinding) typeBinding = foreignSchema.getType(typeQName); } } if (typeBinding == null) { boolean ignoreIfNotFound = false; if (xsType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) { ignoreIfNotFound = true; } else { XSComplexTypeDefinition xsComplexType = (XSComplexTypeDefinition) xsType; if (xsComplexType.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_SIMPLE) { XSObjectList attributeUses = xsComplexType.getAttributeUses(); if (attributeUses.getLength() == 0) { ignoreIfNotFound = true; } else if (attributeUses.getLength() == 1) { XSAttributeUse xsAttrUse = (XSAttributeUse) attributeUses.item(0); XSAttributeDeclaration xsAttr = xsAttrUse.getAttrDeclaration(); if (xsAttr.getNamespace() == null && "id".equals(xsAttr.getName())) ignoreIfNotFound = true; } } } if (!ignoreIfNotFound) { if (isLoggingEnabled()) { log("SchemaBinding global types: "); for (Iterator iter = schemaBinding.getTypes(); iter.hasNext();) { TypeBinding type = iter.next(); if (!excludedNs.contains(type.getQName().getNamespaceURI())) log("- " + type.getQName()); } } handleError("TypeBinding " + typeQName + " is not found in the SchemaBinding."); } } else { validate(xsType, typeBinding); } } XSNamedMap elements = xsSchema.getComponents(XSConstants.ELEMENT_DECLARATION); for (int i = 0; i < elements.getLength(); ++i) { XSElementDeclaration xsElement = (XSElementDeclaration) elements.item(i); if (excludedNs.contains(xsElement.getNamespace())) continue; QName elementQName = new QName(xsElement.getNamespace(), xsElement.getName()); ElementBinding elementBinding = schemaBinding.getElement(elementQName); if (elementBinding == null) { SchemaBindingResolver resolver = getSchemaResolver(); if (resolver != null) { SchemaBinding foreignSchema = resolver.resolve(elementQName.getNamespaceURI(), null, null); if (foreignSchema != null && foreignSchema != schemaBinding) elementBinding = foreignSchema.getElement(elementQName); } } if (elementBinding == null) handleError("ElementBinding " + elementQName + " is not found in the SchemaBinding."); validate(xsElement.getTypeDefinition(), elementBinding.getType()); } } finally { reset(); } } public void validate(XSElementDeclaration xsElement, ElementBinding elementBinding) { QName xsQName = new QName(xsElement.getNamespace(), xsElement.getName()); if(!xsQName.equals(elementBinding.getQName())) handleError("Compared elements have different names: XSD QName is " + xsQName + ", ElementBinding QName is " + elementBinding.getQName()); log("element " + xsQName); if(xsElement.getScope() == XSConstants.SCOPE_GLOBAL) { if(validatedElements.contains(xsQName)) return; validatedElements.add(xsQName); } validate(xsElement.getTypeDefinition(), elementBinding.getType()); } public void validate(XSTypeDefinition xsType, TypeBinding typeBinding) { if(xsType.getName() == null) { if(typeBinding.getQName() != null) handleError("XSD type is anonymous but TypeBinding has QName " + typeBinding.getQName()); } else { if(excludedNs.contains(xsType.getNamespace())) return; QName xsQName = new QName(xsType.getNamespace(), xsType.getName()); if(validatedTypes.contains(xsQName) || excludedTypes.contains(xsQName)) return; validatedTypes.add(xsQName); } if(xsType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) validate((XSSimpleTypeDefinition)xsType, typeBinding); else validate((XSComplexTypeDefinition)xsType, typeBinding); } public void validate(XSSimpleTypeDefinition xsType, TypeBinding typeBinding) { // TODO there could xsd types that are mapped to String which is bound by default to xsd:string //QName xsQName = xsType.getName() == null ? null : new QName(xsType.getNamespace(), xsType.getName()); //assertEquals("Simple type expected to be " + (xsType == null ? "anonymous" : "named '" + xsQName + "'"), xsQName, typeBinding.getQName()); if(!typeBinding.isSimple()) { if(typeBinding.getValueAdapter() == null) handleError("XSD type " + typeBinding.getQName() + " is simple but TypeBinding is not and ValueAdapter for TypeBinding is not provided."); } // TODO the rest of the simple type stuff? } public void validate(XSComplexTypeDefinition xsType, TypeBinding typeBinding) { QName xsQName = xsType.getName() == null ? null : new QName(xsType.getNamespace(), xsType.getName()); log("complex type " + xsQName); if(typeBinding.isSimple() && typeBinding.getQName() != null && Constants.NS_XML_SCHEMA.equals(typeBinding.getQName().getNamespaceURI())) { // perhaps the complex xsd type is equivalent to the built-in simple type if(xsType.getAttributeUses().getLength() == 0 && xsType.getAttributeWildcard() == null && xsType.getParticle() == null) { log(xsQName == null ? "Anonymous" : xsQName + " type is assumed to be equivalent to " + typeBinding.getQName()); return; } } if(xsQName == null && typeBinding.getQName() != null || xsQName != null && !xsQName.equals(typeBinding.getQName())) handleError("Compared complex types have different names: XSD QName is " + xsQName + ", TypeBindign QName is " + typeBinding.getQName()); XSObjectList xsAttrUses = xsType.getAttributeUses(); if(xsAttrUses.getLength() == 0) { // TODO missing id attributes in the schema //assertTrue("Type " + typeBinding.getQName() + " has no attributes in the schema", typeBinding.getAttributes().isEmpty()); } else { for(int i = 0; i < xsAttrUses.getLength(); ++i) { XSAttributeDeclaration xsAttr = ((XSAttributeUse)xsAttrUses.item(i)).getAttrDeclaration(); QName xsAttrQName = new QName(xsAttr.getNamespace(), xsAttr.getName()); AttributeBinding attrBinding = typeBinding.getAttribute(xsAttrQName); if(attrBinding == null) handleError("Attribute " + xsAttrQName + " is not found in TypeBinding " + typeBinding.getQName()); validate(xsAttr.getTypeDefinition(), attrBinding.getType()); } } XSWildcard xsAttrWildcard = xsType.getAttributeWildcard(); if(xsAttrWildcard != null && typeBinding.getAnyAttribute() == null) handleError("TypeBinding " + typeBinding.getQName() + " doesn't have AnyAttributeBinding"); XSSimpleTypeDefinition xsSimpleType = xsType.getSimpleType(); if(xsSimpleType != null) { TypeBinding simpleTypeBinding = typeBinding.getSimpleType(); if(simpleTypeBinding == null) handleError("XSD type " + typeBinding.getQName() + " allows text content but its corresponding TypeBinding doesn't."); validate(xsSimpleType, simpleTypeBinding); } XSParticle xsParticle = xsType.getParticle(); if(xsParticle != null) { ParticleBinding particleBinding = typeBinding.getParticle(); if(particleBinding == null) handleError("TypeBinding " + xsQName + " doesn't contain a ParticleBinding."); validate(xsParticle, particleBinding); } } public void validate(XSParticle xsParticle, ParticleBinding particleBinding) { XSTerm xsTerm = xsParticle.getTerm(); TermBinding termBinding = particleBinding.getTerm(); if(termBinding == null) handleError("ParticleBinding doesn't contain a TermBinding."); short xsTermType = xsTerm.getType(); String termStr = null; boolean maxOccursUnbounded = particleBinding.getMaxOccursUnbounded(); if(xsTermType == XSConstants.MODEL_GROUP) { termStr = "sequence"; XSModelGroup xsModelGroup = (XSModelGroup)xsTerm; short xsModelGroupCompositor = (xsModelGroup).getCompositor(); if(XSModelGroup.COMPOSITOR_CHOICE == xsModelGroupCompositor) termStr = "choice"; else if(XSModelGroup.COMPOSITOR_ALL == xsModelGroupCompositor) termStr = "all"; if(!termBinding.isModelGroup()) { // TODO review this // let's see whether it's wrapped if(xsModelGroup.getParticles().getLength() == 1) { XSParticle xsWrappedParticle = (XSParticle) xsModelGroup.getParticles().item(0); validate(xsWrappedParticle, particleBinding); } else handleError("TermBinding expected to be a " + termStr + " but was " + termBinding); } else validate(xsModelGroup, particleBinding); } else if(xsTermType == XSConstants.ELEMENT_DECLARATION) { XSElementDeclaration xsElement = (XSElementDeclaration) xsTerm; QName xsElementName = new QName(xsElement.getNamespace(), xsElement.getName()); termStr = xsElementName.toString(); if(!termBinding.isElement()) { // TODO sometimes XB wraps (maybe unnecessarily) repeatable elements into a sequence. // the same xml structure can be described differently in xsd // There is a weird array binding structure in XB TermBinding t = termBinding; while (/*(xsParticle.getMaxOccursUnbounded() || xsParticle.getMaxOccurs() > 1) &&*/ t instanceof SequenceBinding) { SequenceBinding seq = (SequenceBinding) t; Collection particles = seq.getParticles(); if(particles.size() == 1) { ParticleBinding particle = particles.iterator().next(); if(particle.getMaxOccursUnbounded()) maxOccursUnbounded = true; t = particle.getTerm(); if(t.isElement()) { particleBinding = particle; termBinding = t; } } else break; } if(!termBinding.isElement()) handleError("TermBinding expected to be element " + termStr + " but was " + termBinding); } validate(xsElement, (ElementBinding)termBinding); } else if(xsTermType == XSConstants.WILDCARD) { if(!termBinding.isWildcard()) handleError("TermBinding expected to be a wildcard but was " + termBinding); XSWildcard xsWildcard = (XSWildcard) xsTerm; WildcardBinding wildcardBinding = (WildcardBinding) termBinding; if(xsWildcard.getProcessContents() != wildcardBinding.getProcessContents()) throw new IllegalStateException("Wildcard processContents doesn't match: XSD processContents is " + xsWildcard.getProcessContents() + ", WildcardBinding processContents is " + wildcardBinding.getProcessContents()); termStr = "wildcard"; } else handleError("Unexpected XSTerm type: " + xsTermType); // TODO minOccurs is not trivial for flattened choices //assertEquals("ParticleBinding<" + termStr + "> min occurs.", xsParticle.getMinOccurs(), particleBinding.getMinOccurs()); if(xsParticle.getMaxOccursUnbounded()) { if(!maxOccursUnbounded && !(termBinding instanceof UnorderedSequenceBinding)) handleError("XSD particle of " + termStr + " has maxOccurs unbounded but ParticleBinding of " + particleBinding.getTerm() + " does not."); } else if(xsParticle.getMaxOccurs() != particleBinding.getMaxOccurs()) handleError("maxOccurs for particle of " + particleBinding.getTerm() + " don't match: XSD maxOccurs=" + xsParticle.getMaxOccurs() + ", ParticleBinding maxOccurs=" + particleBinding.getMaxOccurs()); } public void validate(XSModelGroup xsModelGroup, ParticleBinding groupParticle) { ModelGroupBinding modelGroupBinding = (ModelGroupBinding) groupParticle.getTerm(); short xsCompositor = xsModelGroup.getCompositor(); boolean all = false; if(xsCompositor == XSModelGroup.COMPOSITOR_SEQUENCE) { log("sequence"); if(!(modelGroupBinding instanceof SequenceBinding)) { // another chance... if(modelGroupBinding instanceof AllBinding || modelGroupBinding instanceof UnorderedSequenceBinding) all = true; else { // here we're going to try to detect an extended choice wrapped by xerces into a sequence boolean extendedChoice = false; if(modelGroupBinding instanceof ChoiceBinding) { XSObjectList particles = xsModelGroup.getParticles(); // there should be two particles if(particles.getLength() == 2) { XSParticle p = (XSParticle) particles.item(0); XSTerm term = p.getTerm(); // first particle must be a choice if(term.getType() == XSConstants.MODEL_GROUP) { if(((XSModelGroup)term).getCompositor() == XSModelGroup.COMPOSITOR_CHOICE) { p = (XSParticle) particles.item(1); term = p.getTerm(); // second particle can be a choice or an empty sequence if(term.getType() == XSConstants.MODEL_GROUP) { XSModelGroup extensionGroup = (XSModelGroup) term; if(extensionGroup.getCompositor() == XSModelGroup.COMPOSITOR_CHOICE) extendedChoice = true; else if(extensionGroup.getCompositor() == XSModelGroup.COMPOSITOR_SEQUENCE && extensionGroup.getParticles().getLength() == 0) extendedChoice = true; } } } } } if(extendedChoice) { log(" - the sequence is treated as an extended choice"); all = true; } else handleError("ModelGroupBinding expected to be a sequence but was " + modelGroupBinding); } } } else if(xsCompositor == XSModelGroup.COMPOSITOR_CHOICE) { log("choice"); if(modelGroupBinding instanceof SequenceBinding) { // another chance... Collection particles = modelGroupBinding.getParticles(); if(particles.size() == 1) { ParticleBinding particleBinding = particles.iterator().next(); if(particleBinding.getTerm() instanceof ChoiceBinding) modelGroupBinding = (ModelGroupBinding) particleBinding.getTerm(); } } if(!(modelGroupBinding instanceof ChoiceBinding || modelGroupBinding instanceof UnorderedSequenceBinding)) handleError("XSD model group is choice but ModelGroupBinding is " + modelGroupBinding); // ordering in the choice is not important all = true; } else if(xsCompositor == XSModelGroup.COMPOSITOR_ALL) { log("all"); if(!(modelGroupBinding instanceof AllBinding)) handleError("XSD model group is all but ModelGroupBinding is " + modelGroupBinding); all = true; } else handleError("Unexpected compositor type for model group " + xsCompositor); XSObjectList xsParticles = xsModelGroup.getParticles(); Collection particleBindings = modelGroupBinding.getParticles(); Map xsElementParticles = null; Map elementParticles = null; if(xsParticles.getLength() > 0) { if(particleBindings == null) handleError("XSD model group has " + xsParticles.getLength() + " particles but ModelGroupBinding doesn't have any."); if(xsParticles.getLength() != particleBindings.size() || all) { // let's try making it flat... to the elements xsElementParticles = new HashMap(); flatten(xsModelGroup, xsElementParticles); elementParticles = new HashMap(); flatten(groupParticle, elementParticles); if(xsElementParticles.size() != elementParticles.size()) { if (isLoggingEnabled()) { String msg = "expected particles:\n"; for (int i = 0; i < xsParticles.getLength(); ++i) { XSTerm xsTerm = ((XSParticle) xsParticles.item(i)).getTerm(); short type = xsTerm.getType(); if (type == XSConstants.MODEL_GROUP) { short compositor = ((XSModelGroup) xsTerm).getCompositor(); if (compositor == XSModelGroup.COMPOSITOR_SEQUENCE) msg += "- sequence\n"; else if (compositor == XSModelGroup.COMPOSITOR_CHOICE) msg += "- choice\n"; else if (compositor == XSModelGroup.COMPOSITOR_ALL) msg += "- all\n"; } else if (type == XSConstants.ELEMENT_DECLARATION) { XSElementDeclaration element = (XSElementDeclaration) xsTerm; msg += "- " + new QName(element.getNamespace(), element.getName()) + "\n"; } else { msg += "- wildcard\n"; } } msg += "actual particles:\n"; Iterator iter = particleBindings.iterator(); while (iter.hasNext()) { TermBinding term = iter.next().getTerm(); if (term.isModelGroup()) { if (term instanceof SequenceBinding) msg += "- sequence\n"; else if (term instanceof ChoiceBinding) msg += "- choice\n"; else msg += "- wildcard\n"; } else if (term.isElement()) msg += "- " + ((ElementBinding) term).getQName() + "\n"; else msg += "- wildcard"; } log(msg); List missing = new ArrayList(xsElementParticles.keySet()); missing.removeAll(elementParticles.keySet()); log("flattened ModelGroupBinding is missing: "); for (Iterator missingNames = missing.iterator(); missingNames.hasNext();) log("- " + missingNames.next()); missing = new ArrayList(elementParticles.keySet()); missing.removeAll(xsElementParticles.keySet()); log("flattened XSModelGroup is missing: "); for (Iterator missingNames = missing.iterator(); missingNames.hasNext();) log("- " + missingNames.next()); } handleError("ModelGroupBinding expected to have " + xsParticles.getLength() + " particle(s) but has " + particleBindings.size()); } } } if(xsElementParticles != null) { Iterator iter = elementParticles.values().iterator(); while(iter.hasNext()) { ParticleBinding particleBinding = iter.next(); QName particleQName; TermBinding termBinding = particleBinding.getTerm(); if(termBinding.isWildcard()) particleQName = WILDCARD; else particleQName = ((ElementBinding)termBinding).getQName(); XSParticle xsParticle = xsElementParticles.get(particleQName); if(xsParticle == null) { if(particleQName == WILDCARD) handleError("WildcardBinding is missing"); else handleError("ElementBinding " + particleQName + " is missing: " + xsElementParticles.keySet()); } validate(xsParticle, particleBinding); } } else { Iterator iter = particleBindings.iterator(); for (int i = 0; i < xsParticles.getLength(); ++i) { XSParticle xsParticle = (XSParticle) xsParticles.item(i); validate(xsParticle, iter.next()); } } } private void flatten(XSModelGroup xsModelGroup, Map elementParticles) { XSObjectList xsParticles = xsModelGroup.getParticles(); for(int i = 0; i < xsParticles.getLength(); ++i) { XSParticle particle = (XSParticle)xsParticles.item(i); XSTerm term = particle.getTerm(); short termType = term.getType(); if(termType == XSConstants.ELEMENT_DECLARATION) { XSElementDeclaration element = (XSElementDeclaration) term; QName qName = new QName(element.getNamespace(), element.getName()); elementParticles.put(qName, particle); } else if(termType == XSConstants.WILDCARD) elementParticles.put(WILDCARD, particle); else { XSModelGroup modelGroup = (XSModelGroup) term; flatten(modelGroup, elementParticles); } } } private void flatten(ParticleBinding groupParticle, Map elementParticles) { TermBinding groupTerm = groupParticle.getTerm(); if(!(groupTerm instanceof ModelGroupBinding)) throw new IllegalStateException("The term is expected to be a model group but was " + groupTerm); ModelGroupBinding group = (ModelGroupBinding) groupTerm; boolean forceUnbounded = groupParticle.getMaxOccursUnbounded() && group.getParticles().size() == 1; Iterator i = group.getParticles().iterator(); while(i.hasNext()) { ParticleBinding particle = i.next(); TermBinding term = particle.getTerm(); if(forceUnbounded && !particle.getMaxOccursUnbounded()) particle = new ParticleBinding(term, particle.getMinOccurs(), particle.getMaxOccurs(), true); if(term.isElement()) { ElementBinding element = (ElementBinding) term; elementParticles.put(element.getQName(), particle); } else if(term.isWildcard()) elementParticles.put(WILDCARD, particle); else { ModelGroupBinding modelGroup = (ModelGroupBinding) term; flatten(particle, elementParticles); } } } /** * This an error handler method. Default implementation throws IllegalStateException with the message passed in as the argument. * * @param msg the error message */ protected void handleError(String msg) { throw new IllegalStateException(msg); } /** * This method is supposed to log a message. Default implementation uses trace logging. * * @param msg the message to log. */ protected void log(String msg) { if(isLoggingEnabled()) log.trace(msg); } }././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/AbstractSchemaBindingValidator.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/AbstractSchemaBindingValidat0000644000175000017500000001417611227325436033211 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.util; import java.io.IOException; import java.net.URL; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import javax.xml.namespace.QName; import org.apache.xerces.xs.XSModel; import org.jboss.logging.Logger; import org.jboss.xb.binding.Util; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.xml.sax.InputSource; /** * Mostly a holder for excluded and validated types, namespaces. * * @author Alexey Loubyansky * @author Ales Justin * @version $Revision: 1.1 $ */ public abstract class AbstractSchemaBindingValidator implements SchemaBindingValidator { protected static final Logger log = Logger.getLogger(SchemaBindingValidator.class); protected static final QName WILDCARD = new QName("wildcard", "wildcard"); protected Set excludedNs = new HashSet(); protected Set excludedTypes = new HashSet(); protected Set validatedTypes = new HashSet(); protected Set validatedElements = new HashSet(); private SchemaBindingResolver resolver; private boolean loggingEnabled; protected AbstractSchemaBindingValidator() { loggingEnabled = log.isTraceEnabled(); } /** * @param resolver default schema resolver */ protected AbstractSchemaBindingValidator(SchemaBindingResolver resolver) { this(); this.resolver = resolver; } /** * Resets instance variables (such as a set of validated types and elements). * This method is required to invoked before another validation. * It is called internally at the end of validate(XSModel xsSchema, SchemaBinding schemaBinding). * NOTE: this method doesn't clear excluded namespaces and types. */ public void reset() { validatedTypes.clear(); validatedElements.clear(); } public boolean isLoggingEnabled() { return loggingEnabled; } public void enableLogging(boolean value) { loggingEnabled = value; } public void excludeNs(String ns) { excludedNs.add(ns); } public boolean isNsExcluded(String ns) { return excludedNs.contains(ns); } public void includeNs(String ns) { excludedNs.remove(ns); } public void excludeType(QName qName) { excludedTypes.add(qName); } public boolean isTypeExcluded(QName qName) { return excludedTypes.contains(qName); } public void includeType(QName qName) { excludedTypes.remove(qName); } /** * @return The default resolver used to resolve schemas */ public SchemaBindingResolver getSchemaResolver() { return resolver; } /** * @param resolver The default resolver used to resolve schemas */ public void setSchemaResolver(SchemaBindingResolver resolver) { this.resolver = resolver; } public void validate(InputSource is, SchemaBinding binding) { SchemaBindingResolver resolver = binding.getSchemaResolver(); if(resolver == null) { resolver = this.resolver; if(resolver == null) log("Schema resolver was not provided"); } XSModel xsModel = Util.loadSchema(is, resolver); validate(xsModel, binding); } public void validate(String xsdName, Class... cls) { log("validate: " + xsdName + ", " + Arrays.asList(cls)); URL xsdUrl = Thread.currentThread().getContextClassLoader().getResource("schema/" + xsdName); if(xsdUrl == null) handleError("Failed to load schema from the classpath: schema/" + xsdName); MultiClassSchemaResolver multiClassResolver = new MultiClassSchemaResolver(); multiClassResolver.mapLocationToClasses(xsdName, cls); SchemaBinding binding = resolver.resolve("", null, xsdName); SchemaBindingResolver resolver = this.resolver; if(resolver == null) resolver = multiClassResolver; XSModel xsModel; try { xsModel = Util.loadSchema(xsdUrl.openStream(), null, resolver); } catch (IOException e) { throw new IllegalStateException("Failed to read schema " + xsdName, e); } validate(xsModel, binding); } protected abstract void validate(XSModel xsSchema, SchemaBinding schemaBinding); /** * This an error handler method. Default implementation throws IllegalStateException with the message passed in as the argument. * * @param msg the error message */ protected void handleError(String msg) { throw new IllegalStateException(msg); } /** * This method is supposed to log a message. Default implementation uses trace logging. * * @param msg the message to log. */ protected void log(String msg) { if(loggingEnabled) log.trace(msg); } }libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/JBossXBHelper.java0000644000175000017500000002355411477210647031063 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.util; // $Id: $ import org.jboss.logging.Logger; import org.jboss.xb.annotations.JBossXmlSchema; import org.jboss.xb.binding.FeatureAware; import org.jboss.xb.binding.ObjectModelFactory; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.resolver.MutableSchemaResolver; import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory; import org.xml.sax.InputSource; /** * JBossXB deployer helper. * * @param the expected type * @author Ales Justin * @author Thomas Diesler */ public class JBossXBHelper implements FeatureAware { /** The log */ private Logger log = Logger.getLogger(JBossXBHelper.class); /** Unmarshaller factory */ private static final UnmarshallerFactory factory = UnmarshallerFactory.newInstance(); /** The output */ private Class output; /** Whether the Unmarshaller will use schema validation */ private boolean useSchemaValidation = true; /** Whether to validate */ private boolean useValidation = true; /** Whether to warn on parser errors or terminate parsing by re-throwing the parsing errors */ private boolean warnOnParserErrors; /** * Create a new SchemaResolverDeployer. * * @param output the output * @throws IllegalArgumentException for a null output */ public JBossXBHelper(Class output) { if (output == null) throw new IllegalArgumentException("Null output."); this.output = output; } public void setFeature(String featureName, boolean flag) throws Exception { factory.setFeature(featureName, flag); } /** * Get the useSchemaValidation. * * @return the useSchemaValidation. */ public boolean isUseSchemaValidation() { return useSchemaValidation; } /** * Set the useSchemaValidation. * * @param useSchemaValidation the useSchemaValidation. */ public void setUseSchemaValidation(boolean useSchemaValidation) { this.useSchemaValidation = useSchemaValidation; } /** * Get the useValidation. * * @return the useValidation. */ public boolean isUseValidation() { return useValidation; } /** * Set the useValidation. * * @param useValidation the useValidation. */ public void setUseValidation(boolean useValidation) { this.useValidation = useValidation; } /** * This property controls whether the (underlying) parser errors should be * logged as warnings or should they terminate parsing with errors. * The default is to terminate parsing by re-throwing parser errors. * * @return false if parser errors should be logged as warnings, otherwise - true */ public boolean isWarnOnParserErrors() { return warnOnParserErrors; } /** * This property controls whether the (underlying) parser errors should be * logged as warnings or should they terminate parsing with errors. * The default is to terminate parsing by re-throwing parser errors. */ public void setWarnOnParserErrors(boolean value) { this.warnOnParserErrors = value; } /** * Add class binding. * * @param namespace the namespace * @param metadata the metadata * @deprecated Use {@link #addTypeBinding(String, Class)} */ public static void addClassBinding(String namespace, Class metadata) { SingletonSchemaResolverFactory factory = SingletonSchemaResolverFactory.getInstance(); MutableSchemaResolver resolver = factory.getSchemaBindingResolver(); resolver.mapURIToClass(namespace, metadata); } /** * Remove class binding. * * @param namespace the namespace * @deprecated Use {@link #removeTypeBinding(String)} */ public static void removeClassBinding(String namespace) { SingletonSchemaResolverFactory factory = SingletonSchemaResolverFactory.getInstance(); MutableSchemaResolver resolver = factory.getSchemaBindingResolver(); resolver.removeURIToClassMapping(namespace); } /** * Add class binding. * * @param namespace the namespace * @param metadata the metadata */ public void addTypeBinding(String namespace, Class metadata) { getResolver().mapURIToClass(namespace, metadata); } /** * Remove class binding. * * @param namespace the namespace */ public void removeTypeBinding(String namespace) { getResolver().removeURIToClassMapping(namespace); } /** * Get the schema resolver. * * This implementation returns a singleton schema resolver. * * @return the resolver */ protected MutableSchemaResolver getResolver() { SingletonSchemaResolverFactory factory = SingletonSchemaResolverFactory.getInstance(); return factory.getSchemaBindingResolver(); } /** * Find the namespace on class/package * * @param metadata the metadata class * @return jboss xml schema namespace */ public static String findNamespace(Class metadata) { JBossXmlSchema jBossXmlSchema = metadata.getAnnotation(JBossXmlSchema.class); if (jBossXmlSchema == null) { Package pckg = metadata.getPackage(); if (pckg != null) jBossXmlSchema = pckg.getAnnotation(JBossXmlSchema.class); } return jBossXmlSchema != null ? jBossXmlSchema.namespace() : null; } /** * Parse file to output metadata. * * @param source the source to parse * @return new metadata instance * @throws Exception for any error */ public T parse(InputSource source) throws Exception { return parse(output, source); } /** * Parse the file to create metadata instance. * * @param the expect type * @param expectedType the expected type * @param source the source * @return new metadata instance * @throws Exception for any error */ public U parse(Class expectedType, InputSource source) throws Exception { if (expectedType == null) throw new IllegalArgumentException("Null expected type"); if (source == null) throw new IllegalArgumentException("Null source"); boolean trace = log.isTraceEnabled(); if(trace) log.trace("Parsing file: " + source + " for type: " + expectedType); Unmarshaller unmarshaller = factory.newUnmarshaller(); unmarshaller.setSchemaValidation(isUseSchemaValidation()); unmarshaller.setValidation(isUseValidation()); unmarshaller.setWarnOnParserErrors(isWarnOnParserErrors()); Object parsed = unmarshaller.unmarshal(source, getResolver()); if (parsed == null) throw new Exception("Failed to resolve Java binding for " + source + " (check the SchemaBinding resolver configuration)"); if(trace) log.trace("Parsed file: " + source + " to: " + parsed); return expectedType.cast(parsed); } /** * Parse the file using object model factory. * * @param source the source to parse * @param root the previous root * @param omf the object model factory * @return new metadata instance * @throws Exception for any error */ public T parse(InputSource source, T root, ObjectModelFactory omf) throws Exception { return parse(output, source, root, omf); } /** * Parse the file using object model factory. * * @param the expect type * @param expectedType the expected type * @param source the source to parse * @param root the previous root * @param omf the object model factory * @return new metadata instance * @throws Exception for any error */ public U parse(Class expectedType, InputSource source, U root, ObjectModelFactory omf) throws Exception { if (source == null) throw new IllegalArgumentException("Null source"); boolean trace = log.isTraceEnabled(); if(trace) log.trace("Parsing source: " + source + " for deploymentType: " + expectedType); Unmarshaller unmarshaller = factory.newUnmarshaller(); unmarshaller.setSchemaValidation(isUseSchemaValidation()); unmarshaller.setValidation(isUseValidation()); unmarshaller.setWarnOnParserErrors(isWarnOnParserErrors()); Object parsed = unmarshaller.unmarshal(source, omf, root); if (parsed == null) throw new Exception("Failed to resolve Java binding for " + source); if(trace) log.trace("Parsed file: " + source + " to: "+parsed); return expectedType.cast(parsed); } }libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/DomLocalMarshaller.java0000644000175000017500000000423710605210763032142 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.util; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.MarshallingContext; import org.jboss.xb.binding.ObjectLocalMarshaller; import org.w3c.dom.Element; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; /** * ObjectLocalMarshaller that marshals org.w3c.dom.Element. * * @author Alexey Loubyansky * @version $Revision: 46112 $ */ public class DomLocalMarshaller implements ObjectLocalMarshaller { public static final DomLocalMarshaller INSTANCE = new DomLocalMarshaller(); public void marshal(MarshallingContext ctx, Object o) { if(!(o instanceof Element)) { throw new JBossXBRuntimeException("The argument must be an instance of " + Element.class + ": arg=" + o); } Element e = (Element)o; ContentHandler ch = ctx.getContentHandler(); try { Dom2Sax.dom2sax(e, ch); } catch (SAXException e1) { throw new JBossXBRuntimeException("Failed to SAX the DOM"); } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/DomParticleHandler.java0000644000175000017500000000710310605210763032131 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.util; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.Attributes; /** * ParticleHandler that unmarshals into org.w3c.dom.Element. * * @author Alexey Loubyansky * @version $Revision: 46112 $ */ public class DomParticleHandler extends RtElementHandler implements ParticleHandler { public static final DomParticleHandler INSTANCE = new DomParticleHandler(); private Document doc; public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { Document doc = getDocument(); Element element = doc.createElementNS(elementName.getNamespaceURI(), elementName.getLocalPart()); if (attrs != null) { for (int i = 0; i < attrs.getLength(); ++i) { element.setAttribute(attrs.getLocalName(i), attrs.getValue(i)); } } return element; } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return o; } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { if (parent instanceof Element) { ((Element) parent).appendChild((Element) o); } else { super.setParent(parent, o, elementName, particle, parentParticle); } } private Document getDocument() { if (doc == null) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder domBuilder = null; try { domBuilder = factory.newDocumentBuilder(); } catch (ParserConfigurationException e) { throw new JBossXBRuntimeException("Failed to create document builder instance", e); } doc = domBuilder.newDocument(); } return doc; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/Dom2Sax.java0000644000175000017500000001575511061473704027724 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.util; import java.util.List; import java.util.Collections; import java.util.ArrayList; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.NamespaceRegistry; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.NodeList; import org.w3c.dom.Node; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; /** * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class Dom2Sax { public static void dom2sax(Element e, ContentHandler ch) throws SAXException { if(e == null) { throw new IllegalArgumentException("The element argument must not be null!"); } ch.startDocument(); process(e, ch, new NamespaceRegistry()); ch.endDocument(); } private static void process(Element e, ContentHandler ch, NamespaceRegistry nsReg) throws SAXException { AttributesImpl attrs = new AttributesImpl(); List startedPrefixes = Collections.emptyList(); NamedNodeMap domAttrs = e.getAttributes(); if(domAttrs != null && domAttrs.getLength() > 0) { // run through xmlns first to declare all the namespaces for(int i = 0; i < domAttrs.getLength(); ++i) { Attr attr = (Attr)domAttrs.item(i); String attrNs = attr.getNamespaceURI(); String attrLocal = attr.getLocalName(); if(attrLocal == null) { attrLocal = attr.getNodeName(); } if(attrNs != null && isXmlns(attrNs)) { String prefix; String attrPrefix; if("xmlns".equals(attrLocal)) { prefix = ""; attrPrefix = ""; } else { prefix = attrLocal; attrPrefix = "xmlns"; } String attrVal = attr.getValue(); nsReg.addPrefixMapping(prefix, attrVal); ch.startPrefixMapping(prefix, attrVal); startedPrefixes = add(startedPrefixes, prefix); attrs.addAttribute(attrNs, attrLocal, buildQName(attrPrefix, attrLocal), null, attrVal); } } for(int i = 0; i < domAttrs.getLength(); ++i) { Attr attr = (Attr)domAttrs.item(i); String attrNs = attr.getNamespaceURI(); String attrLocal = attr.getLocalName(); if(attrLocal == null) { attrLocal = attr.getNodeName(); } if(attrNs == null) { attrNs = ""; } if(!isXmlns(attrNs)) { String prefix = nsReg.getPrefix(attrNs); if(prefix == null && attrNs.length() > 0) { prefix = attrLocal + "_ns"; nsReg.addPrefixMapping(prefix, attrNs); ch.startPrefixMapping(prefix, attrNs); startedPrefixes = add(startedPrefixes, prefix); attrs.addAttribute(Constants.NS_XML_SCHEMA, prefix, "xmlns:" + prefix, null, attrNs); } attrs.addAttribute(attrNs, attrLocal, buildQName(prefix, attrLocal), null, attr.getValue()); } } } String localName = e.getLocalName(); if(localName == null) { localName = e.getNodeName(); } String ns = e.getNamespaceURI(); if(ns == null) { ns = ""; } String prefix = nsReg.getPrefix(ns); if(prefix == null && ns.length() > 0) { prefix = localName + "_ns"; nsReg.addPrefixMapping(prefix, ns); ch.startPrefixMapping(prefix, ns); startedPrefixes = add(startedPrefixes, prefix); attrs.addAttribute(Constants.NS_XML_SCHEMA, prefix, "xmlns:" + prefix, null, ns); } String qName = buildQName(prefix, localName); ch.startElement(ns, localName, qName, attrs); NodeList childNodes = e.getChildNodes(); if(childNodes != null && childNodes.getLength() > 0) { for(int i = 0; i < childNodes.getLength(); ++i) { Node node = childNodes.item(i); switch(node.getNodeType()) { case Node.ELEMENT_NODE: process((Element)node, ch, nsReg); break; case Node.CDATA_SECTION_NODE: case Node.TEXT_NODE: String value = node.getNodeValue(); ch.characters(value.toCharArray(), 0, value.length()); break; case Node.ENTITY_REFERENCE_NODE: String ref = '&' + node.getNodeName() + ';'; ch.characters(ref.toCharArray(), 0, ref.length()); break; case Node.ENTITY_NODE: ch.skippedEntity(node.getNodeName()); break; } } } ch.endElement(ns, localName, qName); if(startedPrefixes.size() > 0) { for(int i = startedPrefixes.size() - 1; i >= 0; --i) { String pref = (String)startedPrefixes.get(i); nsReg.removePrefixMapping(pref); ch.endPrefixMapping(pref); } } } private static boolean isXmlns(String ns) { return ns.startsWith("http://www.w3.org/2000/xmlns"); } private static String buildQName(String prefix, String localName) { return prefix == null || prefix.length() == 0 ? localName : prefix + ':' + localName; } private static List add(List list, Object o) { switch(list.size()) { case 0: list = Collections.singletonList(o); break; case 1: list = new ArrayList(list); default: list.add(o); } return list; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/NoopMap.java0000644000175000017500000000431311061473704030004 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.util; import java.util.AbstractMap; import java.util.Collection; import java.util.Collections; import java.util.Map; import java.util.Set; import java.util.Map.Entry; /** * @author Alexey Loubyansky * @version $Revision: $ */ public class NoopMap extends AbstractMap { public V put(K key, V value) { return null; } public int size() { return 0; } public boolean isEmpty() { return true; } public boolean containsKey(Object key) { return false; } public boolean containsValue(Object value) { return false; } public V get(Object key) { return null; } public Set keySet() { return Collections.emptySet(); } public Collection values() { return Collections.emptySet(); } public Set> entrySet() { return Collections.emptySet(); } public boolean equals(Object o) { return (o instanceof Map) && ((Map)o).size() == 0; } public int hashCode() { return 0; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/util/CollectionFactory.java0000644000175000017500000000705411336746311032065 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.util; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Set; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.binding.JBossXBRuntimeException; /** * A CollectionFactory. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public abstract class CollectionFactory { private static TypeInfo SET_INFO; public abstract Collection createCollection() throws Throwable; public static CollectionFactory LIST = new CollectionFactory() { public Collection createCollection() throws Throwable { return new ArrayList(); } }; public static CollectionFactory SET = new CollectionFactory() { public Collection createCollection() throws Throwable { return new HashSet(); } }; public static CollectionFactory getFactory(ClassInfo collectionType) { if (Modifier.isAbstract(collectionType.getModifiers())) { if(SET_INFO == null) SET_INFO = collectionType.getTypeInfoFactory().getTypeInfo(Set.class); if (SET_INFO.isAssignableFrom(collectionType)) return SET; else return LIST; } ConstructorInfo constructor = collectionType.getDeclaredConstructor(null); if (constructor == null) { for (ConstructorInfo ctor : collectionType.getDeclaredConstructors()) { if (ctor.getParameterTypes().length == 0) { // TODO for org.jboss.reflect // log.warn("ClassInfo.getDeclaredConstructor(null) didn't work for " + collectionType.getName() // + ", found the default ctor in ClassInfo.getDeclaredConstructors()"); constructor = ctor; break; } } if (constructor == null) throw new JBossXBRuntimeException("Default constructor not found for " + collectionType.getName()); } final ConstructorInfo ctor = constructor; return new CollectionFactory() { @SuppressWarnings("unchecked") @Override public Collection createCollection() throws Throwable { return (Collection) ctor.newInstance(null); } }; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/spi/0000755000175000017500000000000011620316770025405 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/spi/BeanAdapterFactory.java0000644000175000017500000000707111335111240031737 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.spi; import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.xb.builder.runtime.AbstractPropertyHandler; /** * BeanAdapterFactory. * * @author Adrian Brock * @author Ales Justin * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public abstract class BeanAdapterFactory { /** The properties */ private Map properties = Collections.emptyMap(); /** The wildcard handler */ private AbstractPropertyHandler wildcardHandler; /** * Get the property handler for an element name * * @param qName the element name * @return the property handler */ public AbstractPropertyHandler getPropertyHandler(QName qName) { return properties.get(qName); } /** * Get the properties * * @return the properties */ public Map getProperties() { return properties; } /** * Add a property * * @param qName the qName * @param propertyHandler the property handler */ public void addProperty(QName qName, AbstractPropertyHandler propertyHandler) { if (qName == null) throw new IllegalArgumentException("Null qName"); if (propertyHandler == null) throw new IllegalArgumentException("Null property handler"); int size = properties.size(); if(size == 0) properties = Collections.singletonMap(qName, propertyHandler); else { if(size == 1) properties = new HashMap(properties); properties.put(qName, propertyHandler); } } /** * Get the available properties as a string * * @return the available properties */ public String getAvailable() { if (properties.isEmpty()) return ""; else return properties.keySet().toString(); } /** * Get the wildcardHandler. * * @return the wildcardHandler. */ public AbstractPropertyHandler getWildcardHandler() { return wildcardHandler; } /** * Set the wildcardHandler. * * @param wildcardHandler the wildcardHandler. */ public void setWildcardHandler(AbstractPropertyHandler wildcardHandler) { this.wildcardHandler = wildcardHandler; } /** * Create a new BeanAdapter * * @return the new bean adapter */ public abstract BeanAdapter newInstance(); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/spi/DefaultBeanAdapterBuilder.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/spi/DefaultBeanAdapterBuilder.jav0000644000175000017500000000266710625561630033105 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.spi; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.reflect.spi.MethodInfo; /** * DefaultBeanAdapterBuilder. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class DefaultBeanAdapterBuilder implements BeanAdapterBuilder { public DefaultBeanAdapterFactory newFactory(BeanInfo beanInfo, MethodInfo factory) { return new DefaultBeanAdapterFactory(beanInfo, factory); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/spi/DefaultBeanAdapter.java0000644000175000017500000000565711335111240031724 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.spi; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.MethodInfo; /** * DefaultBeanAdapter. * * @author Adrian Brock * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class DefaultBeanAdapter extends BeanAdapter { /** The bean info */ private BeanInfo beanInfo; /** Any factory */ private MethodInfo factory; /** The value */ private Object value; /** * Create a new bean adapter * * @param beanAdapterFactory the bean adapter factory * @param beanInfo the bean info * @param factory the factory * @throws IllegalArgumentException for null bean adapter factory or bean info */ public DefaultBeanAdapter(BeanAdapterFactory beanAdapterFactory, BeanInfo beanInfo, MethodInfo factory) { super(beanAdapterFactory); if (beanInfo == null) throw new IllegalArgumentException("Null bean info"); this.beanInfo = beanInfo; this.factory = factory; try { if (factory != null) value = factory.invoke(null, null); else value = beanInfo.newInstance(); } catch (Throwable t) { throw new RuntimeException("Error instantiating bean for " + beanInfo.getName(), t); } } /** * Get the bean info * * @return the bean info */ public BeanInfo getBeanInfo() { return beanInfo; } /** * Get the factory * * @return the factgory */ public MethodInfo getFactory() { return factory; } public Object get(PropertyInfo propertyInfo) throws Throwable { return propertyInfo.get(value); } public void set(PropertyInfo propertyInfo, Object child) throws Throwable { propertyInfo.set(value, child); } public Object getValue() { return value; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/spi/DefaultBeanAdapterFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/spi/DefaultBeanAdapterFactory.jav0000644000175000017500000000327511335111240033105 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.spi; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.reflect.spi.MethodInfo; /** * DefaultBeanAdapterFactory. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class DefaultBeanAdapterFactory extends AbstractBeanAdapterFactory { /** * Create a new bean adapter factory * * @param beanInfo the bean info * @param factory the factory * @throws IllegalArgumentException for a null bean info */ public DefaultBeanAdapterFactory(BeanInfo beanInfo, MethodInfo factory) { super(beanInfo, factory); } public BeanAdapter newInstance() { return new DefaultBeanAdapter(this, beanInfo, factory); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/spi/AbstractBeanAdapter.java0000644000175000017500000000660411335111240032074 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.spi; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.xb.spi.BeanAdapter; /** * AbstractBeanAdapter. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class AbstractBeanAdapter extends BeanAdapter { /** The bean info */ private BeanInfo beanInfo; /** Any factory */ private MethodInfo factory; /** Whether the value is constructed */ private boolean constructed = false; /** The value */ private Object value; /** * Create a new AbstractBeanAdapter. * * @param beanAdapterFactory the bean adapter factory * @param beanInfo the bean info * @param factory the factory * @throws IllegalArgumentException for null bean adapter factory or bean info */ public AbstractBeanAdapter(BeanAdapterFactory beanAdapterFactory, BeanInfo beanInfo, MethodInfo factory) { super(beanAdapterFactory); if (beanInfo == null) throw new IllegalArgumentException("Null bean info"); this.beanInfo = beanInfo; this.factory = factory; } /** * Get the bean info * * @return the bean info */ public BeanInfo getBeanInfo() { return beanInfo; } /** * Get the factory * * @return the factgory */ public MethodInfo getFactory() { return factory; } public Object get(PropertyInfo propertyInfo) throws Throwable { ensureConstructed(); return propertyInfo.get(value); } public void set(PropertyInfo propertyInfo, Object child) throws Throwable { ensureConstructed(); propertyInfo.set(value, child); } public Object getValue() { ensureConstructed(); return value; } /** * Construct the object * * @return the value */ protected Object construct() { try { if (factory != null) return factory.invoke(null, null); return beanInfo.newInstance(); } catch (Throwable t) { throw new RuntimeException("Error instantiating bean for " + beanInfo.getName(), t); } } /** * Ensure the object has been constructed */ protected void ensureConstructed() { if (constructed == false) { value = construct(); constructed = true; } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/spi/BeanAdapter.java0000644000175000017500000000645510764203365030433 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.spi; import javax.xml.bind.annotation.XmlTransient; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.xb.builder.runtime.AbstractPropertyHandler; /** * BeanAdapter. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class BeanAdapter { /** The bean adapter factory */ private BeanAdapterFactory beanAdapterFactory; /** * Create a new BeanAdapter. * * @param beanAdapterFactory the bean adapter factory * @throws IllegalArgumentException for a null bean adapter factory */ public BeanAdapter(BeanAdapterFactory beanAdapterFactory) { if (beanAdapterFactory == null) throw new IllegalArgumentException("Null bean adapter factory"); this.beanAdapterFactory = beanAdapterFactory; } /** * Get the bean adapter factory * * @return the factory */ protected BeanAdapterFactory getBeanAdapterFactory() { return beanAdapterFactory; } /** * Get the property handler for an element name * * @param qName the element name * @return the property handler */ public AbstractPropertyHandler getPropertyHandler(QName qName) { return beanAdapterFactory.getPropertyHandler(qName); } /** * Get the wildcardHandler. * * @return the wildcardHandler. */ @XmlTransient public AbstractPropertyHandler getWildcardHandler() { return beanAdapterFactory.getWildcardHandler(); } /** * Get the available properties as a string * * @return the available properties */ @XmlTransient public String getAvailable() { return beanAdapterFactory.getAvailable(); } /** * Get a property * * @param propertyInfo the property info * @return the property value * @throws Throwable for any error */ public abstract Object get(PropertyInfo propertyInfo) throws Throwable; /** * Set a property * * @param propertyInfo the property info * @param child the value * @throws Throwable for any error */ public abstract void set(PropertyInfo propertyInfo, Object child) throws Throwable; /** * Get the value * * @return the value */ @XmlTransient public abstract Object getValue(); } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/spi/BeanAdapterBuilder.java0000644000175000017500000000302210625561630031723 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.spi; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.reflect.spi.MethodInfo; /** * BeanAdapterBuilder. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface BeanAdapterBuilder { /** * Create a new bean adapter factory * * @param beanInfo the bean info * @param factory the factory * @throws IllegalArgumentException for a null bean info * @return the factory */ BeanAdapterFactory newFactory(BeanInfo beanInfo, MethodInfo factory); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/spi/AbstractBeanAdapterFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/spi/AbstractBeanAdapterFactory.ja0000644000175000017500000000430311335111240033067 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.spi; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.reflect.spi.MethodInfo; /** * AbstractBeanAdapterFactory. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class AbstractBeanAdapterFactory extends BeanAdapterFactory { /** The bean info */ protected BeanInfo beanInfo; /** Any factory */ protected MethodInfo factory; /** * Create a new bean adapter factory * * @param beanInfo the bean info * @param factory the factory * @throws IllegalArgumentException for a null bean info */ public AbstractBeanAdapterFactory(BeanInfo beanInfo, MethodInfo factory) { if (beanInfo == null) throw new IllegalArgumentException("Null beanInfo"); this.beanInfo = beanInfo; this.factory = factory; } /** * Get the bean info * * @return the bean info */ public BeanInfo getBeanInfo() { return beanInfo; } /** * Get the factory. * * @return the factory. */ public MethodInfo getFactory() { return factory; } public BeanAdapter newInstance() { return new AbstractBeanAdapter(this, getBeanInfo(), getFactory()); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/0000755000175000017500000000000011620316762026241 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/JBossXBBuilder.java0000755000175000017500000004251311345730356031700 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Collections; import java.util.HashSet; import java.util.Set; import javax.xml.XMLConstants; import org.jboss.beans.info.spi.BeanAccessMode; import org.jboss.config.plugins.property.PropertyConfiguration; import org.jboss.config.spi.Configuration; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.PackageInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlSchema; import org.jboss.xb.binding.metadata.PackageMetaData; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingInitializer; /** * JBossXBBuilder. * * Builds instances SchemaBinding for passed in classes by parsing binding annotations. * By default, built instances of SchemaBinding are cached in the instances of ClassInfo. * There are methods though that allow to re-build the cached bindings. * * Whether SequenceBinding or UnorderedSequenceBinding is used as the default for sequences is controlled * by static property useUnorderedSequence. The value can be set by calling static method setUseUnorderedSequence(boolean value) * or by setting system property xb.builder.useUnorderedSequence to true or false. The initialization fro the system property * happens once in the static initializer. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JBossXBBuilder { /** system property name to use for initialization * whether to use unordered sequences as the default sequence type during binding */ public static final String USE_UNORDERED_SEQUENCE_PROPERTY = "xb.builder.useUnorderedSequence"; /** system property name to use for initialization * whether to enforce the presence of propOrder in XmlType annotation when content of the type is bound to a sequence */ public static final String SEQUENCES_REQUIRE_PROP_ORDER = "xb.builder.sequencesRequirePropOrder"; /** system property name to use for initialization * General purpose handlers in setParent do a map.get(QName) to find the correct * property handler to add the child to the parent. In case of non-global elements/groups we know the parent * and the property from the beginning (during binding), so these terms could have a handler that would use * the property directly. */ public static final String ELEMENT_SET_PARENT_OVERRIDE_HANDLER = "xb.builder.elementSetParentOverrideHandler"; /** system property name to use for initialization * Used for collection or array properties. To avoid calling property getter to get the collection value * and then add the just unmarshalled item, all the items could be collected first instead and then property * setter could be called to set the final value. This is what repeatable particle handlers do. */ public static final String REPEATABLE_PARTICLE_HANDLERS = "xb.builder.repeatableParticleHandlers"; /** The configuration */ static Configuration configuration; /** The string type */ static final ClassInfo STRING; /** The object type */ static final ClassInfo OBJECT; static boolean useUnorderedSequence; static boolean sequencesRequirePropOrder; // whether elements override their type's ParticleHandler.setParent with property-specific setParent impl static boolean elementSetParentHandler; // whether to use repeatable particle handlers for collections static boolean repeatableParticleHandlers; static { configuration = AccessController.doPrivileged(new PrivilegedAction() { public PropertyConfiguration run() { return new PropertyConfiguration(); } }); STRING = configuration.getClassInfo(String.class); OBJECT = configuration.getClassInfo(Object.class); useUnorderedSequence = getBooleanProperty(JBossXBBuilder.USE_UNORDERED_SEQUENCE_PROPERTY, false); sequencesRequirePropOrder = getBooleanProperty(JBossXBBuilder.SEQUENCES_REQUIRE_PROP_ORDER, true); elementSetParentHandler = getBooleanProperty(JBossXBBuilder.ELEMENT_SET_PARENT_OVERRIDE_HANDLER, true); repeatableParticleHandlers = getBooleanProperty(JBossXBBuilder.REPEATABLE_PARTICLE_HANDLERS, true); } private static boolean getBooleanProperty(final String propertyName, boolean defaultValue) { String stringValue = AccessController.doPrivileged( new PrivilegedAction() { public String run() { return System.getProperty(propertyName); } } ); if(stringValue != null) return Boolean.parseBoolean(stringValue); return defaultValue; } public static boolean isUseUnorderedSequence() { return useUnorderedSequence; } public static void setUseUnorderedSequence(boolean unorderedSequences) { JBossXBBuilder.useUnorderedSequence = unorderedSequences; } public static boolean isSequencesRequirePropOrder() { return sequencesRequirePropOrder; } public static void setSequencesRequirePropOrder(boolean sequencesRequirePropOrder) { JBossXBBuilder.sequencesRequirePropOrder = sequencesRequirePropOrder; } public static boolean isElementSetParentOverrideHandler() { return elementSetParentHandler; } public static void setElementSetParentOverrideHandler(boolean elementSetParentHandler) { JBossXBBuilder.elementSetParentHandler = elementSetParentHandler; } public static boolean isRepeatableParticleHandlers() { return repeatableParticleHandlers; } public static void setRepeatableParticleHandlers(boolean repeatableParticleHandlers) { JBossXBBuilder.repeatableParticleHandlers = repeatableParticleHandlers; } /** * Create a new schema binding initializer * * @param the root type * @param root the root class * @return the initializer * @throws IllegalArgumentException for a null root */ public static SchemaBindingInitializer newInitializer(Class root) { return new BuilderSchemaBindingInitializer(root); } /** * Calls build(false, roots). * * @param roots * @return */ public static SchemaBinding build(Class... roots) { return build(false, roots); } /** * Builds a schema binding from an array of classes. The classes must be mapped to the same namespace. * SchemaBinding for the first class will be built by calling build(root, rebuildFirst). * For each subsequent class build(SchemaBinding, root) will be called passing in the schema binding * created for the first root class. * * @param rebuildFirst * @param roots * @return */ public static SchemaBinding build(boolean rebuildFirst, Class... roots) { if(roots == null || roots.length == 0) throw new IllegalArgumentException("There has to be at least one root class in the arguments."); Class root = roots[0]; if(root == null) throw new IllegalArgumentException("Root class can't be null."); SchemaBinding schema = build(root, rebuildFirst); for(int i = 1; i < roots.length; ++i) { root = roots[i]; if(root == null) throw new IllegalArgumentException("Root class can't be null."); build(schema, root); } return schema; } /** * Build from a preparsed schema binding. The target namespaces of the SchemaBinding and the class must be equal. * Otherwise, an exception will be thrown. Schema properties defined with annotations on the class will be ignored * and won't override the ones in the SchemaBinding instance (except for the prefix mappings which unless a conflict * found will be added to the SchemaBinding and in case of prefix mapping conflict an exception will be thrown). * * @param schemaBinding the schema binding * @param root the root * @throws IllegalArgumentException for a null schema binding or root */ public static void build(SchemaBinding schemaBinding, Class root) { if (schemaBinding == null) throw new IllegalArgumentException("Null schemaBinding"); if (root == null) throw new IllegalArgumentException("Null root"); ClassInfo classInfo = JBossXBBuilder.configuration.getClassInfo(root); // add prefix mappings JBossXmlSchema schema = classInfo.getUnderlyingAnnotation(JBossXmlSchema.class); PackageInfo packageInfo = classInfo.getPackage(); if (schema == null && packageInfo != null) { schema = packageInfo.getUnderlyingAnnotation(JBossXmlSchema.class); } String classNamespace = XMLConstants.NULL_NS_URI; Set schemaNamespaces = schemaBinding.getNamespaces(); String schemaNamespace = schemaNamespaces.iterator().next(); if(schema != null) { // check the default namespaces are equal if(!JBossXmlConstants.DEFAULT.equals(schema.namespace())) classNamespace = schema.namespace(); // add prefix mappings if (schema.xmlns().length > 0) { for(int i = 0; i < schema.xmlns().length; ++i) { String prefix = schema.xmlns()[i].prefix(); String existingMapping = schemaBinding.getNamespace(prefix); if(existingMapping != null) { String newMapping = schema.xmlns()[i].namespaceURI(); if(!existingMapping.equals(newMapping)) throw new IllegalStateException("Class " + root.getName() + " maps prefix '" + prefix + "' to namespace '" + newMapping + "' while in the schema binding it is mapped to '" + existingMapping + "'"); } else schemaBinding.addPrefixMapping(prefix, schema.xmlns()[i].namespaceURI()); } } } if(!classNamespace.equals(schemaNamespace)) throw new IllegalStateException("SchemaBinding namespace '" + schemaNamespace + "' does not match class namespace '" + classNamespace + "'"); JBossXBNoSchemaBuilder builder = new JBossXBNoSchemaBuilder(classInfo); builder.setUseUnorderedSequence(useUnorderedSequence); builder.setSequencesRequirePropOrder(sequencesRequirePropOrder); builder.setElementSetParentOverrideHandler(elementSetParentHandler); builder.setRepeatableParticleHandlers(repeatableParticleHandlers); builder.build(schemaBinding); } /** * Build the SchemaBinding from the class * * @param root the root * @return the schema binding * @throws IllegalArgumentException for a null root */ public static SchemaBinding build(Class root) { return build(root, false); } /** * Build the SchemaBinding from the class. * If the SchemaBinding has previously been buil, cached and rebuild argument is false * then the previously built SchemaBinding is returned. Otherwise, a new SchemaBinding instance * is built and cached. * * @param root * @param rebuild * @return */ public static SchemaBinding build(Class root, boolean rebuild) { ClassInfo classInfo = JBossXBBuilder.configuration.getClassInfo(root); SchemaBinding binding = classInfo.getAttachment(SchemaBinding.class); if (rebuild || binding == null) { JBossXBNoSchemaBuilder builder = new JBossXBNoSchemaBuilder(classInfo); builder.setUseUnorderedSequence(useUnorderedSequence); builder.setSequencesRequirePropOrder(sequencesRequirePropOrder); builder.setElementSetParentOverrideHandler(elementSetParentHandler); builder.setRepeatableParticleHandlers(repeatableParticleHandlers); binding = builder.build(); classInfo.setAttachment(SchemaBinding.class.getName(), binding); } return binding; } /** * Initialize the schema binding from the root * * @param schemaBinding the schema binding * @param classInfo the classInfo */ protected static void initSchema(SchemaBinding schemaBinding, ClassInfo classInfo) { // Look for a schema attribute on either the root or the root's package JBossXmlSchema schema = classInfo.getUnderlyingAnnotation(JBossXmlSchema.class); PackageInfo packageInfo = classInfo.getPackage(); if (schema == null && packageInfo != null) { schema = packageInfo.getUnderlyingAnnotation(JBossXmlSchema.class); } // Use the root's package name String packageName = null; if (packageInfo != null) packageName = packageInfo.getName(); // Look for annotation override if (schema != null) { String schemaPackageName = schema.packageName(); if (JBossXmlConstants.DEFAULT.equals(schemaPackageName) == false) packageName = schemaPackageName; if(schema.xmlns().length > 0) { for(int i = 0; i < schema.xmlns().length; ++i) { schemaBinding.addPrefixMapping(schema.xmlns()[i].prefix(), schema.xmlns()[i].namespaceURI()); } } } // Set the default namespace, if there are none already if (schemaBinding.getNamespaces().isEmpty()) { String namespace = XMLConstants.NULL_NS_URI; if (schema != null) { String schemaNamespace = schema.namespace(); if (JBossXmlConstants.DEFAULT.equals(schemaNamespace) == false) namespace = schemaNamespace; } schemaBinding.setNamespaces(new HashSet(Collections.singleton(namespace))); } // Apply the package name if (packageName != null) { PackageMetaData packageMetaData = new PackageMetaData(); packageMetaData.setName(packageName); schemaBinding.setPackageMetaData(packageMetaData); } // Nothing more to do if no annotation if (schema == null) return; // Apply the annotation values schemaBinding.setIgnoreUnresolvedFieldOrClass(schema.ignoreUnresolvedFieldOrClass()); schemaBinding.setIgnoreLowLine(schema.ignoreLowLine()); schemaBinding.setReplacePropertyRefs(schema.replacePropertyRefs()); schemaBinding.setStrictSchema(schema.strict()); schemaBinding.setNormalizeSpace(schema.normalizeSpace()); } /** * Generate an xml name from a clazz name * * @param typeInfo the typeInfo * @param ignoreLowerLine whether to ignore the lower line * @return the xml name */ public static String generateXMLNameFromClassName(TypeInfo typeInfo, boolean ignoreLowerLine) { return generateXMLNameFromJavaName(typeInfo.getSimpleName(), true, ignoreLowerLine); } /** * Generate an xml name from a java name * * @param string the java name * @param dash whether to insert dashes to seperate words * @param ignoreLowerLine TODO ignore the lower line * @return the xml name */ public static String generateXMLNameFromJavaName(String string, boolean dash, boolean ignoreLowerLine) { // Whether we have seen a lower case character boolean seenLower = false; // Whether this is the first character boolean first = true; StringBuilder result = new StringBuilder(string.length()); for (int i = 0; i < string.length(); ++i) { char c = string.charAt(i); // Lowercase until we see an uppercase character (but always on the first character) if (first || seenLower == false && Character.isUpperCase(c)) { result.append(Character.toLowerCase(c)); first = false; } // Insert the dash and start the next word with lowercase // but only if we have seen a lower case character else if (seenLower && Character.isUpperCase(c) && dash) { result.append('-'); result.append(Character.toLowerCase(c)); seenLower = false; } // Just append the character else { result.append(c); seenLower = true; } } return result.toString(); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/0000755000175000017500000000000011620316762027724 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/BuilderUtil.java0000644000175000017500000000435410625561630033021 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import org.jboss.util.Strings; import org.jboss.xb.spi.AbstractBeanAdapter; import org.w3c.dom.Element; /** * BuilderUtil. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BuilderUtil { /** * Work out a safe debug string for the object * * @param object the object * @return the string */ public static String toDebugString(Object object) { if (object == null) return "null"; if (object instanceof String || object instanceof Boolean || object instanceof Byte || object instanceof Character || object instanceof Double || object instanceof Integer || object instanceof Float || object instanceof Short) return object.toString(); if (object instanceof AbstractBeanAdapter) return ((AbstractBeanAdapter) object).getBeanInfo().getName() + "@" + System.identityHashCode(object); if (object instanceof Element) { Element element = (Element) object; return "Element@" + System.identityHashCode(element) + "{" + element.getLocalName() + "}"; } return Strings.defaultToString(object); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/SimplePropertyHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/SimplePropertyHan0000644000175000017500000000427310625561630033302 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.spi.BeanAdapter; /** * SimplePropertyHandler. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class SimplePropertyHandler extends AbstractPropertyHandler { /** * Create a new PropertyHandler. * * @param propertyInfo the property * @param propertyType the property type * @throws IllegalArgumentException for a null property */ public SimplePropertyHandler(PropertyInfo propertyInfo, TypeInfo propertyType) { super(propertyInfo, propertyType); } @Override public void handle(PropertyInfo propertyInfo, TypeInfo propertyType, Object parent, Object child, QName qName) { try { BeanAdapter beanAdapter = (BeanAdapter) parent; beanAdapter.set(propertyInfo, child); } catch (Throwable t) { throw new RuntimeException("QName " + qName + " error setting property " + propertyInfo.getName() + " with value " + BuilderUtil.toDebugString(child) + " to " + BuilderUtil.toDebugString(parent)); } } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/PropertyInterceptor.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/PropertyIntercept0000644000175000017500000000601411276564547033367 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.logging.Logger; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor; import org.jboss.xb.spi.BeanAdapter; /** * PropertyInterceptor. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class PropertyInterceptor extends DefaultElementInterceptor { /** The log */ private static final Logger log = Logger.getLogger(PropertyInterceptor.class); /** Whether trace is enabled */ private boolean trace = log.isTraceEnabled(); /** The property info */ private PropertyInfo propertyInfo; /** The property type */ private TypeInfo propertyType; /** * Create a new PropertyHandler. * * @param propertyInfo the property * @param propertyType the property type * @throws IllegalArgumentException for a null property */ public PropertyInterceptor(PropertyInfo propertyInfo, TypeInfo propertyType) { if (propertyInfo == null) throw new IllegalArgumentException("Null property info"); if (propertyType == null) throw new IllegalArgumentException("Null property type"); this.propertyInfo = propertyInfo; this.propertyType = propertyType; } @Override @SuppressWarnings("unchecked") public void add(Object parent, Object child, QName qName) { if (trace) log.trace("setParent " + qName + " parent=" + BuilderUtil.toDebugString(parent) + " child=" + BuilderUtil.toDebugString(child) +" property=" + propertyInfo.getName()); try { BeanAdapter beanAdapter = (BeanAdapter) parent; beanAdapter.set(propertyInfo, child); } catch (Throwable t) { throw new RuntimeException("QName " + qName + " error setting property " + propertyInfo.getName() + " with value " + BuilderUtil.toDebugString(child) + " to " + BuilderUtil.toDebugString(parent), t); } } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/GroupBeanHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/GroupBeanHandler.0000644000175000017500000001672311334762232033115 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.logging.Logger; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; import org.jboss.xb.spi.BeanAdapter; import org.jboss.xb.spi.BeanAdapterFactory; import org.xml.sax.Attributes; /** * A GroupBeanHandler. * * Before creating a new instance for the group during unmarshalling, this handler will try to obtain * the current value of the group from the parent object using the property the group is bound to. * If the current group value is not null then it will be returned, * otherwise a new instance will be created. This is necessary to support unordered sequences. * * If the property for the group is not readable then the step to get the group value will be skipped. * It doesn't have to be a requirement for the property to be readable. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class GroupBeanHandler implements ParticleHandler { /** The log */ protected static final Logger log = Logger.getLogger("org.jboss.xb.builder.runtime.GroupBeanHandler"); /** Whether trace is enabled */ protected boolean trace = log.isTraceEnabled(); /** The bean name */ protected String name; /** The BeanAdapter */ protected BeanAdapterFactory beanAdapterFactory; protected QName groupName; public GroupBeanHandler(String name, BeanAdapterFactory beanAdapterFactory, ModelGroupBinding group) { if (name == null) throw new IllegalArgumentException("Null name"); if (beanAdapterFactory == null) throw new IllegalArgumentException("Null bean adapter factory"); if(group == null) throw new IllegalArgumentException("Null group"); if(group.getQName() == null) throw new JBossXBRuntimeException("The group has to have a non-null QName."); this.name = name; this.beanAdapterFactory = beanAdapterFactory; this.groupName = group.getQName(); } public Object startParticle(Object parent, QName qName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { if (trace) log.trace(" startElement " + qName + " bean=" + name + " parent=" + BuilderUtil.toDebugString(parent)); if(!(parent instanceof BeanAdapter)) throw new JBossXBRuntimeException("Parent expected to be an instance of BeanAdapter: " + parent); AbstractPropertyHandler groupHandler = ((BeanAdapter) parent).getPropertyHandler(groupName); if (groupHandler == null) throw new JBossXBRuntimeException("No property mapped for group " + qName + " in bean adapter" + ((BeanAdapter)parent).getValue() + ", available: " + ((BeanAdapter) parent).getAvailable()); Object groupValue = null; PropertyInfo propertyInfo = groupHandler.getPropertyInfo(); if(propertyInfo.isReadable()) { Object parentValue = ((BeanAdapter) parent).getValue(); try { groupValue = ((BeanAdapter) parent).get(propertyInfo); } catch (Throwable e) { throw new JBossXBRuntimeException("Failed to get group value from parent: parent=" + parentValue + ", property=" + propertyInfo.getName() + ", qName=" + qName, e); } } if(groupValue == null || particle.isRepeatable()) { try { return beanAdapterFactory.newInstance(); } catch (Throwable t) { throw new RuntimeException("Element " + qName + " (group " + groupName +") error invoking beanAdapterFactory.newInstance() for bean=" + name, t); } } else return new SingletonBeanAdapter(beanAdapterFactory, groupValue); } public void setParent(Object parent, Object o, QName qName, ParticleBinding particle, ParticleBinding parentParticle) { if (trace) log.trace("setParent " + qName + " parent=" + BuilderUtil.toDebugString(parent) + " child=" + BuilderUtil.toDebugString(o)); BeanAdapter beanAdapter = (BeanAdapter) parent; AbstractPropertyHandler propertyHandler = beanAdapter.getPropertyHandler(groupName); if (propertyHandler == null) { if (particle.getTerm().getSchema().isStrictSchema()) throw new RuntimeException("QName " + qName + " unknown property parent=" + BuilderUtil.toDebugString(parent) + " child=" + BuilderUtil.toDebugString(o) + " available=" + beanAdapter.getAvailable()); if (trace) log.trace("QName " + qName + " unknown property parent=" + BuilderUtil.toDebugString(parent) + " child=" + BuilderUtil.toDebugString(o)); return; } propertyHandler.doHandle(beanAdapter, o, qName); } public Object endParticle(Object o, QName qName, ParticleBinding particle) { if (trace) log.trace("endElement " + qName + " o=" + BuilderUtil.toDebugString(o)); BeanAdapter beanAdapter = (BeanAdapter) o; Object value = beanAdapter.getValue(); if(!particle.isRepeatable()) { ValueAdapter valueAdapter = particle.getTerm().getValueAdapter(); if (valueAdapter != null) value = valueAdapter.cast(value, null); } return value; } private static class SingletonBeanAdapter extends BeanAdapter { private final Object value; public SingletonBeanAdapter(BeanAdapterFactory beanAdapterFactory, Object instance) { super(beanAdapterFactory); this.value = instance; } protected Object construct() { return value; } @Override public Object get(PropertyInfo propertyInfo) throws Throwable { return propertyInfo.get(value); } @Override public Object getValue() { return value; } @Override public void set(PropertyInfo propertyInfo, Object child) throws Throwable { propertyInfo.set(value, child); } } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/ChildCollectionWildcardHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/ChildCollectionWi0000644000175000017500000000734111061473704033212 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import java.util.Collection; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.spi.BeanAdapter; import org.xml.sax.Attributes; /** * CollectionPropertyWildcardHandler. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ChildCollectionWildcardHandler implements ParticleHandler { /** Singleton */ public static ChildCollectionWildcardHandler SINGLETON = new ChildCollectionWildcardHandler(); /** The wrapper type */ private BeanInfo beanInfo; /** The wrapper property */ private String property; /** * Create a new ChildCollectionWildcardHandler. */ public ChildCollectionWildcardHandler() { } /** * Create a new ChildCollectionWildcardHandler. * * @param beanInfo the wrapper class * @param property the wrapper property * @throws IllegalArgumentException for a null parameter */ public ChildCollectionWildcardHandler(BeanInfo beanInfo, String property) { if (beanInfo == null) throw new IllegalArgumentException("Null beanInfo"); if (property == null) throw new IllegalArgumentException("Null property"); this.beanInfo = beanInfo; this.property = property; } public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { return parent; } @SuppressWarnings("unchecked") public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { BeanAdapter beanAdapter = (BeanAdapter) parent; Collection collection = (Collection) beanAdapter.getValue(); if (beanInfo != null) { try { ClassInfo classInfo = beanInfo.getClassInfo(); TypeInfo valueType = classInfo.getTypeInfoFactory().getTypeInfo(o.getClass()); if (classInfo.isAssignableFrom(valueType) == false) { Object wrapper = beanInfo.newInstance(); beanInfo.setProperty(wrapper, property, o); o = wrapper; } } catch (Throwable t) { throw new RuntimeException("Error wrapping object in " + beanInfo.getName()); } } collection.add(o); } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return o; } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/ArrayWrapperRepeatableParticleHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/ArrayWrapperRepea0000644000175000017500000000773211334317667033263 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.reflect.spi.ArrayInfo; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.RepeatableParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; /** * A ArrayWrapperRepeatableParticleHandler. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ArrayWrapperRepeatableParticleHandler implements RepeatableParticleHandler { /** The log */ protected static final Logger log = Logger.getLogger(ArrayWrapperRepeatableParticleHandler.class); /** Whether trace is enabled */ protected boolean trace = log.isTraceEnabled(); private final AbstractPropertyHandler setParentProperty; public ArrayWrapperRepeatableParticleHandler(AbstractPropertyHandler setParentProperty) { if(setParentProperty == null) throw new IllegalArgumentException("setParentProperty is null"); this.setParentProperty = setParentProperty; } public void addTermValue(Object particleValue, Object termValue, QName elementName, ParticleBinding particle, ParticleBinding parentParticle, ParticleHandler handler) { // ValueAdapter valueAdapter = particle.getTerm().getValueAdapter(); // if(valueAdapter != null) // termValue = valueAdapter.cast(termValue, null); ((List)particleValue).add(termValue); if(trace) log.trace("added " + elementName + " " + termValue); } public void endRepeatableParticle(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { if(trace) log.trace("endRepeatableParticle " + elementName); ValueAdapter valueAdapter = particle.getTerm().getValueAdapter(); if(valueAdapter != null) o = valueAdapter.cast(o, null); o = toArray((List) o, (ArrayInfo) setParentProperty.getPropertyType()); setParentProperty.doHandle(parent, o, elementName); } public Object startRepeatableParticle(Object parent, QName startName, ParticleBinding particle) { if(trace) log.trace("startRepeatableParticle " + startName); return new ArrayList(); } private Object[] toArray(List elements, ArrayInfo arrayInfo) { Object[] arr; try { arr = (Object[]) arrayInfo.newArrayInstance(elements.size()); for (int i = 0; i < arr.length; ++i) arr[i] = elements.get(i); return arr; } catch (Throwable t) { throw new RuntimeException("Error creating array of type " + arrayInfo.getName() + " from " + elements, t); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/DefaultMapEntry.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/DefaultMapEntry.j0000644000175000017500000000355010742740174033150 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; /** * A DefaultMapEntry. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class DefaultMapEntry { private Object key; private Object value; /** * Get the key. * * @return the key. */ public Object getKey() { return key; } /** * Set the key. * * @param key The key to set. */ public void setKey(Object key) { this.key = key; } /** * Get the value. * * @return the value. */ public Object getValue() { return value; } /** * Set the value. * * @param value The value to set. */ public void setValue(Object value) { this.value = value; } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/SetParentOverrideHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/SetParentOverride0000644000175000017500000000506511334317774033270 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.xml.sax.Attributes; /** * A SetParentOverrideHandler. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class SetParentOverrideHandler implements ParticleHandler { protected ParticleHandler delegate; protected AbstractPropertyHandler propHandler; public SetParentOverrideHandler(ParticleHandler delegate, AbstractPropertyHandler propHandler) { if(delegate == null) throw new IllegalArgumentException("delegate must not be null."); if(propHandler == null) throw new IllegalArgumentException("property handler must not be null."); this.delegate = delegate; this.propHandler = propHandler; } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return delegate.endParticle(o, elementName, particle); } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { propHandler.doHandle(parent, o, elementName); } public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { return delegate.startParticle(parent, elementName, particle, attrs, nsCtx); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/PropertyHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/PropertyHandler.j0000644000175000017500000000425411276564547033243 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.spi.BeanAdapter; /** * PropertyHandler. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class PropertyHandler extends AbstractPropertyHandler { /** * Create a new PropertyHandler. * * @param propertyInfo the property * @param propertyType the property type * @throws IllegalArgumentException for a null property */ public PropertyHandler(PropertyInfo propertyInfo, TypeInfo propertyType) { super(propertyInfo, propertyType); } @Override public void handle(PropertyInfo propertyInfo, TypeInfo propertyType, Object parent, Object child, QName qName) { try { BeanAdapter beanAdapter = (BeanAdapter) parent; beanAdapter.set(propertyInfo, child); } catch (Throwable t) { throw new RuntimeException("QName " + qName + " error setting property " + propertyInfo.getName() + " with value " + BuilderUtil.toDebugString(child) + " to " + BuilderUtil.toDebugString(parent), t); } } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/WrapperBeanAdapter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/WrapperBeanAdapte0000644000175000017500000000474110764203563033204 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.xb.spi.BeanAdapter; /** * WrapperBeanAdapter. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class WrapperBeanAdapter extends BeanAdapter { /** The wrapped bean adapter */ private BeanAdapter wrapped; /** The not wrapped value */ private Object notWrapped; /** * Create a new WrapperBeanAdapter. * * @param beanAdapterFactory our factory * @param wrapped the wrapped adapter */ public WrapperBeanAdapter(WrapperBeanAdapterFactory beanAdapterFactory, BeanAdapter wrapped) { super(beanAdapterFactory); this.wrapped = wrapped; } @Override protected WrapperBeanAdapterFactory getBeanAdapterFactory() { return (WrapperBeanAdapterFactory) super.getBeanAdapterFactory(); } @Override public Object get(PropertyInfo propertyInfo) throws Throwable { return wrapped.get(propertyInfo); } @Override public Object getValue() { if (notWrapped != null) return notWrapped; else return wrapped.getValue(); } @Override public void set(PropertyInfo propertyInfo, Object child) throws Throwable { Class stopWrapping = getBeanAdapterFactory().getStopWrapping(); if (child != null && stopWrapping != null && stopWrapping.isInstance(child)) notWrapped = child; else wrapped.set(propertyInfo, child); } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/CollectionPropertyWildcardHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/CollectionPropert0000644000175000017500000000523410625561630033322 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.spi.BeanAdapter; import org.xml.sax.Attributes; /** * CollectionPropertyWildcardHandler. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class CollectionPropertyWildcardHandler extends CollectionPropertyHandler implements ParticleHandler { /** * Create a new CollectionPropertyWildcardHandler. * * @param propertyInfo the property * @param propertyType the property type * @throws IllegalArgumentException for a null property */ public CollectionPropertyWildcardHandler(PropertyInfo propertyInfo, TypeInfo propertyType) { super(propertyInfo, propertyType); } public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { return parent; } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { BeanAdapter beanAdapter = (BeanAdapter) parent; AbstractPropertyHandler propertyHandler = beanAdapter.getPropertyHandler(elementName); if (propertyHandler != null) propertyHandler.doHandle(parent, o, elementName); else doHandle(parent, o, elementName); } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return o; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/WrapperBeanAdapterFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/WrapperBeanAdapte0000644000175000017500000000566410764203563033211 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2007, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.xb.spi.BeanAdapter; import org.jboss.xb.spi.BeanAdapterFactory; /** * WrapperBeanAdapterFactory. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class WrapperBeanAdapterFactory extends BeanAdapterFactory { /** The wrapped bean adapter factory */ private BeanAdapterFactory wrapped; /** The type to stop wrapping at */ private Class stopWrapping; /** * Create a new WrapperBeanAdapterFactory. * * @param wrapped the wrapped factory * @param stopWrapping the stop wrapping type */ public WrapperBeanAdapterFactory(BeanAdapterFactory wrapped, Class stopWrapping) { this.wrapped = wrapped; this.stopWrapping = stopWrapping; } /** * The type to stop wrapping at * * @return the stop wrapping type */ public Class getStopWrapping() { return stopWrapping; } @Override public WrapperBeanAdapter newInstance() { BeanAdapter adapter = wrapped.newInstance(); return new WrapperBeanAdapter(this, adapter); } @Override public void addProperty(QName name, AbstractPropertyHandler propertyHandler) { throw new UnsupportedOperationException("addProperty"); } @Override public String getAvailable() { return wrapped.getAvailable(); } @Override public Map getProperties() { return wrapped.getProperties(); } @Override public AbstractPropertyHandler getPropertyHandler(QName name) { return wrapped.getPropertyHandler(name); } @Override public AbstractPropertyHandler getWildcardHandler() { return wrapped.getWildcardHandler(); } @Override public void setWildcardHandler(AbstractPropertyHandler wildcardHandler) { throw new UnsupportedOperationException("addProperty"); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/ValueHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/ValueHandler.java0000644000175000017500000001201510742740174033142 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.logging.Logger; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.spi.BeanAdapter; /** * ValueHandler. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ValueHandler extends CharactersHandler { /** The log */ private final Logger log = Logger.getLogger(getClass()); /** Whether trace is enabled */ private boolean trace = log.isTraceEnabled(); /** The property info */ private PropertyInfo propertyInfo; /** value type info */ private TypeInfo valueTypeInfo; /** The wrapper type */ private BeanInfo beanInfo; /** The wrapper property */ private String property; /** * Create a new AbstractPropertyHandler * * @param propertyInfo the property * @throws IllegalArgumentException for a null parameter */ public ValueHandler(PropertyInfo propertyInfo) { if (propertyInfo == null) throw new IllegalArgumentException("Null propertyInfo"); this.propertyInfo = propertyInfo; this.valueTypeInfo = propertyInfo.getType(); } /** * Create a new ValueHandler. * * @param propertyInfo the property * @param valueTypeInfo the type of the property to cast the value to before setting */ public ValueHandler(PropertyInfo propertyInfo, TypeInfo valueTypeInfo) { if (propertyInfo == null) throw new IllegalArgumentException("Null propertyInfo"); this.propertyInfo = propertyInfo; this.valueTypeInfo = valueTypeInfo; if(valueTypeInfo == null) this.valueTypeInfo = propertyInfo.getType(); } /** * Create a new AbstractPropertyHandler * * @param propertyInfo the property * @param beanInfo the wrapper class * @param property the wrapper property * @throws IllegalArgumentException for a null qName or property */ public ValueHandler(PropertyInfo propertyInfo, BeanInfo beanInfo, String property) { if (propertyInfo == null) throw new IllegalArgumentException("Null propertyInfo"); if (beanInfo == null) throw new IllegalArgumentException("Null beanInfo"); if (property == null) throw new IllegalArgumentException("Null property"); this.propertyInfo = propertyInfo; this.valueTypeInfo = propertyInfo.getType(); this.beanInfo = beanInfo; this.property = property; } /** * Get the property info * * @return the property info */ public PropertyInfo getPropertyInfo() { return propertyInfo; } @Override public void setValue(QName qName, ElementBinding element, Object owner, Object value) { if (trace) log.trace("QName " + qName + " handle " + BuilderUtil.toDebugString(value) + " to " + BuilderUtil.toDebugString(owner)); try { value = valueTypeInfo.convertValue(value, false); if (beanInfo != null) { ClassInfo classInfo = beanInfo.getClassInfo(); TypeInfo valueType = classInfo.getTypeInfoFactory().getTypeInfo(value.getClass()); if (classInfo.isAssignableFrom(valueType) == false) { Object wrapper = beanInfo.newInstance(); beanInfo.setProperty(wrapper, property, value); value = wrapper; } } BeanAdapter beanAdapter = (BeanAdapter) owner; beanAdapter.set(propertyInfo, value); } catch (Throwable t) { throw new RuntimeException("QName " + qName + " error setting characters " + propertyInfo.getName() + " with value " + BuilderUtil.toDebugString(value) + " to " + BuilderUtil.toDebugString(owner) + " property=" + propertyInfo.getName(), t); } } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/ChildCollectionInterceptor.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/ChildCollectionIn0000644000175000017500000000344111061473704033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import java.util.Collection; import javax.xml.namespace.QName; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor; import org.jboss.xb.spi.BeanAdapter; /** * ChildCollectionInterceptor. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ChildCollectionInterceptor extends DefaultElementInterceptor { /** The instance */ public static final ChildCollectionInterceptor SINGLETON = new ChildCollectionInterceptor(); @Override @SuppressWarnings("unchecked") public void add(Object parent, Object child, QName qName) { BeanAdapter beanAdapter = (BeanAdapter) parent; Collection collection = (Collection) beanAdapter.getValue(); collection.add(child); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/CollectionPropertyHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/CollectionPropert0000644000175000017500000000722211337022577033324 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import java.util.Collection; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.spi.BeanAdapter; import org.jboss.xb.util.CollectionFactory; /** * CollectionPropertyHandler. * * @author Adrian Brock * @author Ales Justin * @version $Revision: 1.1 $ */ public class CollectionPropertyHandler extends AbstractPropertyHandler { private final CollectionFactory colFactory; /** The component type info */ private TypeInfo componentType; /** * Create a new CollectionPropertyHandler. * * @param propertyInfo the property * @param propertyType the property type * @throws IllegalArgumentException for a null qName or property */ public CollectionPropertyHandler(PropertyInfo propertyInfo, TypeInfo propertyType) { super(propertyInfo, propertyType); componentType = ((ClassInfo) propertyType).getComponentType(); colFactory = CollectionFactory.getFactory((ClassInfo) propertyType); } @Override @SuppressWarnings("unchecked") public void handle(PropertyInfo propertyInfo, TypeInfo propertyType, Object parent, Object child, QName qName) { if (componentType != null && child != null) { if(!componentType.isInstance(child)) throw new IllegalArgumentException("Child is not an instance of " + componentType + ", child: " + child); } BeanAdapter beanAdapter = (BeanAdapter) parent; Collection c = null; try { if (propertyInfo.getGetter() != null) c = (Collection) beanAdapter.get(propertyInfo); } catch (Throwable t) { throw new RuntimeException("QName " + qName + " error getting collection property " + propertyInfo.getName() + " for " + BuilderUtil.toDebugString(parent), t); } // No collection so create one if (c == null) { try { c = colFactory.createCollection(); } catch (Throwable t) { throw new RuntimeException("QName " + qName + " error creating collection: " + propertyType.getName(), t); } try { beanAdapter.set(propertyInfo, c); } catch (Throwable t) { throw new RuntimeException("QName " + qName + " error setting collection property " + propertyInfo.getName() + " for " + BuilderUtil.toDebugString(parent) + " with value " + BuilderUtil.toDebugString(c), t); } } c.add(child); } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/BuilderSimpleParticleHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/BuilderSimplePart0000644000175000017500000000330410562616254033241 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.xml.sax.Attributes; /** * BuilderSimpleParticleHandler. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BuilderSimpleParticleHandler extends BuilderParticleHandler { /** The singleton instance */ public static final BuilderSimpleParticleHandler SIMPLE_INSTANCE = new BuilderSimpleParticleHandler(); @Override public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { return null; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/AbstractPropertyHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/AbstractPropertyH0000644000175000017500000001017511270273231033265 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.logging.Logger; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.AttributeHandler; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; import org.jboss.xb.spi.BeanAdapter; /** * AbstractPropertyHandler * * @author Adrian Brock * @version $Revision: 1.1 $ */ public abstract class AbstractPropertyHandler extends AttributeHandler { /** The log */ protected final Logger log = Logger.getLogger(getClass()); /** Whether trace is enabled */ protected boolean trace = log.isTraceEnabled(); /** The property info */ private PropertyInfo propertyInfo; /** The property type */ private TypeInfo propertyType; /** * Create a new AbstractPropertyHandler * * @param propertyInfo the property * @param propertyType the property type * @throws IllegalArgumentException for a null parameteers */ public AbstractPropertyHandler(PropertyInfo propertyInfo, TypeInfo propertyType) { if (propertyInfo == null) throw new IllegalArgumentException("Null propertyInfo"); if (propertyType == null) throw new IllegalArgumentException("Null propertyType"); this.propertyInfo = propertyInfo; this.propertyType = propertyType; } /** * Get the property info * * @return the property info */ public PropertyInfo getPropertyInfo() { return propertyInfo; } /** * Get the property type * * @return the property type */ public TypeInfo getPropertyType() { return propertyType; } public void doHandle(Object parent, Object child, QName qName) { if (trace) log.trace("QName " + qName + " handle " + BuilderUtil.toDebugString(child) + " to " + BuilderUtil.toDebugString(parent) + " property=" + propertyInfo.getName()); try { handle(propertyInfo, propertyType, parent, child, qName); } catch (RuntimeException e) { throw e; } catch (Throwable t) { throw new RuntimeException("QName " + qName + " error setting property " + propertyInfo.getName() + " with value " + BuilderUtil.toDebugString(child) + " to " + BuilderUtil.toDebugString(parent), t); } } @Override public void attribute(QName elemName, QName attrName, AttributeBinding binding, Object owner, Object value) { ValueAdapter valueAdapter = binding.getValueAdapter(); if (valueAdapter != null) value = valueAdapter.cast(value, null); BeanAdapter parent = (BeanAdapter) owner; doHandle(parent, value, attrName); } /** * Handle the property * * @param propertyInfo the property * @param parent the parent * @param propertyType the property type * @param child the child * @param qName the qName */ public abstract void handle(PropertyInfo propertyInfo, TypeInfo propertyType, Object parent, Object child, QName qName); } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/BuilderParticleHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/BuilderParticleHa0000644000175000017500000001006711357571642033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.sunday.unmarshalling.DefaultHandlers; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; import org.jboss.xb.spi.BeanAdapter; import org.xml.sax.Attributes; /** * BuilderParticleHandler. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BuilderParticleHandler implements ParticleHandler { /** The singleton instance */ public static final BuilderParticleHandler INSTANCE = new BuilderParticleHandler(); public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { return parent; } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { if (particle.getTerm().isModelGroup() == false) { ParticleHandler particleHandler = null; TermBinding parentTerm = parentParticle.getTerm(); if(!parentTerm.isSkip()) particleHandler = parentTerm.getHandler(); if(particleHandler != null) particleHandler.setParent(parent, o, elementName, particle, parentParticle); } } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { ValueAdapter valueAdapter = particle.getTerm().getValueAdapter(); if(valueAdapter != null) o = valueAdapter.cast(o, null); return o; } public static ParticleHandler setParentDelegate(final ParticleHandler typeHandler) { return new ParticleHandler() { private final ParticleHandler delegate = typeHandler; public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return o; } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { if (particle.getTerm().isElement()) delegate.setParent(parent, o, elementName, particle, parentParticle); } public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { return parent; } }; } public static ParticleHandler parentGroup(final ModelGroupBinding group) { if(group.isSkip()) return DefaultHandlers.NOOP_PARTICLE_HANDLER; ParticleHandler handler = group.getHandler(); if(handler == null) throw new JBossXBRuntimeException("The group is expected to have a non-null handler: " + group); return setParentDelegate(handler); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/MapPropertyHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/MapPropertyHandle0000644000175000017500000002406511345730356033257 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import java.lang.reflect.Modifier; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.BeanAccessMode; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.config.spi.Configuration; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.ConstructorInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.annotations.JBossXmlMapEntry; import org.jboss.xb.annotations.JBossXmlMapKey; import org.jboss.xb.annotations.JBossXmlMapValue; import org.jboss.xb.spi.BeanAdapter; /** * MapPropertyHandler. * * @author Alexey Loubyansky * @author Ales Justin * @version $Revision: 1.1 $ */ public class MapPropertyHandler extends AbstractPropertyHandler { private final MapFactory mapFactory; private final MapPutAdapter mapPutAdapter; private TypeInfo keyType; private TypeInfo valueType; /** * Create a new MapPropertyHandler. * * @param config the configuration * @param propertyInfo the property * @param propertyType the property type * @param wrapped the wrapped flag * @throws IllegalArgumentException for a null qName or property */ public MapPropertyHandler(Configuration config, BeanAccessMode beanAccessMode, PropertyInfo propertyInfo, TypeInfo propertyType, boolean wrapped) { super(propertyInfo, propertyType); ClassInfo classInfo = (ClassInfo) propertyType; keyType = classInfo.getKeyType(); valueType = classInfo.getValueType(); if(wrapped) { mapFactory = null; } else { if (Modifier.isAbstract(classInfo.getModifiers())) { mapFactory = HashMapFactory.INSTANCE; } else { ConstructorInfo constructor = classInfo.getDeclaredConstructor(null); if (constructor == null) { for (ConstructorInfo ctor : classInfo.getDeclaredConstructors()) { if (ctor.getParameterTypes().length == 0) { log.warn("ClassInfo.getDeclaredConstructor(null) didn't work for " + classInfo.getName() + ", found the default ctor in ClassInfo.getDeclaredConstructors()"); constructor = ctor; break; } } if (constructor == null) { throw new RuntimeException("Default constructor not found for " + classInfo.getName()); } } mapFactory = new CtorMapFactory(constructor); } } JBossXmlMapEntry entry = propertyInfo.getUnderlyingAnnotation(JBossXmlMapEntry.class); if(entry == null) entry =((ClassInfo)propertyType).getUnderlyingAnnotation(JBossXmlMapEntry.class); if(entry != null && !JBossXmlMapEntry.DEFAULT.class.equals(entry.type())) { BeanInfo entryBean = config.getBeanInfo(entry.type(), beanAccessMode); mapPutAdapter = new CustomMapEntryPutAdapter(entryBean); } else mapPutAdapter = new DefaultMapEntryPutAdapter(); } @Override @SuppressWarnings("unchecked") public void handle(PropertyInfo propertyInfo, TypeInfo propertyType, Object parent, Object child, QName qName) { if(trace) log.trace("handle entry " + qName + ", property=" + propertyInfo.getName() + ", parent=" + parent + ", child=" + child); BeanAdapter beanAdapter = (BeanAdapter) parent; Map m = null; if(mapFactory == null) { // it's wrapped, so the parent expected to be a map m = (Map) beanAdapter.getValue(); } else { try { if (propertyInfo.getGetter() != null) m = (Map) beanAdapter.get(propertyInfo); } catch (Throwable t) { throw new RuntimeException("QName " + qName + " error getting map property " + propertyInfo.getName() + " for " + BuilderUtil.toDebugString(parent), t); } // No map so create one if (m == null) { try { m = mapFactory.createMap(); } catch (Throwable t) { throw new RuntimeException("QName " + qName + " error creating map: " + propertyType.getName(), t); } try { beanAdapter.set(propertyInfo, m); } catch (Throwable t) { throw new RuntimeException("QName " + qName + " error setting map property " + propertyInfo.getName() + " for " + BuilderUtil.toDebugString(parent) + " with value " + BuilderUtil.toDebugString(m), t); } } } try { mapPutAdapter.put(m, child); } catch (Throwable e) { throw new RuntimeException("QName " + qName + " error adding " + BuilderUtil.toDebugString(child) + " to map " + BuilderUtil.toDebugString(m), e); } } private interface MapPutAdapter { void put(Map map, Object entry) throws Throwable; } private class CustomMapEntryPutAdapter implements MapPutAdapter { private final PropertyInfo keyProp; private final PropertyInfo valueProp; CustomMapEntryPutAdapter(BeanInfo entryBean) { PropertyInfo keyProp = null; PropertyInfo valueProp = null; for(PropertyInfo prop : entryBean.getProperties()) { JBossXmlMapKey key = prop.getUnderlyingAnnotation(JBossXmlMapKey.class); if(key != null) { if(keyProp != null) throw new IllegalStateException( "Found two properties in entry type " + entryBean.getName() + " annotated with @JBossXmlMapKey: " + keyProp.getName() + " and " + prop.getName()); keyProp = prop; } JBossXmlMapValue value = prop.getUnderlyingAnnotation(JBossXmlMapValue.class); if(value != null) { if(valueProp != null) throw new IllegalStateException( "Found two properties in entry type " + entryBean.getName() + " annotated with @JBossXmlMapValue: " + valueProp.getName() + " and " + prop.getName()); valueProp = prop; } } if(keyProp == null) throw new IllegalStateException( "Entry type " + entryBean.getName() + " doesn't have any property annotated with @JBossXmlMapKey."); this.keyProp = keyProp; this.valueProp = valueProp; } public void put(Map map, Object entry) throws Throwable { Object key = keyProp.get(entry); Object value = entry; if(valueProp != null) value = valueProp.get(entry); checkPut(map, key, value); } } private class DefaultMapEntryPutAdapter implements MapPutAdapter { public void put(Map map, Object entry) { if(!(entry instanceof DefaultMapEntry)) throw new IllegalStateException("Expected DefaultMapEntry but got " + entry); DefaultMapEntry defEntry = (DefaultMapEntry) entry; Object key = defEntry.getKey(); Object value = defEntry.getValue(); checkPut(map, key, value); } } /** * Check values before they are put into map. * * @param map the map * @param key the key * @param value the value */ protected void checkPut(Map map, Object key, Object value) { if (keyType != null && key!= null && keyType.isInstance(key) == false) throw new IllegalArgumentException("Key is not an instance of " + keyType + ", key: " + key); if (valueType != null && value != null && valueType.isInstance(value) == false) throw new IllegalArgumentException("Value is not an instance of " + valueType + ", value: " + value); map.put(key, value); } private static interface MapFactory { Map createMap() throws Throwable; } private static class HashMapFactory implements MapFactory { static final MapFactory INSTANCE = new HashMapFactory(); @SuppressWarnings("unchecked") public Map createMap() { return new HashMap(); } } private static class CtorMapFactory implements MapFactory { private final ConstructorInfo ctor; CtorMapFactory(ConstructorInfo ctor) { this.ctor = ctor; } @SuppressWarnings("unchecked") public Map createMap() throws Throwable { return (Map) ctor.newInstance(null); } } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/AppendingArrayRepeatableHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/AppendingArrayRep0000644000175000017500000001155111350426230033215 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.ArrayInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.RepeatableParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; import org.jboss.xb.spi.BeanAdapter; /** * This repeatable particle handler is used when repeatable particle handlers are actually disabled. * The reason is instead of creating, copying and setting a new array for every new element added, * it collects elements that appear one after another in XML and then appends to the current * property value. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class AppendingArrayRepeatableHandler implements RepeatableParticleHandler { private final PropertyInfo propertyInfo; private final ArrayInfo arrayInfo; private final AbstractPropertyHandler targetHandler; public AppendingArrayRepeatableHandler(AbstractPropertyHandler propertyHandler) { this.propertyInfo = propertyHandler.getPropertyInfo(); this.arrayInfo = (ArrayInfo) propertyHandler.getPropertyType(); this.targetHandler = propertyHandler; } public void handle(PropertyInfo propertyInfo, TypeInfo propertyType, Object parent, Object child, QName name) { } public void addTermValue(Object particleValue, Object termValue, QName elementName, ParticleBinding particle, ParticleBinding parentParticle, ParticleHandler handler) { ((List)particleValue).add(termValue); } public void endRepeatableParticle(Object parent, Object o, QName name, ParticleBinding particle, ParticleBinding parentParticle) { ValueAdapter valueAdapter = particle.getTerm().getValueAdapter(); if(valueAdapter != null) o = valueAdapter.cast(o, null); BeanAdapter beanAdapter = (BeanAdapter) parent; Object currentArray = null; try { if (propertyInfo.getGetter() != null) currentArray = beanAdapter.get(propertyInfo); } catch (Throwable t) { throw new RuntimeException("QName " + name + " error getting array property " + propertyInfo.getName() + " for " + BuilderUtil.toDebugString(parent), t); } List elements = (List) o; Object[] arr; if (currentArray == null) { try { arr = (Object[]) arrayInfo.newArrayInstance(elements.size()); } catch (Throwable t) { throw new RuntimeException("Error creating array of type " + arrayInfo.getName() + " from " + elements, t); } for (int i = 0; i < arr.length; ++i) arr[i] = elements.get(i); } else { int currentLength = Array.getLength(currentArray); try { arr = (Object[]) arrayInfo.newArrayInstance(currentLength + elements.size()); } catch (Throwable e) { throw new RuntimeException("Error creating array of type " + arrayInfo.getName() + " from " + elements, e); } System.arraycopy(currentArray, 0, arr, 0, currentLength); for (int i = 0; i < elements.size(); ++i) arr[currentLength + i] = elements.get(i); } targetHandler.doHandle(parent, arr, name); } public Object startRepeatableParticle(Object parent, QName startName, ParticleBinding particle) { return new ArrayList(); } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/PropertyWildcardHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/PropertyWildcardH0000644000175000017500000000515211276564547033275 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.spi.BeanAdapter; import org.xml.sax.Attributes; /** * PropertyWildcardHandler. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class PropertyWildcardHandler extends PropertyHandler implements ParticleHandler { /** * Create a new PropertyWildcardHandler. * * @param propertyInfo the property * @param propertyType the property type * @throws IllegalArgumentException for a null property */ public PropertyWildcardHandler(PropertyInfo propertyInfo, TypeInfo propertyType) { super(propertyInfo, propertyType); } public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { return parent; } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { BeanAdapter beanAdapter = (BeanAdapter) parent; AbstractPropertyHandler propertyHandler = beanAdapter.getPropertyHandler(elementName); if (propertyHandler != null) propertyHandler.doHandle(parent, o, elementName); else doHandle(parent, o, elementName); } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return o; } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/ChildWildcardHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/ChildWildcardHand0000644000175000017500000001053410746353474033153 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.spi.BeanAdapter; import org.xml.sax.Attributes; /** * CollectionPropertyWildcardHandler. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class ChildWildcardHandler implements ParticleHandler { /** The property */ private PropertyInfo propertyInfo; /** The wrapper type */ private BeanInfo beanInfo; /** The wrapper property */ private String property; /** * Create a new ChildCollectionWildcardHandler. * * @param propertyInfo the property info * @throws IllegalArgumentException for a null parameter */ public ChildWildcardHandler(PropertyInfo propertyInfo) { if (propertyInfo == null) throw new IllegalArgumentException("Null propertyInfo"); this.propertyInfo = propertyInfo; } /** * Create a new ChildCollectionWildcardHandler. * * @param propertyInfo the property info * @param beanInfo the wrapper class * @param property the wrapper property * @throws IllegalArgumentException for a null parameter */ public ChildWildcardHandler(PropertyInfo propertyInfo, BeanInfo beanInfo, String property) { if (propertyInfo == null) throw new IllegalArgumentException("Null propertyInfo"); if (beanInfo == null) throw new IllegalArgumentException("Null beanInfo"); if (property == null) throw new IllegalArgumentException("Null property"); this.propertyInfo = propertyInfo; this.beanInfo = beanInfo; this.property = property; } public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { return parent; } @SuppressWarnings("unchecked") public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { BeanAdapter beanAdapter = (BeanAdapter) parent; if (beanInfo != null) { try { ClassInfo classInfo = (ClassInfo) propertyInfo.getType();//beanInfo.getClassInfo(); TypeInfo valueType = classInfo.getTypeInfoFactory().getTypeInfo(o.getClass()); if (classInfo.isAssignableFrom(valueType) == false) { Object wrapper = beanInfo.newInstance(); beanInfo.setProperty(wrapper, property, o); o = wrapper; } } catch (Throwable t) { throw new RuntimeException("Error wrapping object in " + beanInfo.getName()); } } try { beanAdapter.set(propertyInfo, o); } catch (Throwable t) { throw new RuntimeException("Error setting wildcard property " + propertyInfo.getName() + " parent=" + BuilderUtil.toDebugString(parent) + " child=" + BuilderUtil.toDebugString(o)); } } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return o; } } ././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/NonXmlAnyElementDOMElementPropertyHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/NonXmlAnyElementD0000644000175000017500000000404111144772643033154 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.xml.sax.Attributes; /** * A DOMElementPropertyHandler. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class NonXmlAnyElementDOMElementPropertyHandler extends PropertyWildcardHandler implements ParticleHandler { public NonXmlAnyElementDOMElementPropertyHandler(PropertyInfo propertyInfo, TypeInfo propertyType) { super(propertyInfo, propertyType); } public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { return DOMHandler.INSTANCE.startParticle(parent, elementName, particle, attrs, nsCtx); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/DOMHandler.java0000644000175000017500000001421110562616254032506 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.jboss.logging.Logger; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; import org.xml.sax.Attributes; public class DOMHandler extends CharactersHandler implements ParticleHandler { /** The logger */ private static final Logger log = Logger.getLogger(DOMHandler.class); /** The instance */ public static final DOMHandler INSTANCE = new DOMHandler(); /** Whether trace is enabled */ private boolean trace = log.isTraceEnabled(); public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { if (trace) log.trace("startParticle " + elementName + " parent=" + BuilderUtil.toDebugString(parent)); Element element = null; if (parent == null || parent instanceof Element == false) element = createTopElement(elementName.getNamespaceURI(), elementName.getLocalPart()); else element = appendChildElement((Element) parent, elementName.getNamespaceURI(), elementName.getLocalPart()); addAttributes(element, attrs); return element; } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { if (trace) log.trace("endParticle " + elementName + " result=" + BuilderUtil.toDebugString(o)); return o; } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { if (trace) log.trace("setParent " + elementName + " parent=" + BuilderUtil.toDebugString(parent) + " o=" + BuilderUtil.toDebugString(o)); } @Override public void setValue(QName qName, ElementBinding element, Object owner, Object value) { setText(owner, value, qName); } @Override public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { return value; } @Override public Object unmarshalEmpty(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData) { return null; } public Element createTopElement(String namespace, String name) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); DOMImplementation impl = builder.getDOMImplementation(); Document document = impl.createDocument(null, null, null); Element element = document.createElementNS(namespace, name); document.appendChild(element); if (trace) log.trace("createTopElement " + namespace + ":" + name + " result=" + BuilderUtil.toDebugString(element)); return element; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException("Error creating dom", e); } } public Element appendChildElement(Element parentElement, String namespace, String name) { Document document = parentElement.getOwnerDocument(); Element element = document.createElementNS(namespace, name); parentElement.appendChild(element); if (trace) log.trace("appendChild parent=" + BuilderUtil.toDebugString(parentElement) + " child=" + BuilderUtil.toDebugString(element)); return element; } public void addAttributes(Element element, Attributes attrs) { for (int i = 0; i < attrs.getLength(); ++i) { String local = attrs.getLocalName(i); String nsURI = attrs.getURI(i); String value = attrs.getValue(i); if (trace) log.trace("setAttribute " + nsURI + " " + local + " element=" + BuilderUtil.toDebugString(element) + " value=" + value); element.setAttributeNS(nsURI, local, value); } } public void setText(Object owner, Object value, QName qName) { if (value == null) return; if (owner == null || owner instanceof Element == false) throw new IllegalStateException("Unexpected owner: " + owner + " for " + qName); if (value instanceof String == false) throw new IllegalStateException("Unexpected value " + value + " for " + qName); Element element = (Element) owner; Text text = element.getOwnerDocument().createTextNode((String) value); if (trace) log.trace("setText " + qName + " parent=" + BuilderUtil.toDebugString(owner) + " child=" + BuilderUtil.toDebugString(value)); element.appendChild(text); } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/NoopPropertyHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/NoopPropertyHandl0000644000175000017500000000334410625561630033302 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.reflect.spi.TypeInfo; /** * NoopPropertyHandler. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class NoopPropertyHandler extends AbstractPropertyHandler { /** * Create a new NoopPropertyHandler. * * @param propertyInfo the property info * @param propertyType the property type */ public NoopPropertyHandler(PropertyInfo propertyInfo, TypeInfo propertyType) { super(propertyInfo, propertyType); } public void handle(PropertyInfo propertyInfo, TypeInfo propertyType, Object parent, Object child, QName qName) { // Nothing } }././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/EnumValueAdapter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/EnumValueAdapter.0000644000175000017500000001056311061473704033133 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import java.util.HashMap; import java.util.Map; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.namespace.QName; import org.jboss.reflect.spi.EnumConstantInfo; import org.jboss.reflect.spi.EnumInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; import org.jboss.xb.annotations.JBossXmlEnum; /** * EnumValueAdapter. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class EnumValueAdapter implements ValueAdapter { /** The qName */ private QName qName; /** The valid values */ private Map valid; /** The jboss enum extension */ private JBossXmlEnum jBossXmlEnum; /** * Create a new EnumValueAdapter. * * @param qName the qName * @param enumInfo the enumeration * @param enumType the enumType * @throws IllegalArgumentException for a null enumInfo or enumType */ public EnumValueAdapter(QName qName, EnumInfo enumInfo, TypeInfo enumType) { if (enumInfo == null) throw new IllegalArgumentException("Null enumInfo"); if (enumType == null) throw new IllegalArgumentException("Null enumType"); this.qName = qName; this.jBossXmlEnum = enumInfo.getUnderlyingAnnotation(JBossXmlEnum.class); // Setup the mapping EnumConstantInfo[] constants = enumInfo.getEnumConstants(); valid = new HashMap(constants.length); for (EnumConstantInfo constant : constants) { String enumValue = constant.getName(); XmlEnumValue xmlEnumValue = constant.getUnderlyingAnnotation(XmlEnumValue.class); if (xmlEnumValue != null) enumValue = xmlEnumValue.value(); Object key; try { key = enumType.convertValue(enumValue, false); } catch (Throwable t) { throw new RuntimeException("Error for enum " + enumInfo.getName() + " unable to convert " + enumValue + " to " + enumType.getName()); } if (isCaseIgnored()) { if (key instanceof String == false) throw new IllegalArgumentException("Cannot ignore case on non string key: " + enumInfo); key = key.toString().toUpperCase(); } Object value = constant.getValue(); valid.put(key, value); } } /** * Check if we should ignore case. * * @return true if case should be ignored, false otherwise */ protected boolean isCaseIgnored() { return jBossXmlEnum != null && jBossXmlEnum.ignoreCase(); } /** * Get the mapping * * @return the mapping */ public Map getMapping() { return valid; } @SuppressWarnings("unchecked") public Object cast(Object o, Class c) { if (o == null) return null; Object key = o; if (isCaseIgnored()) key = key.toString().toUpperCase(); Object result = valid.get(key); if (result == null) { if (qName == null) throw new RuntimeException("Invalid value " + BuilderUtil.toDebugString(o) + " valid are " + valid.keySet()); throw new RuntimeException("Invalid value " + BuilderUtil.toDebugString(o) + " for " + qName + " valid are " + valid.keySet()); } return result; } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/AnyAttributePropertyHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/AnyAttributePrope0000755000175000017500000001173611075435045033303 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.logging.Logger; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.binding.sunday.unmarshalling.AnyAttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.AnyAttributeHandler; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; import org.jboss.xb.spi.BeanAdapter; /** * A AnyAttributePropertyHandler. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class AnyAttributePropertyHandler extends AnyAttributeHandler { /** The log */ protected final Logger log = Logger.getLogger(getClass()); /** Whether trace is enabled */ protected boolean trace = log.isTraceEnabled(); /** The property info */ private PropertyInfo propertyInfo; /** The property type */ private TypeInfo propertyType; public AnyAttributePropertyHandler(PropertyInfo propertyInfo, TypeInfo propertyType) { if (propertyInfo == null) throw new IllegalArgumentException("Null propertyInfo"); if (propertyType == null) throw new IllegalArgumentException("Null propertyType"); if(!propertyType.isMap()) throw new IllegalStateException("Current implementation expects property bound to anyAttribute to be of type Map." + " Property name is " + propertyInfo.getName() + ", property type is " + propertyType.getName()); this.propertyInfo = propertyInfo; } /** * Get the property info * * @return the property info */ public PropertyInfo getPropertyInfo() { return propertyInfo; } public void doHandle(Object parent, Object child, QName qName) { if (trace) log.trace("QName " + qName + " handle " + BuilderUtil.toDebugString(child) + " to " + BuilderUtil.toDebugString(parent) + " property=" + propertyInfo.getName()); try { handle(propertyInfo, propertyType, parent, child, qName); } catch (RuntimeException e) { throw e; } catch (Throwable t) { throw new RuntimeException("QName " + qName + "error setting property " + propertyInfo.getName() + " with value " + BuilderUtil.toDebugString(child) + " to " + BuilderUtil.toDebugString(parent)); } } @Override public void attribute(QName elemName, QName attrName, AnyAttributeBinding binding, Object owner, Object value) { ValueAdapter valueAdapter = binding.getValueAdapter(); if (valueAdapter != null) value = valueAdapter.cast(value, null); BeanAdapter parent = (BeanAdapter) owner; doHandle(parent, value, attrName); } public void handle(PropertyInfo propertyInfo, TypeInfo propertyType, Object parent, Object child, QName name) { BeanAdapter beanAdapter = (BeanAdapter) parent; Map map = null; try { if (propertyInfo.getGetter() != null) map = (Map) beanAdapter.get(propertyInfo); } catch (Throwable t) { throw new RuntimeException("Error getting map for property " + propertyInfo.getName() + " bound to any attribute from " + BuilderUtil.toDebugString(parent), t); } // No map so create one if (map == null) { map = new HashMap(); try { beanAdapter.set(propertyInfo, map); } catch (Throwable t) { throw new RuntimeException("Error setting map property " + propertyInfo.getName() + " bound to any attribute for " + BuilderUtil.toDebugString(parent) + " with value " + BuilderUtil.toDebugString(map), t); } } map.put(name, child); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/runtime/BeanHandler.java0000644000175000017500000001264411334762232032740 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder.runtime; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.RegisteredAttributesHandler; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; import org.jboss.xb.spi.BeanAdapter; import org.jboss.xb.spi.BeanAdapterFactory; import org.xml.sax.Attributes; /** * BeanHandler. * * @author Adrian Brock * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class BeanHandler implements ParticleHandler { /** The log */ protected static final Logger log = Logger.getLogger("org.jboss.xb.builder.runtime.BeanHandler"); /** Whether trace is enabled */ protected boolean trace = log.isTraceEnabled(); /** The bean name */ protected String name; /** The BeanAdapter */ protected BeanAdapterFactory beanAdapterFactory; protected TypeBinding elementType; private RegisteredAttributesHandler attrsHandler = new RegisteredAttributesHandler(); /** * Create a new bean info element handler * * @param name the bean name * @param beanAdapterFactory the bean adapterFactory * @throws IllegalArgumentException for a null parameter */ public BeanHandler(String name, BeanAdapterFactory beanAdapterFactory, TypeBinding elementType) { if (name == null) throw new IllegalArgumentException("Null name"); if (beanAdapterFactory == null) throw new IllegalArgumentException("Null bean adapter factory"); if (elementType == null) throw new IllegalArgumentException("Null element type"); this.name = name; this.beanAdapterFactory = beanAdapterFactory; this.elementType = elementType; } /** * Get the beanAdapterFactory. * * @return the beanAdapterFactory. */ public BeanAdapterFactory getBeanAdapterFactory() { return beanAdapterFactory; } public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { if (trace) log.trace(" startElement " + elementName + " bean=" + name + " parent=" + BuilderUtil.toDebugString(parent)); Object o = null; try { o = beanAdapterFactory.newInstance(); } catch (Throwable t) { throw new RuntimeException("QName " + elementName + " error invoking beanAdapterFactory.newInstance() for bean=" + name, t); } if (o != null) attrsHandler.attributes(o, elementName, elementType, attrs, nsCtx); return o; } public void setParent(Object parent, Object o, QName qName, ParticleBinding particle, ParticleBinding parentParticle) { if (trace) log.trace("setParent " + qName + " parent=" + BuilderUtil.toDebugString(parent) + " child=" + BuilderUtil.toDebugString(o)); BeanAdapter beanAdapter = (BeanAdapter) parent; AbstractPropertyHandler propertyHandler = beanAdapter.getPropertyHandler(qName); if (propertyHandler == null) { if (elementType.getSchemaBinding().isStrictSchema()) throw new RuntimeException("QName " + qName + " unknown property parent=" + BuilderUtil.toDebugString(parent) + " child=" + BuilderUtil.toDebugString(o) + " available=" + beanAdapter.getAvailable()); if (trace) log.trace("QName " + qName + " unknown property parent=" + BuilderUtil.toDebugString(parent) + " child=" + BuilderUtil.toDebugString(o)); return; } propertyHandler.doHandle(beanAdapter, o, qName); } public Object endParticle(Object o, QName qName, ParticleBinding particle) { if (trace) log.trace("endElement " + qName + " o=" + BuilderUtil.toDebugString(o)); BeanAdapter beanAdapter = (BeanAdapter) o; Object value = beanAdapter.getValue(); if(!particle.isRepeatable()) { ValueAdapter valueAdapter = particle.getTerm().getValueAdapter(); if (valueAdapter != null) value = valueAdapter.cast(value, null); } return value; } public RegisteredAttributesHandler getAttributesHandler() { return attrsHandler; } } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/BuilderSchemaBindingInitializer.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/BuilderSchemaBindingIniti0000755000175000017500000000361510562616254033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingInitializer; /** * BuilderSchemaBindingInitializer. * * @param the root typefs * @author Adrian Brock * @version $Revision: 1.1 $ */ public class BuilderSchemaBindingInitializer implements SchemaBindingInitializer { /** The root class */ private Class root; /** * Create a new BuilderSchemaBindingInitializer. * * @param root the root class * @throws IllegalArgumentException for a null root */ public BuilderSchemaBindingInitializer(Class root) { if (root == null) throw new IllegalArgumentException("Null root"); this.root = root; } public SchemaBinding init(SchemaBinding schema) { JBossXBBuilder.build(schema, root); return schema; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/builder/JBossXBNoSchemaBuilder.ja0000644000175000017500000031766511357571642033005 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.builder; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Stack; import javax.xml.XMLConstants; import javax.xml.bind.annotation.XmlAccessOrder; import javax.xml.bind.annotation.XmlAccessorOrder; import javax.xml.bind.annotation.XmlAnyAttribute; import javax.xml.bind.annotation.XmlAnyElement; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementRefs; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlElements; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchema; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlValue; import javax.xml.bind.annotation.adapters.XmlAdapter; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import javax.xml.namespace.QName; import org.jboss.beans.info.spi.BeanAccessMode; import org.jboss.beans.info.spi.BeanInfo; import org.jboss.beans.info.spi.PropertyInfo; import org.jboss.joinpoint.plugins.Config; import org.jboss.logging.Logger; import org.jboss.reflect.plugins.introspection.ParameterizedClassInfo; import org.jboss.reflect.spi.ArrayInfo; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.EnumInfo; import org.jboss.reflect.spi.FieldInfo; import org.jboss.reflect.spi.MethodInfo; import org.jboss.reflect.spi.PackageInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.reflect.spi.TypeInfoFactory; import org.jboss.xb.annotations.JBossXmlAdaptedType; import org.jboss.xb.annotations.JBossXmlAdaptedTypes; import org.jboss.xb.annotations.JBossXmlAttribute; import org.jboss.xb.annotations.JBossXmlChild; import org.jboss.xb.annotations.JBossXmlChildWildcard; import org.jboss.xb.annotations.JBossXmlChildren; import org.jboss.xb.annotations.JBossXmlCollection; import org.jboss.xb.annotations.JBossXmlConstants; import org.jboss.xb.annotations.JBossXmlGroup; import org.jboss.xb.annotations.JBossXmlGroupText; import org.jboss.xb.annotations.JBossXmlGroupWildcard; import org.jboss.xb.annotations.JBossXmlMapEntry; import org.jboss.xb.annotations.JBossXmlMapKeyAttribute; import org.jboss.xb.annotations.JBossXmlMapKeyElement; import org.jboss.xb.annotations.JBossXmlMapValueAttribute; import org.jboss.xb.annotations.JBossXmlMapValueElement; import org.jboss.xb.annotations.JBossXmlModelGroup; import org.jboss.xb.annotations.JBossXmlNoElements; import org.jboss.xb.annotations.JBossXmlNsPrefix; import org.jboss.xb.annotations.JBossXmlPreserveWhitespace; import org.jboss.xb.annotations.JBossXmlAccessMode; import org.jboss.xb.annotations.JBossXmlSchema; import org.jboss.xb.annotations.JBossXmlTransient; import org.jboss.xb.annotations.JBossXmlTransients; import org.jboss.xb.annotations.JBossXmlType; import org.jboss.xb.annotations.JBossXmlValue; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.Util; import org.jboss.xb.binding.sunday.unmarshalling.CollectionRepeatableParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.AllBinding; import org.jboss.xb.binding.sunday.unmarshalling.AnyAttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.AttributeHandler; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding; import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementInterceptor; import org.jboss.xb.binding.sunday.unmarshalling.DefaultHandlers; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.RepeatableParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.SimpleTypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.UnorderedSequenceBinding; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.builder.runtime.AbstractPropertyHandler; import org.jboss.xb.builder.runtime.AnyAttributePropertyHandler; import org.jboss.xb.builder.runtime.AppendingArrayRepeatableHandler; import org.jboss.xb.builder.runtime.ArrayWrapperRepeatableParticleHandler; import org.jboss.xb.builder.runtime.BeanHandler; import org.jboss.xb.builder.runtime.BuilderParticleHandler; import org.jboss.xb.builder.runtime.BuilderSimpleParticleHandler; import org.jboss.xb.builder.runtime.ChildCollectionInterceptor; import org.jboss.xb.builder.runtime.ChildCollectionWildcardHandler; import org.jboss.xb.builder.runtime.ChildWildcardHandler; import org.jboss.xb.builder.runtime.CollectionPropertyHandler; import org.jboss.xb.builder.runtime.CollectionPropertyWildcardHandler; import org.jboss.xb.builder.runtime.DOMHandler; import org.jboss.xb.builder.runtime.DefaultMapEntry; import org.jboss.xb.builder.runtime.EnumValueAdapter; import org.jboss.xb.builder.runtime.GroupBeanHandler; import org.jboss.xb.builder.runtime.MapPropertyHandler; import org.jboss.xb.builder.runtime.NonXmlAnyElementDOMElementPropertyHandler; import org.jboss.xb.builder.runtime.PropertyHandler; import org.jboss.xb.builder.runtime.PropertyInterceptor; import org.jboss.xb.builder.runtime.PropertyWildcardHandler; import org.jboss.xb.builder.runtime.SetParentOverrideHandler; import org.jboss.xb.builder.runtime.ValueHandler; import org.jboss.xb.builder.runtime.WrapperBeanAdapterFactory; import org.jboss.xb.spi.BeanAdapterBuilder; import org.jboss.xb.spi.BeanAdapterFactory; import org.jboss.xb.spi.DefaultBeanAdapterBuilder; import org.w3c.dom.Element; /** * JBossXBNoSchemaBuilder. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public class JBossXBNoSchemaBuilder { /** The log */ private static final Logger log = Logger.getLogger(JBossXBBuilder.class); /** Whether trace is enabled */ private boolean trace = log.isTraceEnabled(); /** The schema binding */ private SchemaBinding schemaBinding; /** The root type */ private ClassInfo root; /** The namespace */ private String defaultNamespace; /** The attribute form */ private XmlNsForm attributeForm = XmlNsForm.UNSET; /** The element form */ private XmlNsForm elementForm = XmlNsForm.UNSET; /** A cache of types */ private Map typeCache = new HashMap(); /** A root elements we have processed */ private Map rootCache = new HashMap(); /** The current location */ private Stack locations = new Stack(); private ModelGroupFactory groupFactory = DefaultModelGroupFactory.INSTANCE; private boolean useUnorderedSequence; private boolean sequencesRequirePropOrder; private boolean elementSetParentHandler; private boolean repeatableParticleHandlers; // this is repeatableParticleHandlers in a specific context while the one above is global default private boolean currentRepeatableHandlers; private BeanAccessMode beanAccessMode = BeanAccessMode.STANDARD; /** transient property names by type name */ private Map> jbossXmlTransients = Collections.emptyMap(); /** * Create a new JBossXBNoSchemaBuilder. * * @param root the root class info * @throws IllegalArgumentException for a null root class info */ public JBossXBNoSchemaBuilder(ClassInfo root) { if (root == null) throw new IllegalArgumentException("Null root"); this.root = root; } public boolean isUseUnorderedSequence() { return useUnorderedSequence; } public void setUseUnorderedSequence(boolean useUnorderedSequence) { this.useUnorderedSequence = useUnorderedSequence; if(useUnorderedSequence) groupFactory = UnorderedSequenceModelGroupFactory.INSTANCE; else groupFactory = DefaultModelGroupFactory.INSTANCE; } public boolean isSequenceRequirePropOrder() { return sequencesRequirePropOrder; } public void setSequencesRequirePropOrder(boolean sequencesRequirePropOrder) { this.sequencesRequirePropOrder = sequencesRequirePropOrder; } public boolean isElementSetParentOverrideHandler() { return elementSetParentHandler; } public void setElementSetParentOverrideHandler(boolean elementSetParentHandler) { this.elementSetParentHandler = elementSetParentHandler; } public boolean isRepeatableParticleHandlers() { return repeatableParticleHandlers; } public void setRepeatableParticleHandlers(boolean repeatableParticleHandlers) { this.repeatableParticleHandlers = repeatableParticleHandlers; } /** * Build the schema * * @return the schema */ public SchemaBinding build() { // Initialize the schema schemaBinding = new SchemaBinding(); JBossXBBuilder.initSchema(schemaBinding, root); initBuilder(); createRootElements(); return schemaBinding; } /** * Builds schema binding components from the class and adds them to the SchemaBinding * passed in the argument. * Note, schema initialization step (processing of schema-related class- and package-level annotations) will be skipped. * * @param schema SchemaBinding to add the built binding components to */ public void build(SchemaBinding schema) { if(schema == null) throw new IllegalArgumentException("Null schema"); schemaBinding = schema; initBuilder(); createRootElements(); } /** * Initialise the builder */ protected void initBuilder() { if (trace) log.trace("Building schema for " + root.getName() + " schemaBinding=" + schemaBinding); // Remember the default namespace if (defaultNamespace == null) { defaultNamespace = (String) schemaBinding.getNamespaces().iterator().next(); } JBossXmlSchema jbossXmlSchema = root.getUnderlyingAnnotation(JBossXmlSchema.class); if (jbossXmlSchema != null) { attributeForm = jbossXmlSchema.attributeFormDefault(); elementForm = jbossXmlSchema.elementFormDefault(); } // Look for an annotation PackageInfo packageInfo = root.getPackage(); if (packageInfo != null) { jbossXmlSchema = root.getUnderlyingAnnotation(JBossXmlSchema.class); if (jbossXmlSchema != null) { if (attributeForm == XmlNsForm.UNSET) attributeForm = jbossXmlSchema.attributeFormDefault(); if (elementForm == XmlNsForm.UNSET) elementForm = jbossXmlSchema.elementFormDefault(); } XmlSchema xmlSchema = packageInfo.getUnderlyingAnnotation(XmlSchema.class); if (xmlSchema != null) { String namespace = xmlSchema.namespace(); if (JBossXmlConstants.DEFAULT.equals(xmlSchema) == false && XMLConstants.NULL_NS_URI.equals(defaultNamespace)) { defaultNamespace = namespace; addNamespace(defaultNamespace, true); } if (attributeForm == XmlNsForm.UNSET) attributeForm = xmlSchema.attributeFormDefault(); if (elementForm == XmlNsForm.UNSET) elementForm = xmlSchema.elementFormDefault(); } // Check for adapted types JBossXmlAdaptedTypes adaptedTypes = packageInfo.getUnderlyingAnnotation(JBossXmlAdaptedTypes.class); if (adaptedTypes != null) { for (JBossXmlAdaptedType adaptedType : adaptedTypes.value()) generateAdaptedType(adaptedType); } JBossXmlAdaptedType adaptedType = packageInfo.getUnderlyingAnnotation(JBossXmlAdaptedType.class); if (adaptedType != null) generateAdaptedType(adaptedType); JBossXmlTransient[] xmlTransients = null; JBossXmlTransients transientsAnnotation = packageInfo.getUnderlyingAnnotation(JBossXmlTransients.class); if(transientsAnnotation == null) { JBossXmlTransient transientAnnotation = packageInfo.getUnderlyingAnnotation(JBossXmlTransient.class); if(transientAnnotation != null) xmlTransients = new JBossXmlTransient[]{transientAnnotation}; } else xmlTransients = transientsAnnotation.value(); if(xmlTransients != null) { jbossXmlTransients = new HashMap>(); for(JBossXmlTransient xmlTransient : xmlTransients) { Set properties; if(xmlTransient.properties().length == 0) properties = Collections.emptySet(); else properties= new HashSet(Arrays.asList(xmlTransient.properties())); jbossXmlTransients.put(xmlTransient.type().getName(), properties); if(trace) log.trace("JBossXmlTransient type=" + xmlTransient.type().getName() + ", properties=" + properties); } } } if(jbossXmlSchema != null) beanAccessMode = jbossXmlAccessModeToBeanAccessMode(jbossXmlSchema.accessMode()); } private static BeanAccessMode jbossXmlAccessModeToBeanAccessMode(JBossXmlAccessMode accessMode) { if (accessMode == JBossXmlAccessMode.ALL) return BeanAccessMode.ALL; else if (accessMode == JBossXmlAccessMode.PROPERTY) return BeanAccessMode.STANDARD; else if (accessMode == JBossXmlAccessMode.PUBLIC_MEMBER) return BeanAccessMode.FIELDS; throw new IllegalArgumentException("Unsupported JBossXmlAccessMode: " + accessMode); } /** * Create the root elements */ protected void createRootElements() { // Create the root element createRootElementBinding(root); } /** * Create a root element binding * * @param typeInfo the type info */ protected void createRootElementBinding(TypeInfo typeInfo) { // Already done/doing this if (rootCache.containsKey(typeInfo)) return; // Put a skeleton marker in the cache so we know not to redo it rootCache.put(typeInfo, null); // We force the element to be a root element push(typeInfo); try { createElementBinding(typeInfo, typeInfo.getSimpleName(), true); pop(); } catch (Exception e) { throw rethrowWithLocation(e); } } /** * Create an element binding * * @param typeInfo the type info * @param name the java element name * @param root pass true to force a root element * @return the element binding */ private ElementBinding createElementBinding(TypeInfo typeInfo, String name, boolean root) { // Resolve the type TypeBinding typeBinding = resolveTypeBinding(typeInfo); // Create the element return createElementBinding(typeInfo, typeBinding, name, root); } /** * Create an element binding * * @param typeInfo the type info * @param typeBinding the type binding * @param name the java element name * @param root pass true to force a root element * @return the element binding */ private ElementBinding createElementBinding(TypeInfo typeInfo, TypeBinding typeBinding, String name, boolean root) { // Determine the parameters String overrideNamespace = null; String overrideName = null; if (typeInfo instanceof ClassInfo) { ClassInfo classInfo = (ClassInfo) typeInfo; XmlRootElement xmlRootElement = classInfo.getUnderlyingAnnotation(XmlRootElement.class); if (xmlRootElement != null) { overrideNamespace = xmlRootElement.namespace(); overrideName = xmlRootElement.name(); } } // Create the binding XmlNsForm form = elementForm; if (root) form = XmlNsForm.QUALIFIED; QName qName = generateXmlName(name, form, overrideNamespace, overrideName); return createElementBinding(typeInfo, typeBinding, qName, root); } /** * Create an element binding * * @param typeInfo the type info * @param typeBinding the type binding * @param qName the qualified name * @param root pass true to force a root element * @return the element binding */ private ElementBinding createElementBinding(TypeInfo typeInfo, TypeBinding typeBinding, QName qName, boolean root) { if (trace) log.trace("creating element " + qName + " with type " + typeInfo.getName()); if (typeInfo instanceof ClassInfo) { ClassInfo classInfo = (ClassInfo) typeInfo; XmlRootElement xmlRootElement = classInfo.getUnderlyingAnnotation(XmlRootElement.class); if (xmlRootElement != null) root = true; } ElementBinding elementBinding = new ElementBinding(schemaBinding, qName, typeBinding); if (trace) log.trace("created element " + qName + " element=" + elementBinding + " rootElement=" + root); // If we are a root element bind it if (root) { schemaBinding.addElement(elementBinding); ParticleBinding particleBinding = schemaBinding.getElementParticle(qName); particleBinding.setMinOccurs(1); particleBinding.setMaxOccurs(1); rootCache.put(typeInfo, elementBinding); } return elementBinding; } /** * Process a type * * @param typeInfo the type info */ protected void process(TypeInfo typeInfo) { if (typeInfo.isPrimitive() == false && typeInfo.isEnum() && typeInfo.isAnnotation() && Object.class.getName().equals(typeInfo.getName()) == false) { ClassInfo classInfo = (ClassInfo) typeInfo; // Create the type resolveTypeBinding(typeInfo); // Check wether we need to add it as a root element if (rootCache.containsKey(typeInfo) == false) { XmlRootElement xmlRootElement = classInfo.getUnderlyingAnnotation(XmlRootElement.class); if (xmlRootElement != null) createRootElementBinding(typeInfo); } } } /** * Resolve a type binding * * @param typeInfo the type info * @return the type binding */ protected TypeBinding resolveTypeBinding(TypeInfo typeInfo) { if (trace) log.trace("resolving type " + typeInfo.getName()); // Look for a cached value TypeBinding result = typeCache.get(typeInfo); // No cached value if (result == null) { // Generate it result = generateTypeBinding(typeInfo); // Cache it typeCache.put(typeInfo, result); } if (trace) log.trace("resolved type " + typeInfo.getName() + " binding=" + result); // Return the result return result; } /** * Generate a type binding * * @param typeInfo the type info * @return the type binding */ protected TypeBinding generateTypeBinding(TypeInfo typeInfo) { try { if (typeInfo.isEnum()) return generateEnum((EnumInfo) typeInfo); if (typeInfo.isAnnotation()) return generateAnnotation((ClassInfo) typeInfo); if (typeInfo.isArray()) return generateArray((ArrayInfo) typeInfo); if (typeInfo.isCollection()) return generateCollection((ClassInfo) typeInfo); if (typeInfo.isMap()) return generateMap((ClassInfo) typeInfo); TypeBinding typeBinding = isSimpleType(typeInfo); if (typeBinding != null) return typeBinding; return generateBean((ClassInfo) typeInfo); } finally { // Not a primitive type if (typeInfo.isPrimitive() == false) { ClassInfo classInfo = (ClassInfo) typeInfo; // Process our type args TypeInfo[] typeArgs = classInfo.getActualTypeArguments(); if (typeArgs != null) { for (int i = 0; i < typeArgs.length; ++i) process(typeArgs[i]); } // Process the super class ClassInfo superClass = classInfo.getGenericSuperclass(); if (superClass != null) process(superClass); } } } /** * Generate an enum type binding * * @param typeInfo the type info * @return the type binding */ public TypeBinding generateEnum(EnumInfo typeInfo) { // Determine the parameters String overrideNamespace = null; String overrideName = null; boolean root = false; XmlType xmlType = typeInfo.getUnderlyingAnnotation(XmlType.class); if (xmlType != null) { root = true; overrideNamespace = xmlType.namespace(); overrideName = xmlType.name(); } // Determine the enum type Class xmlEnumValue = String.class; XmlEnum xmlEnum = typeInfo.getUnderlyingAnnotation(XmlEnum.class); if (xmlEnum != null) xmlEnumValue = xmlEnum.value(); TypeInfo enumType = typeInfo.getTypeInfoFactory().getTypeInfo(xmlEnumValue); // Resolve the enum type as the parent (must be simple) TypeBinding parent = getSimpleType(enumType); // Create the enum type QName qName = null; TypeBinding typeBinding = null; if (root) { qName = generateXmlName(typeInfo, XmlNsForm.QUALIFIED, overrideNamespace, overrideName); typeBinding = new TypeBinding(qName, parent); } else { typeBinding = new TypeBinding(null, parent); } typeBinding.setValueAdapter(new EnumValueAdapter(qName, typeInfo, enumType)); if (trace) log.trace("Created enum=" + typeInfo.getName() + " type=" + typeBinding + " rootType=" + root); // Bind it as a global type if (root) schemaBinding.addType(typeBinding); else typeBinding.setSchemaBinding(schemaBinding); return typeBinding; } /** * Generate an adapted type * * @param adaptedType the information about the adaption * @return the type binding */ public TypeBinding generateAdaptedType(JBossXmlAdaptedType adaptedType) { if(adaptedType.type() == JBossXmlConstants.DEFAULT.class) throw new JBossXBRuntimeException("@JBossXmlAdaptedType used in package-info.java must specify type element."); // Determine the parameters String overrideNamespace = adaptedType.namespace(); String overrideName = adaptedType.name(); Class type = adaptedType.type(); try { TypeInfo typeInfo = JBossXBBuilder.configuration.getTypeInfo(type); QName qName = generateXmlName(typeInfo, XmlNsForm.QUALIFIED, overrideNamespace, overrideName); TypeInfo parentType = typeInfo.getTypeInfoFactory().getTypeInfo(String.class); TypeBinding parent = getSimpleType(parentType); TypeBinding typeBinding = new TypeBinding(qName, parent); adaptType(typeBinding, adaptedType); typeCache.put(typeInfo, typeBinding); schemaBinding.addType(typeBinding); return typeBinding; } catch (Throwable t) { throw new RuntimeException("Unable to adapt type " + type.getName() + " with " + adaptedType.valueAdapter().getName(), t); } } /** * Generate an adapted type * * @param adaptedType the information about the adaption * @return the type binding */ public void adaptType(TypeBinding adaptedType, JBossXmlAdaptedType annotation) { // Determine the parameters Class type = annotation.type(); Class adapter = annotation.valueAdapter(); try { BeanInfo adapterInfo = JBossXBBuilder.configuration.getBeanInfo(adapter, beanAccessMode); ValueAdapter valueAdapter = (ValueAdapter) adapterInfo.newInstance(); adaptedType.setValueAdapter(valueAdapter); if (trace) log.trace("adapted typeBinding=" + adaptedType + " adapter=" + adapter.getName()); } catch (Throwable t) { throw new RuntimeException("Unable to adapt type " + type.getName() + " with " + adapter.getName(), t); } } /** * Generate an annotation type binding * * @param typeInfo the type info * @return the type binding */ public TypeBinding generateAnnotation(ClassInfo typeInfo) { // TODO generateAnnotation throw new UnsupportedOperationException("generateAnnotation"); } /** * Generate an array type binding * * @param typeInfo the type info * @return the type binding */ public TypeBinding generateArray(ArrayInfo typeInfo) { return resolveTypeBinding(typeInfo.getComponentType()); } /** * Generate a collection type binding * * @param typeInfo the type info * @return the type binding */ public TypeBinding generateCollection(ClassInfo typeInfo) { TypeInfo[] actualTypes = typeInfo.getActualTypeArguments(); if (actualTypes == null || actualTypes.length == 0) return generateBean(typeInfo); TypeInfo elementType = actualTypes[0]; return resolveTypeBinding(elementType); } /** * Generate a map type binding * * @param typeInfo the type info * @return the type binding */ public TypeBinding generateMap(ClassInfo typeInfo) { // the map is bound in bindProperty method currently return generateBean(typeInfo); } /** * Check whether this is a simple type * * @param typeInfo the type info * @return the type binding if it is simple */ public TypeBinding isSimpleType(TypeInfo typeInfo) { QName qName = SimpleTypeBindings.typeQName(typeInfo.getType()); if (qName == null) return null; TypeBinding result = schemaBinding.getType(qName); if (result == null) throw new IllegalStateException("SimpleType is not bound in the schema: " + qName + " for " + typeInfo.getName()); result.setHandler(BuilderSimpleParticleHandler.SIMPLE_INSTANCE); return result; } /** * Get the simple type * * @param typeInfo the type info * @return the type binding if it is simple * @throws IllegalStateException if the type is not bound */ public TypeBinding getSimpleType(TypeInfo typeInfo) { TypeBinding result = isSimpleType(typeInfo); if (result == null) throw new IllegalStateException(typeInfo.getName() + " does not map to a simple type."); return result; } /** * Generate a bean type binding * * @param typeInfo the type info * @return the type binding */ public TypeBinding generateBean(ClassInfo typeInfo) { return generateBean(typeInfo, false); } /** * Generate a bean type binding * * @param typeInfo the type info * @param root whether to force a root type * @return the type binding */ public TypeBinding generateBean(ClassInfo typeInfo, boolean root) { return generateType(typeInfo, root); } /** * Generate a bean type binding * * @param typeInfo the type info * @param root whether to force a root type * @return the type binding */ public TypeBinding generateType(ClassInfo typeInfo, boolean root) { // Determine the parameters String overrideNamespace = null; String overrideName = null; ClassInfo factoryClassInfo = typeInfo; String factoryMethod = null; String[] propertyOrder = {""}; XmlAccessOrder accessOrder = XmlAccessOrder.UNDEFINED; Class beanAdapterBuilderClass = DefaultBeanAdapterBuilder.class; XmlType xmlType = typeInfo.getUnderlyingAnnotation(XmlType.class); if (xmlType != null) { root = true; overrideNamespace = xmlType.namespace(); overrideName = xmlType.name(); if (overrideName.length() == 0) root = false; Class factoryClass = xmlType.factoryClass(); if (factoryClass != XmlType.DEFAULT.class) factoryClassInfo = (ClassInfo) typeInfo.getTypeInfoFactory().getTypeInfo(factoryClass); factoryMethod = xmlType.factoryMethod(); propertyOrder = xmlType.propOrder(); } BeanAccessMode beanAccessMode = this.beanAccessMode; JBossXmlType jbossXmlType = typeInfo.getUnderlyingAnnotation(JBossXmlType.class); if (jbossXmlType != null) { beanAdapterBuilderClass = jbossXmlType.beanAdapterBuilder(); JBossXmlAccessMode accessMode = jbossXmlType.accessMode(); if(accessMode != JBossXmlAccessMode.NOT_SPECIFIED) beanAccessMode = jbossXmlAccessModeToBeanAccessMode(accessMode); } // Determine the property access order XmlAccessorOrder accessorOrder = typeInfo.getUnderlyingAnnotation(XmlAccessorOrder.class); if (accessorOrder == null) { PackageInfo pkg = typeInfo.getPackage(); if (pkg != null) accessorOrder = pkg.getUnderlyingAnnotation(XmlAccessorOrder.class); } if (accessorOrder != null) accessOrder = accessorOrder.value(); // Create the binding TypeBinding typeBinding = null; if (root) { QName qName = generateXmlName(typeInfo, XmlNsForm.QUALIFIED, overrideNamespace, overrideName); typeBinding = new TypeBinding(qName, CharactersHandler.NOOP); schemaBinding.addType(typeBinding); } else { typeBinding = new TypeBinding(); } typeBinding.setSchemaBinding(schemaBinding); // Push into the cache early to avoid recursion typeCache.put(typeInfo, typeBinding); JBossXmlAdaptedType adaptedType = typeInfo.getUnderlyingAnnotation(JBossXmlAdaptedType.class); if(adaptedType != null) { if(adaptedType.type() != JBossXmlConstants.DEFAULT.class) throw new JBossXBRuntimeException("@JBossXmlAdaptedType on a type must not specify type element: " + typeInfo.getName()); adaptType(typeBinding, adaptedType); } // Determine any factory method MethodInfo factory = null; if (factoryMethod != null && factoryMethod.length() > 0) factory = Config.findMethodInfo(factoryClassInfo, factoryMethod, null, true, true); // Create the handler BeanInfo beanInfo = JBossXBBuilder.configuration.getBeanInfo(typeInfo, beanAccessMode); BeanAdapterFactory beanAdapterFactory = createAdapterFactory(beanAdapterBuilderClass, beanInfo, factory); BeanHandler handler = new BeanHandler(beanInfo.getName(), beanAdapterFactory, typeBinding); typeBinding.setHandler(handler); if (trace) log.trace("Created BeanHandler for type=" + beanInfo.getName() + " factory=" + factory); // Look through the properties JBossXmlNoElements jbossXmlNoElements = typeInfo.getUnderlyingAnnotation(JBossXmlNoElements.class); boolean noElements = jbossXmlNoElements != null; PropertyInfo valueProperty = null; PropertyInfo wildcardProperty = null; boolean allBinding = propertyOrder.length == 0; boolean determinePropertyOrder = allBinding || (propertyOrder.length == 1 && propertyOrder[0].length() == 0); ArrayList propertyNames = new ArrayList(); Set properties = beanInfo.getProperties(); if (properties != null && properties.isEmpty() == false) { boolean seenXmlAnyElement = false; PropertyInfo seenXmlAnyAttribute = null; for (PropertyInfo property : properties) { push(typeInfo, property.getName()); if (trace) log.trace("Checking property " + property.getName() + " for " + beanInfo.getName() + " type=" + property.getType().getName()); // Is this the value property? XmlValue xmlValue = property.getUnderlyingAnnotation(XmlValue.class); if (xmlValue != null) { if (trace) log.trace("Seen @XmlValue for type=" + beanInfo.getName() + " property=" + property.getName()); if (valueProperty != null) throw new RuntimeException("@XmlValue seen on two properties: " + property.getName() + " and " + valueProperty.getName()); valueProperty = property; } // Is this the wildcard property? boolean ignoreXmlAnyElement = false; XmlAnyElement xmlAnyElement = property.getUnderlyingAnnotation(XmlAnyElement.class); if (xmlAnyElement != null) { if (trace) log.trace("Seen @XmlAnyElement for type=" + beanInfo.getName() + " property=" + property.getName()); if (wildcardProperty != null && seenXmlAnyElement) throw new RuntimeException("@XmlAnyElement seen on two properties: " + property.getName() + " and " + wildcardProperty.getName()); wildcardProperty = property; seenXmlAnyElement = true; // should we ignore it if(property.getUnderlyingAnnotation(XmlElements.class) == null && property.getUnderlyingAnnotation(XmlElementRefs.class) == null) ignoreXmlAnyElement = true; } // Is this an attribute XmlAttribute xmlAttribute = property.getUnderlyingAnnotation(XmlAttribute.class); if (xmlAttribute != null) { JBossXmlAttribute jbossXmlAttribute = property.getUnderlyingAnnotation(JBossXmlAttribute.class); // Determine the name QName qName = generateXmlName(property.getName(), attributeForm, xmlAttribute.namespace(), xmlAttribute.name()); // Resolve the type TypeInfo attributeTypeInfo = property.getType(); if (jbossXmlAttribute != null && jbossXmlAttribute.type() != Object.class) attributeTypeInfo = attributeTypeInfo.getTypeInfoFactory().getTypeInfo(jbossXmlAttribute.type()); XBValueAdapter valueAdapter = null; XmlJavaTypeAdapter xmlTypeAdapter = property.getUnderlyingAnnotation(XmlJavaTypeAdapter.class); if (xmlTypeAdapter != null) { valueAdapter = new XBValueAdapter(xmlTypeAdapter.value(), attributeTypeInfo.getTypeInfoFactory()); attributeTypeInfo = valueAdapter.getAdaptedTypeInfo(); } TypeBinding attributeType = resolveTypeBinding(attributeTypeInfo); // Create the attribute handler AttributeHandler attributeHandler = null; if(attributeTypeInfo.isCollection() || attributeTypeInfo.isArray()) { TypeBinding itemType = attributeType; attributeType = new SimpleTypeBinding(null); attributeType.setSchemaBinding(schemaBinding); attributeType.setItemType(itemType); } attributeHandler = new PropertyHandler(property, attributeTypeInfo); // Create the attribute and bind it to the type AttributeBinding attribute = new AttributeBinding(schemaBinding, qName, attributeType, attributeHandler); if(valueAdapter != null) attribute.setValueAdapter(valueAdapter); attribute.setRequired(xmlAttribute.required()); typeBinding.addAttribute(attribute); JBossXmlPreserveWhitespace preserveSpace = property.getUnderlyingAnnotation(JBossXmlPreserveWhitespace.class); if(preserveSpace != null) attribute.setNormalizeSpace(preserveSpace.preserve() ? false : true); if (trace) log.trace("Bound attribute " + qName + " type=" + beanInfo.getName() + " property=" + property.getName() + " propertyType=" + attributeTypeInfo + ", normalizeSpace=" + attribute.isNormalizeSpace() + ", typeBinding=" + typeBinding.getQName()); handler.getAttributesHandler().addAttribute(attribute); } // Is this any attribute XmlAnyAttribute xmlAnyAttribute = property.getUnderlyingAnnotation(XmlAnyAttribute.class); if (xmlAnyAttribute != null) { if (seenXmlAnyAttribute != null) throw new RuntimeException("@XmlAnyAttribute seen on two properties: " + property.getName() + " and " + seenXmlAnyAttribute.getName()); seenXmlAnyAttribute = property; AnyAttributePropertyHandler anyHandler = new AnyAttributePropertyHandler(property, property.getType()); AnyAttributeBinding anyAttribute = new AnyAttributeBinding(schemaBinding, anyHandler); typeBinding.setAnyAttribute(anyAttribute); JBossXmlPreserveWhitespace preserveSpace = property.getUnderlyingAnnotation(JBossXmlPreserveWhitespace.class); if(preserveSpace != null) anyAttribute.setNormalizeSpace(preserveSpace.preserve() ? false : true); if (trace) log.trace("Bound any attribute type=" + beanInfo.getName() + " property=" + property.getName() + ", normalizeSpace=" + anyAttribute.isNormalizeSpace()); handler.getAttributesHandler().setAnyAttribute(anyAttribute); } // Are we determining the property order? if (determinePropertyOrder) { // Value property if (xmlValue != null) { if (trace) log.trace("Ignore not element @XmlValue for type=" + beanInfo.getName() + " property=" + property.getName()); pop(); continue; } // Wildcard property if (ignoreXmlAnyElement) { if (trace) log.trace("Ignore not element @XmlAnyElement for type=" + beanInfo.getName() + " property=" + property.getName()); pop(); continue; } // Ignore xml attribute if (xmlAttribute != null) { if (trace) log.trace("Ignore not element @XmlAttribute for type=" + beanInfo.getName() + " property=" + property.getName()); pop(); continue; } // Ignore xml tranient XmlTransient xmlTransient = property.getUnderlyingAnnotation(XmlTransient.class); if (xmlTransient != null) { if (trace) log.trace("Ignore not element @XmlTransient for type=" + beanInfo.getName() + " property=" + property.getName()); pop(); continue; } // Ignore the class property String name = property.getName(); if ("class".equals(name)) { pop(); continue; } if (noElements) { pop(); continue; } ClassInfo declaringClass; MethodInfo methodInfo = property.getGetter(); if(methodInfo == null) { FieldInfo fieldInfo = property.getFieldInfo(); if(fieldInfo == null) { methodInfo = property.getSetter(); if(methodInfo == null) throw new JBossXBRuntimeException("Couldn't get access to getter, setter or field info for type=" + beanInfo.getName() + " property=" + property.getName()); else declaringClass = methodInfo.getDeclaringClass(); } else declaringClass = fieldInfo.getDeclaringClass(); } else declaringClass = methodInfo.getDeclaringClass(); Set transientProps = jbossXmlTransients.get(declaringClass.getName()); if(transientProps != null && (transientProps.isEmpty() || transientProps.contains(property.getName()))) { if(trace) log.trace("Ignore JBossXmlTransient property for type=" + beanInfo.getName() + " property=" + property.getName()); pop(); continue; } if (trace) log.trace("Element for type=" + beanInfo.getName() + " property=" + property.getName()); propertyNames.add(property.getName()); } pop(); } // Apply any access order if (determinePropertyOrder) { if (accessOrder == XmlAccessOrder.ALPHABETICAL) Collections.sort(propertyNames); propertyOrder = propertyNames.toArray(new String[propertyNames.size()]); } } // Bind the value if (valueProperty != null) { CharactersHandler charactersHandler = new ValueHandler(valueProperty); typeBinding.setSimpleType(charactersHandler); JBossXmlValue jbossXmlValue = typeInfo.getUnderlyingAnnotation(JBossXmlValue.class); if(jbossXmlValue != null) { if(trace) log.trace("Type " + typeInfo.getName() + " is annotated with @JBossXmlValue.ignoreEmptyString=" + jbossXmlValue.ignoreEmptyString()); typeBinding.setIgnoreEmptyString(jbossXmlValue.ignoreEmptyString()); } } else if (trace) log.trace("No value for type=" + beanInfo.getName()); if (trace) log.trace("PropertyOrder " + Arrays.asList(propertyOrder) + " for type=" + beanInfo.getName()); // Determine the model // TODO simple types/content when no properties other than @XmlValue and @XmlAttribute typeBinding.setSimple(false); ModelGroupBinding model = null; boolean propOrderMissing = propertyNames.size() > 1 && determinePropertyOrder && accessOrder == XmlAccessOrder.UNDEFINED; if(jbossXmlType != null && !JBossXmlConstants.DEFAULT.equals(jbossXmlType.modelGroup())) model = createModelGroup(jbossXmlType.modelGroup(), typeInfo, propOrderMissing, propertyOrder, null); else if (allBinding) model = new AllBinding(schemaBinding); else { if(propOrderMissing) assertPropOrderNotRequired(typeInfo, propertyOrder); model = groupFactory.createSequence(schemaBinding); } boolean previousRepeatableHandlers = this.currentRepeatableHandlers; if(model instanceof UnorderedSequenceBinding) this.currentRepeatableHandlers = false; else this.currentRepeatableHandlers = this.repeatableParticleHandlers; if (trace) log.trace(model.getGroupType() + " model group for type=" + beanInfo.getName()); model.setHandler(BuilderParticleHandler.setParentDelegate(typeBinding.getHandler())); ParticleBinding typeParticle = new ParticleBinding(model); typeParticle.setMinOccurs(1); typeParticle.setMaxOccurs(1); typeBinding.setParticle(typeParticle); if (typeInfo.isCollection()) { typeParticle.setMinOccurs(0); typeParticle.setMaxOccursUnbounded(true); } // Look through the properties for (String name : propertyOrder) { // propertyOrder is initialized to {""} if(name.length() == 0) continue; // Setup the error stack push(typeInfo, name); // Get the property PropertyInfo property = beanInfo.getProperty(name); bindProperty(property, model, beanAdapterFactory, propertyOrder, property == wildcardProperty); pop(); } // Bind the children JBossXmlChild[] children = null; JBossXmlChildren jbossXmlChildren = typeInfo.getUnderlyingAnnotation(JBossXmlChildren.class); if (jbossXmlChildren != null) children = jbossXmlChildren.value(); else { JBossXmlChild jbossXmlChild = typeInfo.getUnderlyingAnnotation(JBossXmlChild.class); if (jbossXmlChild != null) children = new JBossXmlChild[] { jbossXmlChild }; } if (children != null && children.length > 0) { for (JBossXmlChild child : children) { QName qName = generateXmlName(child.name(), elementForm, child.namespace(), child.name()); TypeInfo childType = JBossXBBuilder.configuration.getTypeInfo(child.type()); TypeBinding elementTypeBinding = resolveTypeBinding(childType); ElementBinding elementBinding = createElementBinding(childType, elementTypeBinding, qName, false); // Bind it to the model ParticleBinding particle = new ParticleBinding(elementBinding, child.minOccurs(), child.maxOccurs(), child.unbounded()); model.addParticle(particle); if(childType.isMap()) bindMapProperty(null, (ClassInfo) childType, elementTypeBinding.getQName(), (ModelGroupBinding) elementTypeBinding.getParticle().getTerm()); DefaultElementInterceptor interceptor = null; if (typeInfo.isCollection()) interceptor = ChildCollectionInterceptor.SINGLETON; else { // Expect a type with a value property to accept the child value PropertyInfo property = beanInfo.getProperty("value"); if (property == null) throw new UnsupportedOperationException("Expected a value property for non-collection type with JBossXmlChildren"); TypeInfo propertyType = property.getType(); interceptor = new PropertyInterceptor(property, propertyType); } typeBinding.pushInterceptor(qName, interceptor); if (trace) log.trace("Added interceptor " + qName + " for type=" + childType + " interceptor=" + interceptor); } } // Bind the wildcard if (wildcardProperty != null) { AbstractPropertyHandler wildcardHandler; WildcardBinding wildcard = Util.getWildcard(model); if(wildcard == null) { if (trace) log.trace("Processing WildcardProperty for type=" + beanInfo.getName() + " property=" + wildcardProperty.getName()); ModelGroupBinding localModel = model; TypeInfo wildcardType = wildcardProperty.getType(); TypeInfo type = wildcardType; wildcard = new WildcardBinding(schemaBinding); ParticleBinding particleBinding = new ParticleBinding(wildcard); localModel.addParticle(particleBinding); particleBinding.setMinOccurs(0); // Setup any new model and determine the wildcard type if (wildcardType.isArray()) { particleBinding.setMaxOccursUnbounded(true); wildcardHandler = new PropertyWildcardHandler(wildcardProperty, wildcardType); if(currentRepeatableHandlers) wildcard.setRepeatableHandler(new ArrayWrapperRepeatableParticleHandler(wildcardHandler)); else wildcard.setRepeatableHandler(new AppendingArrayRepeatableHandler(wildcardHandler)); type = ((ArrayInfo) wildcardType).getComponentType(); if (trace) log.trace("Wildcard " + wildcardProperty.getName() + " is an array of type " + type.getName()); } else if (wildcardType.isCollection()) { particleBinding.setMaxOccursUnbounded(true); if(currentRepeatableHandlers) { wildcardHandler = new PropertyWildcardHandler(wildcardProperty, wildcardType); wildcard.setRepeatableHandler(new CollectionRepeatableParticleHandler(wildcardHandler, (ClassInfo) wildcardType, null)); } else wildcardHandler = new CollectionPropertyWildcardHandler(wildcardProperty, wildcardType); type = ((ClassInfo)wildcardProperty.getType()).getComponentType(); if (trace) log.trace("Wildcard " + wildcardProperty.getName() + " is a collection of type " + type.getName()); } else { particleBinding.setMaxOccurs(1); wildcardHandler = new PropertyWildcardHandler(wildcardProperty, wildcardType); } wildcard.setHandler((ParticleHandler) wildcardHandler); XmlAnyElement xmlAnyElement = wildcardProperty.getUnderlyingAnnotation(XmlAnyElement.class); boolean isLax = xmlAnyElement == null ? true : xmlAnyElement.lax(); if (isLax) wildcard.setProcessContents((short) 3); // Lax else wildcard.setProcessContents((short) 1); // Strict // Dom element? if (Element.class.getName().equals(type.getName())) { wildcard.setUnresolvedElementHandler(DOMHandler.INSTANCE); wildcard.setUnresolvedCharactersHandler(DOMHandler.INSTANCE); } } else wildcardHandler = (AbstractPropertyHandler) wildcard.getHandler(); beanAdapterFactory.setWildcardHandler(wildcardHandler); } JBossXmlChildWildcard childWildcard = typeInfo.getUnderlyingAnnotation(JBossXmlChildWildcard.class); if (childWildcard != null) { if (beanAdapterFactory.getWildcardHandler() != null) throw new RuntimeException("Cannot have both @JBossXmlChildWildcard and @XmlAnyElement"); ParticleHandler childWildcardHandler = null; if (typeInfo.isCollection()) { if (childWildcard.wrapper() != Object.class) { BeanInfo wrapperInfo = JBossXBBuilder.configuration.getBeanInfo(childWildcard.wrapper(), beanAccessMode); childWildcardHandler = new ChildCollectionWildcardHandler(wrapperInfo, childWildcard.property()); } else childWildcardHandler = ChildCollectionWildcardHandler.SINGLETON; } else throw new UnsupportedOperationException("TODO"); WildcardBinding wildcard = new WildcardBinding(schemaBinding); if (childWildcard.lax()) wildcard.setProcessContents((short) 3); // Lax else wildcard.setProcessContents((short) 1); // Strict ParticleBinding particleBinding = new ParticleBinding(wildcard); particleBinding.setMinOccurs(0); particleBinding.setMaxOccurs(1); model.addParticle(particleBinding); typeBinding.getWildcard().setHandler(childWildcardHandler); } if (trace) log.trace("Created type=" + typeInfo.getName() + " typeBinding=" + typeBinding + " rootType=" + root); this.currentRepeatableHandlers = previousRepeatableHandlers; return typeBinding; } private void assertPropOrderNotRequired(TypeInfo typeInfo, String[] propertyOrder) { StringBuffer msg = new StringBuffer(); msg.append("Property order is not specified for type ") .append(typeInfo.getName()) .append(" bound to a sequence. Property order can be specified using @XmlType.propOrder or @XmlAccessorOrder."); if(propertyOrder != null && propertyOrder.length > 1) { msg.append(" List of properties:"); for(String name : propertyOrder) msg.append(" ").append(name); } if(sequencesRequirePropOrder && !useUnorderedSequence) throw new JBossXBRuntimeException(msg.toString()); //else log.warn(msg.toString()); this resulted in a lot of WARN logging in the AS } private void bindProperty(PropertyInfo property, ModelGroupBinding parentModel, BeanAdapterFactory beanAdapterFactory, String[] propertyOrder, boolean wildcardProperty) { TypeInfo propertyType = property.getType(); if (trace) log.trace("Processing type=" + property.getBeanInfo().getName() + " property=" + property.getName()); // This is illegal XmlTransient xmlTransient = property.getUnderlyingAnnotation(XmlTransient.class); if (xmlTransient != null && propertyOrder != null) throw new RuntimeException("Property " + property.getName() + " in property order " + Arrays.asList(propertyOrder) + " is marked @XmlTransient"); // The current model ModelGroupBinding localModel = parentModel; TypeInfo propertyComponentType = propertyType; XmlType propertyXmlType = null; JBossXmlModelGroup propertyXmlModelGroup = null; // Setup any new model if (propertyType.isCollection() || propertyType.isArray()) { if (trace) log.trace("Property " + property.getName() + " is a collection"); JBossXmlCollection xmlCol = property.getUnderlyingAnnotation(JBossXmlCollection.class); if (xmlCol != null) { // this is the type that should be analyzed propertyType = propertyType.getTypeInfoFactory().getTypeInfo(xmlCol.type()); } ClassInfo propertyClassInfo = (ClassInfo)propertyType; propertyXmlType = propertyClassInfo.getUnderlyingAnnotation(XmlType.class); propertyComponentType = propertyClassInfo.getComponentType(); } // Is this property bound to a model group if (!propertyComponentType.isPrimitive()) { ClassInfo componentClass = (ClassInfo) propertyComponentType; // TODO XmlElement on this property?.. //XmlElement propXmlElement = property.getUnderlyingAnnotation(XmlElement.class); //if (propXmlElement != null) // propClassInfo = (ClassInfo) propClassInfo.getTypeInfoFactory().getTypeInfo(propXmlElement.type()); // if it's a model group then propertyXmlModelGroup = componentClass.getUnderlyingAnnotation(JBossXmlModelGroup.class); if (propertyXmlType == null && propertyXmlModelGroup != null) { // model group value handler based on the model group name // TODO what if it doesn't have a name? AbstractPropertyHandler propertyHandler = null; if (propertyType.isCollection()) propertyHandler = new CollectionPropertyHandler(property, propertyType); else propertyHandler = new PropertyHandler(property, propertyType); bindModelGroup(propertyXmlModelGroup, property, beanAdapterFactory, propertyHandler, null, localModel); return; } } // So this is element(s) XmlElement[] elements = null; XmlElement xmlElement = property.getUnderlyingAnnotation(XmlElement.class); if (xmlElement != null) { // A single element annotated elements = new XmlElement[]{xmlElement}; } else { // Mutlple elements XmlElements xmlElements = property.getUnderlyingAnnotation(XmlElements.class); if (xmlElements != null) elements = xmlElements.value(); } // A single element not annotated if (elements == null || elements.length == 0) elements = new XmlElement[1]; // support for @XmlElementWrapper // the wrapping element is ignored in this case XmlElementWrapper xmlWrapper = property.getUnderlyingAnnotation(XmlElementWrapper.class); if (xmlWrapper != null) { String wrapperNamespace = xmlWrapper.namespace(); String wrapperName = xmlWrapper.name(); QName wrapperQName = generateXmlName(property.getName(), elementForm, wrapperNamespace, wrapperName); PropertyHandler setWrapperProperty = new PropertyHandler(property, propertyType); beanAdapterFactory.addProperty(wrapperQName, setWrapperProperty); localModel = bindXmlElementWrapper(setWrapperProperty, propertyType, localModel, xmlWrapper, wrapperQName); if (trace) log.trace("Added property " + wrapperQName + " for type=" + property.getBeanInfo().getName() + " property=" + property.getName() + " as a wrapper element"); } // Setup a choice boolean repeatableChoice = false; if (elements.length > 1) { ChoiceBinding choice = new ChoiceBinding(schemaBinding); choice.setHandler(BuilderParticleHandler.parentGroup(localModel)); ParticleBinding particleBinding = new ParticleBinding(choice); particleBinding.setMinOccurs(0); // WARN normally maxOccursUnbounded should be set to true in this case // but I make an exception for case like in org.jboss.test.xb.builder.repeatableterms.support.Sequence if(propertyType.isCollection() || propertyType.isArray()) { particleBinding.setMaxOccursUnbounded(true); repeatableChoice = true; } localModel.addParticle(particleBinding); localModel = choice; if(xmlWrapper == null) { if(propertyType.isArray()) { if(currentRepeatableHandlers) choice.setRepeatableHandler(new ArrayWrapperRepeatableParticleHandler(new PropertyHandler(property, propertyType))); else choice.setRepeatableHandler(new AppendingArrayRepeatableHandler(new PropertyHandler(property, propertyType))); } else if(currentRepeatableHandlers && propertyType.isCollection()) choice.setRepeatableHandler(new CollectionRepeatableParticleHandler(new PropertyHandler(property, propertyType), (ClassInfo) propertyType, null)); } if (trace) log.trace("XmlElements seen adding choice for type=" + property.getBeanInfo().getName() + " property=" + property.getName()); } // Bind the wildcard if (wildcardProperty) { if (trace) log.trace("Processing WildcardProperty for property=" + property.getName()); WildcardBinding wildcard = new WildcardBinding(schemaBinding); ParticleBinding particleBinding = new ParticleBinding(wildcard); localModel.addParticle(particleBinding); particleBinding.setMinOccurs(0); AbstractPropertyHandler wildcardHandler; // Setup any new model and determine the wildcard type TypeInfo wildcardType = propertyType; if (propertyType.isArray()) { if(!repeatableChoice) particleBinding.setMaxOccursUnbounded(true); wildcardHandler = new PropertyWildcardHandler(property, propertyType); // this is actually currently not kicking in because most probably it's a choice (XmlElements) // and the choice's repeatable handler will be used instead wildcard.setRepeatableHandler(new ArrayWrapperRepeatableParticleHandler(wildcardHandler)); wildcardType = ((ArrayInfo) propertyType).getComponentType(); if (trace) log.trace("Wildcard " + property.getName() + " is an array of type " + wildcardType.getName()); } else if (propertyType.isCollection()) { if(!repeatableChoice) particleBinding.setMaxOccursUnbounded(true); if(currentRepeatableHandlers) { wildcardHandler = new PropertyWildcardHandler(property, propertyType); // this is actually currently not kicking in because most probably it's a choice (XmlElements) // and the choice's repeatable handler will be used instead wildcard.setRepeatableHandler(new CollectionRepeatableParticleHandler(wildcardHandler, (ClassInfo) propertyType, null)); } else wildcardHandler = new CollectionPropertyWildcardHandler(property, propertyType); wildcardType = ((ClassInfo)property.getType()).getComponentType(); if (trace) log.trace("Wildcard " + property.getName() + " is a collection of type " + wildcardType.getName()); } else { wildcardHandler = new PropertyWildcardHandler(property, propertyType); particleBinding.setMaxOccurs(1); } XmlAnyElement xmlAnyElement = property.getUnderlyingAnnotation(XmlAnyElement.class); boolean isLax = xmlAnyElement == null ? true : xmlAnyElement.lax(); if (isLax) wildcard.setProcessContents((short) 3); // Lax else wildcard.setProcessContents((short) 1); // Strict // Dom element? if (Element.class.getName().equals(wildcardType.getName())) { wildcard.setUnresolvedElementHandler(DOMHandler.INSTANCE); wildcard.setUnresolvedCharactersHandler(DOMHandler.INSTANCE); } wildcard.setHandler((ParticleHandler) wildcardHandler); beanAdapterFactory.setWildcardHandler(wildcardHandler); } String overridenDefaultNamespace = defaultNamespace; // for now support just one JBossXmlNsPrefix String overrideNamespace = null; String prefixNs = null; JBossXmlNsPrefix xmlNsPrefix = property.getUnderlyingAnnotation(JBossXmlNsPrefix.class); if (xmlNsPrefix != null) { prefixNs = schemaBinding.getNamespace(xmlNsPrefix.prefix()); if (prefixNs == null) { if (xmlNsPrefix.schemaTargetIfNotMapped()) prefixNs = defaultNamespace; else throw new IllegalStateException("Prefix '" + xmlNsPrefix.prefix() + "' is not mapped to any namespace!"); } if(xmlNsPrefix.applyToComponentQName()) overrideNamespace = prefixNs; } JBossXmlGroup jbossXmlGroup = null; if (!propertyType.isPrimitive()) jbossXmlGroup = ((ClassInfo) propertyType).getUnderlyingAnnotation(JBossXmlGroup.class); if(elements[0] == null && jbossXmlGroup != null) { if(prefixNs != null && xmlNsPrefix.applyToComponentContent()) defaultNamespace = prefixNs; if (trace) log.trace("Processing group for property " + property.getName() + " in " + property.getBeanInfo().getName() + " " + jbossXmlGroup); JBossXmlChild[] children = jbossXmlGroup.value(); if (children != null && children.length > 0) { TypeBinding elementTypeBinding = new TypeBinding(); elementTypeBinding.setSchemaBinding(schemaBinding); JBossXmlGroupText groupText = ((ClassInfo) propertyType).getUnderlyingAnnotation(JBossXmlGroupText.class); if (groupText != null && groupText.wrapper() != Object.class) { BeanInfo wrapperInfo = JBossXBBuilder.configuration.getBeanInfo(groupText.wrapper(), beanAccessMode); TypeBinding wrapperTypeBinding = resolveTypeBinding(wrapperInfo.getClassInfo()); ParticleHandler particleHandler = wrapperTypeBinding.getHandler(); if (particleHandler instanceof BeanHandler == false) throw new IllegalStateException("Cannot wrap " + wrapperInfo.getName() + " not a bean type " + particleHandler); BeanHandler beanHandler = (BeanHandler) particleHandler; WrapperBeanAdapterFactory wrapperFactory = new WrapperBeanAdapterFactory(beanHandler.getBeanAdapterFactory(), propertyType.getType()); BeanHandler wrapperHandler = new BeanHandler(wrapperInfo.getName(), wrapperFactory, elementTypeBinding); elementTypeBinding.setHandler(wrapperHandler); // Steal the attributes Collection otherAttributes = wrapperTypeBinding.getAttributes(); if (otherAttributes != null) { for (AttributeBinding other : otherAttributes) { elementTypeBinding.addAttribute(other); wrapperHandler.getAttributesHandler().addAttribute(other); } } elementTypeBinding.setSimpleType(wrapperTypeBinding.getSimpleType()); } else { elementTypeBinding.setHandler(BuilderParticleHandler.parentGroup(localModel)); } QName propertyQName = generateXmlName(property.getName(), elementForm, overrideNamespace, null); ElementBinding elementBinding = createElementBinding(propertyType, elementTypeBinding, propertyQName, false); AbstractPropertyHandler propertyHandler = new PropertyHandler(property, propertyType); if(elementSetParentHandler) elementBinding.setHandler(new SetParentOverrideHandler(elementTypeBinding.getHandler(), propertyHandler)); beanAdapterFactory.addProperty(propertyQName, propertyHandler); // Bind it to the model ParticleBinding particle = new ParticleBinding(elementBinding, 0, 1, false); localModel.addParticle(particle); // Setup the child model ChoiceBinding childModel = new ChoiceBinding(schemaBinding); childModel.setHandler(BuilderParticleHandler.setParentDelegate(elementTypeBinding.getHandler())); ParticleBinding particleBinding = new ParticleBinding(childModel); particleBinding.setMinOccurs(0); particleBinding.setMaxOccurs(1); elementTypeBinding.setParticle(particleBinding); JBossXmlGroupWildcard groupWildcard = ((ClassInfo) propertyType).getUnderlyingAnnotation(JBossXmlGroupWildcard.class); if (groupWildcard != null) { ChildWildcardHandler groupWildcardHandler; if (groupWildcard.wrapper() != Object.class) { BeanInfo wrapperInfo = JBossXBBuilder.configuration.getBeanInfo(groupWildcard.wrapper(), beanAccessMode); groupWildcardHandler = new ChildWildcardHandler(property, wrapperInfo, groupWildcard.property()); } else groupWildcardHandler = new ChildWildcardHandler(property); WildcardBinding wildcard = new WildcardBinding(schemaBinding); if (groupWildcard.lax()) wildcard.setProcessContents((short) 3); // Lax else wildcard.setProcessContents((short) 1); // Strict particleBinding = new ParticleBinding(wildcard); particleBinding.setMinOccurs(0); particleBinding.setMaxOccurs(1); childModel.addParticle(particleBinding); elementTypeBinding.getWildcard().setHandler(groupWildcardHandler); } DefaultElementInterceptor interceptor = new PropertyInterceptor(property, propertyType); for (JBossXmlChild child : children) { QName childName = generateXmlName(child.name(), elementForm, child.namespace(), child.name()); TypeInfo childType = JBossXBBuilder.configuration.getTypeInfo(child.type()); TypeBinding childTypeBinding = resolveTypeBinding(childType); ElementBinding childBinding = createElementBinding(childType, childTypeBinding, childName, false); // Bind it to the model particle = new ParticleBinding(childBinding, child.minOccurs(), child.maxOccurs(), child.unbounded()); particle.setMinOccurs(0); childModel.addParticle(particle); if(childType.isMap()) bindMapProperty(property, (ClassInfo) childType, childName, (ModelGroupBinding) childTypeBinding.getParticle().getTerm()); elementTypeBinding.pushInterceptor(childName, interceptor); if (trace) log.trace("Added interceptor " + childName + " for type=" + property.getBeanInfo().getName() + " property=" + property.getName() + " interceptor=" + interceptor + " " + childType.getName()); } } defaultNamespace = overridenDefaultNamespace; return; } XBValueAdapter valueAdapter = null; XmlJavaTypeAdapter xmlTypeAdapter = property.getUnderlyingAnnotation(XmlJavaTypeAdapter.class); if (xmlTypeAdapter != null) valueAdapter = new XBValueAdapter(xmlTypeAdapter.value(), propertyType.getTypeInfoFactory()); JBossXmlPreserveWhitespace preserveSpace = property.getUnderlyingAnnotation(JBossXmlPreserveWhitespace.class); for (int i = 0; i < elements.length; ++i) { XmlElement element = elements[i]; if (trace) log.trace("Processing " + element + " for type=" + property.getBeanInfo().getName() + " property=" + property.getName()); // Determine the parameters String overrideName = null; boolean nillable = false; boolean required = false; TypeInfo localPropertyType = propertyType; if (element != null) { if(prefixNs == null || !xmlNsPrefix.applyToComponentQName()) overrideNamespace = element.namespace(); overrideName = element.name(); nillable = element.nillable(); required = element.required(); Class elementType = element.type(); if (elementType != XmlElement.DEFAULT.class) localPropertyType = propertyType.getTypeInfoFactory().getTypeInfo(elementType); } // Determine the name QName propertyQName = generateXmlName(property.getName(), elementForm, overrideNamespace, overrideName); if(prefixNs != null && xmlNsPrefix.applyToComponentContent()) defaultNamespace = prefixNs; AbstractPropertyHandler propertyHandler = null; // Create the element RepeatableParticleHandler repeatableHandler = null; if (valueAdapter != null) { localPropertyType = valueAdapter.getAdaptedTypeInfo(); if(localPropertyType.isCollection()) repeatableHandler = new CollectionRepeatableParticleHandler(new PropertyHandler(property, localPropertyType), (ClassInfo) localPropertyType, valueAdapter); } ModelGroupBinding targetGroup = localModel; boolean isCol = false; boolean isMap = false; TypeInfo colType = null; // a collection may be bound as a value of a complex type // and this is checked with the XmlType annotation if (propertyType.isCollection() && ((ClassInfo) propertyType).getUnderlyingAnnotation(XmlType.class) == null) { if(propertyHandler == null && !currentRepeatableHandlers) propertyHandler = new CollectionPropertyHandler(property, propertyType); isCol = true; colType = propertyType; // here we get the comp type based on the non-overriden property type... // which feels like a weak point TypeInfo typeArg = ((ClassInfo)property.getType()).getComponentType(); if (typeArg != null) { JBossXmlChild xmlChild = ((ClassInfo) propertyType).getUnderlyingAnnotation(JBossXmlChild.class); if (xmlChild == null && localPropertyType.equals(propertyType)) { // the localPropertyType was not overridden previously so use the collection parameter type localPropertyType = typeArg; } } } // TODO this shouldn't be here (because localPropertyType should specify an item?) // this is to support the Descriptions.class -> DescriptionsImpl.class else if (localPropertyType.isCollection() && ((ClassInfo) localPropertyType).getUnderlyingAnnotation(XmlType.class) == null) { if(propertyHandler == null && !currentRepeatableHandlers) { if (valueAdapter != null) propertyHandler = new PropertyHandler(property, localPropertyType); else propertyHandler = new CollectionPropertyHandler(property, localPropertyType); } isCol = true; colType = localPropertyType; localPropertyType = ((ClassInfo)localPropertyType).getComponentType(); } else if (localPropertyType.isMap()) { ElementBinding wrapperElement = null; if(elements.length > 1) { TypeBinding wrapperType = resolveTypeBinding(localPropertyType); wrapperElement = createElementBinding(localPropertyType, wrapperType, propertyQName, false); wrapperElement.setNillable(nillable); wrapperElement.setValueAdapter(valueAdapter); // Bind it to the model ParticleBinding particle = new ParticleBinding(wrapperElement, 0, 1, false); if (required == false) particle.setMinOccurs(0); targetGroup.addParticle(particle); targetGroup = (ModelGroupBinding) wrapperType.getParticle().getTerm(); } TermBinding entryTerm = bindMapProperty(property, (ClassInfo) localPropertyType, propertyQName, targetGroup); if(entryTerm != null) { QName entryQName = entryTerm.getQName(); if(entryQName == null) entryQName = propertyQName; if(wrapperElement != null) { BeanAdapterFactory wrapperBeanFactory = ((BeanHandler)wrapperElement.getType().getHandler()).getBeanAdapterFactory(); Map properties = wrapperBeanFactory.getProperties(); if(properties.containsKey(entryQName) == false) { MapPropertyHandler mapHandler = new MapPropertyHandler(JBossXBBuilder.configuration, beanAccessMode, property, localPropertyType, true); wrapperBeanFactory.addProperty(entryQName, mapHandler); } if(propertyHandler == null) propertyHandler = new PropertyHandler(property, localPropertyType); if(elementSetParentHandler) wrapperElement.setHandler(new SetParentOverrideHandler(wrapperElement.getHandler(), propertyHandler)); } else { propertyQName = entryQName; if(propertyHandler == null) propertyHandler = new MapPropertyHandler(JBossXBBuilder.configuration, beanAccessMode, property, localPropertyType, false); } // overriding setParent doesn't make sense for a map // entryTerm.setHandler(new SetParentOverrideHandler(entryTerm.getHandler(), propertyHandler)); isMap = true; } } if(propertyHandler == null) propertyHandler = new PropertyHandler(property, localPropertyType); ElementBinding elementBinding = null; ParticleBinding particle; if(Element.class.getName().equals(propertyType.getName())) { if(!wildcardProperty) { WildcardBinding wildcard = new WildcardBinding(schemaBinding); wildcard.setProcessContents((short) 2); wildcard.setUnresolvedElementHandler(DOMHandler.INSTANCE); wildcard.setUnresolvedCharactersHandler(DOMHandler.INSTANCE); SequenceBinding seq = new SequenceBinding(schemaBinding); seq.addParticle(new ParticleBinding(wildcard, 0, 1, false)); TypeBinding elementTypeBinding = new TypeBinding(); elementTypeBinding.setHandler(new NonXmlAnyElementDOMElementPropertyHandler(property, propertyType)); elementTypeBinding.setParticle(new ParticleBinding(seq, 0, 1, true)); elementBinding = createElementBinding(localPropertyType, elementTypeBinding, propertyQName, false); elementBinding.setNillable(nillable); elementBinding.setValueAdapter(valueAdapter); // Bind it to the model particle = new ParticleBinding(elementBinding, 1, 1, isCol); if (required == false) particle.setMinOccurs(0); targetGroup.addParticle(particle); } } else if (!isMap) { TypeBinding elementType = resolveTypeBinding(localPropertyType); if (propertyXmlModelGroup != null) bindModelGroup(propertyXmlModelGroup, property, null, null, elementType, (ModelGroupBinding) elementType.getParticle().getTerm()); elementBinding = createElementBinding(localPropertyType, elementType, propertyQName, false); elementBinding.setNillable(nillable); elementBinding.setValueAdapter(valueAdapter); if(repeatableHandler == null && elements.length == 1 && xmlWrapper == null) { if(propertyType.isArray()) { isCol = true; if(currentRepeatableHandlers) repeatableHandler = new ArrayWrapperRepeatableParticleHandler(propertyHandler); else repeatableHandler = new AppendingArrayRepeatableHandler(propertyHandler); } else if(isCol && currentRepeatableHandlers) repeatableHandler = new CollectionRepeatableParticleHandler(propertyHandler, (ClassInfo) colType, null); } if(repeatableHandler != null) elementBinding.setRepeatableHandler(repeatableHandler); if (preserveSpace != null) { elementBinding.setNormalizeSpace(preserveSpace.preserve() ? false : true); if (trace) log.trace("@JBossXmlPreserveWhitespace.preserve=" + preserveSpace.preserve() + " for " + elementBinding.getQName()); } // Bind it to the model particle = new ParticleBinding(elementBinding, 1, 1, isCol); if (required == false) particle.setMinOccurs(0); targetGroup.addParticle(particle); } if(elementBinding != null && elementSetParentHandler) elementBinding.setHandler(new SetParentOverrideHandler(elementBinding.getType().getHandler(), propertyHandler)); beanAdapterFactory.addProperty(propertyQName, propertyHandler); if (trace) log.trace("Added property " + propertyQName + " for type=" + property.getBeanInfo().getName() + " property=" + property.getName() + " handler=" + propertyHandler); defaultNamespace = overridenDefaultNamespace; } } private void bindModelGroup(JBossXmlModelGroup annotation, PropertyInfo property, BeanAdapterFactory beanAdapterFactory, AbstractPropertyHandler propertyHandler, TypeBinding typeBinding, ModelGroupBinding parentGroup) { String groupNs = defaultNamespace; String overridenDefaultNamespace = defaultNamespace; JBossXmlNsPrefix nsPrefix = property.getUnderlyingAnnotation(JBossXmlNsPrefix.class); if (nsPrefix != null) { String ns = schemaBinding.getNamespace(nsPrefix.prefix()); if (ns == null && nsPrefix.schemaTargetIfNotMapped()) throw new IllegalStateException("Prefix '" + nsPrefix.prefix() + "' is not mapped to any namespace!"); if (nsPrefix.applyToComponentQName()) groupNs = ns; if (nsPrefix.applyToComponentContent()) defaultNamespace = ns; } QName groupName = null; if (!JBossXmlConstants.DEFAULT.equals(annotation.name())) groupName = new QName(groupNs, annotation.name()); ModelGroupBinding group = null; boolean createGroup = true; if (groupName != null) { group = schemaBinding.getGroup(groupName); if(group != null) createGroup = false; } TypeInfo groupType = property.getType(); boolean repeatable = false; if(groupType.isCollection() || groupType.isArray()) { groupType = ((ClassInfo)groupType).getComponentType(); repeatable = true; } if(createGroup) { boolean propOrderMissing = annotation.propOrder().length == 1 && annotation.propOrder()[0].equals("") || annotation.particles().length > 0; if(annotation.particles().length == 0) { BeanAccessMode beanAccessMode = this.beanAccessMode; JBossXmlAccessMode accessMode = annotation.accessMode(); if(accessMode != JBossXmlAccessMode.NOT_SPECIFIED) beanAccessMode = jbossXmlAccessModeToBeanAccessMode(accessMode); // handler for the model group members BeanInfo groupBeanInfo = JBossXBBuilder.configuration.getBeanInfo(groupType, beanAccessMode); BeanAdapterFactory propBeanAdapterFactory = createAdapterFactory(DefaultBeanAdapterBuilder.class, groupBeanInfo, null); String[] memberOrder = annotation.propOrder(); if (memberOrder.length == 0 || memberOrder[0].length() == 0) { List propNames = new ArrayList(); for (PropertyInfo prop : groupBeanInfo.getProperties()) { if ("class".equals(prop.getName())) continue; propNames.add(prop.getName()); } memberOrder = propNames.toArray(new String[propNames.size()]); } if (trace) log.trace("Property order for " + annotation.kind() + " property " + property.getName() + ": " + Arrays.asList(memberOrder)); group = createModelGroup(annotation.kind(), groupType, memberOrder.length > 1 && propOrderMissing, annotation.propOrder(), groupName); group.setSkip(false); GroupBeanHandler propHandler = new GroupBeanHandler(groupBeanInfo.getName(), propBeanAdapterFactory, group); group.setHandler(propHandler); // can't do it with global components //group.setHandler(new SetParentOverrideHandler(propHandler, propertyHandler)); boolean previousRepeatableHandlers = this.currentRepeatableHandlers; if(annotation.kind().equals(JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE)) this.currentRepeatableHandlers = false; else this.currentRepeatableHandlers = this.repeatableParticleHandlers; // bind model group members for (String memberPropName : memberOrder) { PropertyInfo memberProp = groupBeanInfo.getProperty(memberPropName); push(groupType, memberPropName); bindProperty(memberProp, group, propBeanAdapterFactory, memberOrder, false); pop(); } this.currentRepeatableHandlers = previousRepeatableHandlers; } else group = createModelGroup(annotation.kind(), groupType, propOrderMissing, annotation.propOrder(), groupName); if(property.getType().isArray()) { if(currentRepeatableHandlers) group.setRepeatableHandler(new ArrayWrapperRepeatableParticleHandler(propertyHandler)); else group.setRepeatableHandler(new AppendingArrayRepeatableHandler(propertyHandler)); } } parentGroup.addParticle(new ParticleBinding(group, 0, 1, repeatable)); if(annotation.particles().length == 0) { if(group.getQName() == null) throw new JBossXBRuntimeException("To be bound a group must have a non-null QName. Bean " + property.getBeanInfo().getName() + ", property=" + property.getName()); beanAdapterFactory.addProperty(group.getQName(), propertyHandler); } else { for (JBossXmlModelGroup.Particle member : annotation.particles()) { XmlElement element = member.element(); QName memberQName = generateXmlName(element.name(), XmlNsForm.QUALIFIED, element.namespace(), null); if(createGroup) { TypeInfo memberTypeInfo = groupType.getTypeInfoFactory().getTypeInfo(member.type()); boolean isCol = false; if (memberTypeInfo.isCollection()) { memberTypeInfo = ((ClassInfo) memberTypeInfo).getComponentType(); isCol = true; } TypeBinding memberTypeBinding = resolveTypeBinding(memberTypeInfo); ElementBinding memberElement = createElementBinding(memberTypeInfo, memberTypeBinding, memberQName, false); memberElement.setNillable(true); ParticleBinding memberParticle = new ParticleBinding(memberElement, 0, 1, isCol); group.addParticle(memberParticle); // can't do it with global components (the group one) //if(propertyHandler != null) // memberElement.setHandler(new SetParentOverrideHandler(memberElement.getHandler(), propertyHandler)); } if(propertyHandler != null) beanAdapterFactory.addProperty(memberQName, propertyHandler); else typeBinding.pushInterceptor(memberQName, ChildCollectionInterceptor.SINGLETON); } } defaultNamespace = overridenDefaultNamespace; } private ModelGroupBinding createModelGroup(String kind, TypeInfo type, boolean propOrderMissing, String[] propertyOrder, QName groupName) { ModelGroupBinding group; if (kind.equals(JBossXmlConstants.MODEL_GROUP_SEQUENCE)) { if(propOrderMissing) assertPropOrderNotRequired(type, propertyOrder); group = new SequenceBinding(schemaBinding);//groupFactory.createSequence(schemaBinding); } else if (kind.equals(JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE)) group = new UnorderedSequenceBinding(schemaBinding); else if (kind.equals(JBossXmlConstants.MODEL_GROUP_CHOICE)) group = new ChoiceBinding(schemaBinding); else if (kind.equals(JBossXmlConstants.MODEL_GROUP_ALL)) group = new AllBinding(schemaBinding); else if(kind.equals(JBossXmlConstants.DEFAULT)) { if(propOrderMissing) assertPropOrderNotRequired(type, propertyOrder); group = groupFactory.createSequence(schemaBinding); } else throw new IllegalStateException("Unexpected JBossXmlModelGroup.kind=" + kind + " for type " + type.getName()); if(groupName != null) { group.setQName(groupName); schemaBinding.addGroup(groupName, group); } return group; } private SequenceBinding bindXmlElementWrapper(AbstractPropertyHandler setParentProperty, TypeInfo propertyType, ModelGroupBinding parentModel, XmlElementWrapper annotation, QName wrapperQName) { TypeBinding wrapperType = new TypeBinding(); SequenceBinding seq = new SequenceBinding(schemaBinding); seq.setHandler(DefaultHandlers.NOOP_PARTICLE_HANDLER); ParticleBinding particle = new ParticleBinding(seq); wrapperType.setParticle(particle); wrapperType.setHandler(DefaultHandlers.NOOP_PARTICLE_HANDLER); ElementBinding wrapperElement = createElementBinding(propertyType, wrapperType, wrapperQName, false); wrapperElement.setNillable(annotation.nillable()); wrapperElement.setSkip(true); particle = new ParticleBinding(wrapperElement, annotation.required() ? 1 : 0, 1, propertyType.isCollection() || propertyType.isArray()); parentModel.addParticle(particle); if (propertyType.isArray()) if(currentRepeatableHandlers) wrapperElement.setRepeatableHandler(new ArrayWrapperRepeatableParticleHandler(setParentProperty)); else wrapperElement.setRepeatableHandler(new AppendingArrayRepeatableHandler(setParentProperty)); else if (propertyType.isCollection() && currentRepeatableHandlers) wrapperElement.setRepeatableHandler(new CollectionRepeatableParticleHandler(setParentProperty, (ClassInfo) propertyType, null)); return seq; } private BeanAdapterFactory createAdapterFactory(Class beanAdapterBuilderClass, BeanInfo beanInfo, MethodInfo factory) { try { BeanInfo adapterBuilderInfo = JBossXBBuilder.configuration.getBeanInfo(beanAdapterBuilderClass, beanAccessMode); BeanAdapterBuilder adapterBuilder = (BeanAdapterBuilder) adapterBuilderInfo.newInstance(); return adapterBuilder.newFactory(beanInfo, factory); } catch (Throwable t) { throw new RuntimeException("Error creating BeanAdapterFactory for " + beanAdapterBuilderClass.getName(), t); } } /** * Add a namespace to the schema * * @param namespace the namespace * @param erase whether to erase if there was only the default namespace */ private void addNamespace(String namespace, boolean erase) { Set namespaces = schemaBinding.getNamespaces(); if (erase && namespaces.size() <= 1) namespaces = new HashSet(Collections.singleton(namespace)); namespaces.add(namespace); schemaBinding.setNamespaces(namespaces); } /** * Create a new xml name * * @param typeInfo the type info * @param form the namespace form * @param namespace the override namespace * @param name the override name * @return the xml name */ protected QName generateXmlName(TypeInfo typeInfo, XmlNsForm form, String namespace, String name) { return generateXmlName(typeInfo.getSimpleName(), form, namespace, name); } /** * Create a new xml name * * @param localName the raw local name * @param form the namespace form * @param namespace the override namespace * @param name the override name * @return the xml name */ protected QName generateXmlName(String localName, XmlNsForm form, String namespace, String name) { String nsUri = XMLConstants.NULL_NS_URI; if (form == XmlNsForm.QUALIFIED) nsUri = defaultNamespace; if (namespace != null && JBossXmlConstants.DEFAULT.equals(namespace) == false) nsUri = namespace; if (name != null && JBossXmlConstants.DEFAULT.equals(name) == false) localName = name; else localName = JBossXBBuilder.generateXMLNameFromJavaName(localName, true, schemaBinding.isIgnoreLowLine()); return new QName(nsUri, localName); } private void push(TypeInfo typeInfo) { push(typeInfo, null); } private void push(TypeInfo typeInfo, String joinpoint) { locations.push(new Location(typeInfo, joinpoint)); } private void pop() { locations.pop(); } private RuntimeException rethrowWithLocation(Throwable t) { StringBuilder message = new StringBuilder(); message.append(t.getMessage()); message.append("\n"); while (locations.isEmpty() == false) { Location location = locations.pop(); location.append(message); if (locations.isEmpty() == false) message.append('\n'); } throw new JBossXBRuntimeException(message.toString(), t); } /** A location */ private class Location { /** The type info */ TypeInfo typeInfo; /** The join point */ String joinpoint; Location(TypeInfo typeInfo, String joinpoint) { this.typeInfo = typeInfo; this.joinpoint = joinpoint; } public void append(StringBuilder builder) { builder.append("at "); builder.append(typeInfo.getName()); if (joinpoint != null) builder.append('.').append(joinpoint); } } private static class XBValueAdapter implements ValueAdapter { private final XmlAdapter xmlAdapter; private final TypeInfo adaptedTypeInfo; private final Type adaptedType; public XBValueAdapter(Class adapterImplClass, TypeInfoFactory factory) { try { this.xmlAdapter = adapterImplClass.newInstance(); } catch (Exception e) { throw new IllegalStateException("Failed to create an instance of " + adapterImplClass.getName(), e); } adaptedType = ((ParameterizedType)adapterImplClass.getGenericSuperclass()).getActualTypeArguments()[0]; adaptedTypeInfo = factory.getTypeInfo(adaptedType); } public TypeInfo getAdaptedTypeInfo() { return adaptedTypeInfo; } public Type getAdaptedType() { return adaptedType; } public Object cast(Object o, Class c) { try { return xmlAdapter.unmarshal(o); } catch (Exception e) { throw new IllegalStateException("Failed to adapt value " + o + " to type " + c, e); } } } private TermBinding bindMapProperty(PropertyInfo prop, ClassInfo propType, QName propertyQName, ModelGroupBinding targetGroup) { JBossXmlMapEntry entryElement = null; if(prop != null) entryElement = prop.getUnderlyingAnnotation(JBossXmlMapEntry.class); if(entryElement == null) entryElement = propType.getUnderlyingAnnotation(JBossXmlMapEntry.class); JBossXmlMapKeyElement keyElement = null; if(prop != null) keyElement = prop.getUnderlyingAnnotation(JBossXmlMapKeyElement.class); if(keyElement == null) keyElement = propType.getUnderlyingAnnotation(JBossXmlMapKeyElement.class); JBossXmlMapKeyAttribute keyAttribute = null; if(prop != null) keyAttribute = prop.getUnderlyingAnnotation(JBossXmlMapKeyAttribute.class); if(keyAttribute == null) keyAttribute = propType.getUnderlyingAnnotation(JBossXmlMapKeyAttribute.class); TermBinding entryTerm = null; if(keyElement != null || keyAttribute != null) { // further assuming the map is bound JBossXmlMapValueElement valueElement = null; if(prop != null) valueElement = prop.getUnderlyingAnnotation(JBossXmlMapValueElement.class); if(valueElement == null) valueElement = propType.getUnderlyingAnnotation(JBossXmlMapValueElement.class); JBossXmlMapValueAttribute valueAttribute = null; if(prop != null) valueAttribute = prop.getUnderlyingAnnotation(JBossXmlMapValueAttribute.class); if(valueAttribute == null) valueAttribute = propType.getUnderlyingAnnotation(JBossXmlMapValueAttribute.class); TypeInfo keyType = propType.getKeyType(); TypeInfo valueType = propType.getValueType(); // entry handler BeanAdapterFactory entryAdapterFactory = null; BeanInfo entryInfo = JBossXBBuilder.configuration.getBeanInfo(DefaultMapEntry.class, beanAccessMode); entryAdapterFactory = createAdapterFactory(DefaultBeanAdapterBuilder.class, entryInfo, null); TypeBinding entryType = null; TypeInfo entryTypeInfo = null; // bind the entry element if present if(entryElement != null && !JBossXmlConstants.DEFAULT.equals(entryElement.name())) { String ns = entryElement.namespace(); if(JBossXmlConstants.DEFAULT.equals(ns)) ns = defaultNamespace; QName entryName = new QName(ns, entryElement.name()); entryType = new TypeBinding(); entryType.setSchemaBinding(schemaBinding); BeanHandler entryHandler = new BeanHandler(entryInfo.getName(), entryAdapterFactory, entryType); entryType.setHandler(entryHandler); entryTypeInfo = JBossXBBuilder.configuration.getTypeInfo(DefaultMapEntry.class); ElementBinding entryElementBinding = createElementBinding(entryTypeInfo, entryType, entryName, false); entryTerm = entryElementBinding; ParticleBinding entryParticle = new ParticleBinding(entryElementBinding, 0, -1, true); targetGroup.addParticle(entryParticle); propertyQName = entryName; if(keyAttribute != null) { TypeBinding attributeType = resolveTypeBinding(keyType); AttributeHandler attributeHandler = new PropertyHandler(entryInfo.getProperty("key"), keyType); QName attrQName = generateXmlName(keyType, attributeForm, keyAttribute.namespace(), keyAttribute.name()); AttributeBinding keyBinding = new AttributeBinding(schemaBinding, attrQName, attributeType, attributeHandler); keyBinding.setRequired(true); entryType.addAttribute(keyBinding); entryHandler.getAttributesHandler().addAttribute(keyBinding); } if(valueAttribute != null) { TypeBinding attributeType = resolveTypeBinding(valueType); AttributeHandler attributeHandler = new PropertyHandler(entryInfo.getProperty("value"), valueType); QName attrQName = generateXmlName(valueType, attributeForm, valueAttribute.namespace(), valueAttribute.name()); AttributeBinding valueBinding = new AttributeBinding(schemaBinding, attrQName, attributeType, attributeHandler); valueBinding.setRequired(true); entryType.addAttribute(valueBinding); entryHandler.getAttributesHandler().addAttribute(valueBinding); } else if(valueElement == null) { CharactersHandler charactersHandler = new ValueHandler(entryInfo.getProperty("value"), valueType); entryType.setSimpleType(charactersHandler); } } SequenceBinding keyValueSequence = null; if(keyElement != null) { keyValueSequence = new SequenceBinding(schemaBinding); if(entryType == null) { keyValueSequence.setSkip(false); keyValueSequence.setQName(propertyQName); GroupBeanHandler entryHandler = new GroupBeanHandler(entryInfo.getName(), entryAdapterFactory, keyValueSequence); schemaBinding.addGroup(keyValueSequence.getQName(), keyValueSequence); ParticleBinding keyValueParticle = new ParticleBinding(keyValueSequence, 0, -1, true); targetGroup.addParticle(keyValueParticle); keyValueSequence.setHandler(entryHandler); entryTerm = keyValueSequence; } else { ParticleBinding keyValueParticle = new ParticleBinding(keyValueSequence, 1, 1, false); entryType.setParticle(keyValueParticle); } // key element TypeBinding keyTypeBinding = resolveTypeBinding(keyType); String keyNs = keyElement.namespace(); if(JBossXmlConstants.DEFAULT.equals(keyNs)) keyNs = defaultNamespace; ElementBinding keyElementBinding = createElementBinding(keyType, keyTypeBinding, new QName(keyNs, keyElement.name()), false); ParticleBinding particle = new ParticleBinding(keyElementBinding, 1, 1, false); keyValueSequence.addParticle(particle); PropertyHandler keyHandler = new PropertyHandler(entryInfo.getProperty("key"), keyType); entryAdapterFactory.addProperty(keyElementBinding.getQName(), keyHandler); if(elementSetParentHandler) keyElementBinding.setHandler(new SetParentOverrideHandler(keyTypeBinding.getHandler(), keyHandler)); } if(valueElement != null) { TypeBinding valueTypeBinding = resolveTypeBinding(valueType); String valueNs = valueElement.namespace(); if(JBossXmlConstants.DEFAULT.equals(valueNs)) valueNs = defaultNamespace; ElementBinding valueElementBinding = createElementBinding(valueType, valueTypeBinding, new QName(valueNs, valueElement.name()), false); ParticleBinding particle = new ParticleBinding(valueElementBinding, 1, 1, false); keyValueSequence.addParticle(particle); PropertyHandler valueHandler = new PropertyHandler(entryInfo.getProperty("value"), valueType); entryAdapterFactory.addProperty(valueElementBinding.getQName(), valueHandler); if(elementSetParentHandler) valueElementBinding.setHandler(new SetParentOverrideHandler(valueTypeBinding.getHandler(), valueHandler)); } } else if(entryElement != null && !JBossXmlMapEntry.DEFAULT.class.equals(entryElement.type())) { if(!JBossXmlConstants.DEFAULT.equals(entryElement.name())) { String ns = entryElement.namespace(); if(JBossXmlConstants.DEFAULT.equals(ns)) ns = propertyQName.getNamespaceURI(); propertyQName = new QName(ns, entryElement.name()); } TypeInfo entryTypeInfo = JBossXBBuilder.configuration.getTypeInfo(entryElement.type()); ElementBinding entryElementBinding = createElementBinding(entryTypeInfo, propertyQName.getLocalPart(), false); ParticleBinding entryParticle = new ParticleBinding(entryElementBinding, 0, -1, true); targetGroup.addParticle(entryParticle); entryTerm = entryElementBinding; } return entryTerm; } private static interface ModelGroupFactory { ModelGroupBinding createSequence(SchemaBinding schema); } private static class DefaultModelGroupFactory implements ModelGroupFactory { final static DefaultModelGroupFactory INSTANCE = new DefaultModelGroupFactory(); public ModelGroupBinding createSequence(SchemaBinding schema) { return new SequenceBinding(schema); } } private static class UnorderedSequenceModelGroupFactory implements ModelGroupFactory { final static UnorderedSequenceModelGroupFactory INSTANCE = new UnorderedSequenceModelGroupFactory(); public ModelGroupBinding createSequence(SchemaBinding schema) { return new UnorderedSequenceBinding(schema); } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/QNameBuilder.java0000644000175000017500000000637210470642610027772 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb; import org.jboss.logging.Logger; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import javax.xml.namespace.QName; /** * A QName builder that discovers the namespaceURI for a given prefix by walking * up the document tree. * * The combined name is of the form [prefix:]localPart * * @author Thomas.Diesler@jboss.org * @version $Revision: 1958 $ */ public final class QNameBuilder { private static Logger log = Logger.getLogger(QNameBuilder.class); /** * Build a QName from a combined name * @param element The current element * @param combinedName A name of form prefix:localPart * @return A QName, or null */ public static QName buildQName(Element element, String combinedName) { if (combinedName == null) return null; int colonIndex = combinedName.indexOf(":"); if (colonIndex < 0) return new QName(combinedName); String prefix = combinedName.substring(0, colonIndex); String localPart = combinedName.substring(colonIndex + 1); Node currNode = element; String namespaceURI = getNamespaceURI(currNode, prefix); while (namespaceURI == null && currNode != null) { Node parentNode = currNode.getParentNode(); if (parentNode != null && parentNode != currNode) namespaceURI = getNamespaceURI(parentNode, prefix); if (parentNode == currNode) break; currNode = parentNode; } if (namespaceURI != null) return new QName(namespaceURI, localPart, prefix); log.warn("Cannot find namespaceURI for name: " + combinedName); return new QName(localPart); } /** * Get the namespaceURI from a given prefix from the current node. */ private static String getNamespaceURI(Node node, String prefix) { String namespaceURI = null; NamedNodeMap attrs = node.getAttributes(); if (attrs != null) { for (int i = 0; namespaceURI == null && i < attrs.getLength(); i++) { Node attr = attrs.item(i); if (("xmlns:" + prefix).equals(attr.getNodeName())) namespaceURI = attr.getNodeValue(); } } return namespaceURI; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/0000755000175000017500000000000011620316770026224 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/group/0000755000175000017500000000000011620316764027363 5ustar twernertwerner././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/group/ValueListHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/group/ValueListHandler.ja0000755000175000017500000004472611274325076033126 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.group; import java.lang.reflect.Constructor; import java.lang.reflect.Array; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.Map; import org.jboss.util.Classes; import org.jboss.xb.binding.GenericValueContainer; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.AttributeHandler; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; /** * @author Alexey Loubyansky * @version $Revision: 3634 $ */ public interface ValueListHandler { ValueListHandler IMMUTABLE = new ValueListHandler() { public Object newInstance(ParticleBinding particle, ValueList valueList) { Class cls = valueList.getTargetClass(); Map map = valueList.getNonRequiredValues(); Collection values = map.values(); if(values.isEmpty()) { throw new JBossXBRuntimeException("Value list does not contain non-required values."); } Constructor ctor = null; Constructor[] ctors = cls.getConstructors(); if(ctors == null || ctors.length == 0) { throw new JBossXBRuntimeException("The class has no declared constructors: " + cls); } for(int i = 0; i < ctors.length; ++i) { Class[] types = ctors[i].getParameterTypes(); if(types == null || types.length == 0) { throw new IllegalStateException("Found no-arg constructor for immutable " + cls); } if(types.length == map.size()) { ctor = ctors[i]; int typeInd = 0; Iterator iter = values.iterator(); while(iter.hasNext()) { Class type = types[typeInd++]; if(type.isPrimitive()) { type = Classes.getPrimitiveWrapper(type); } if(!type.isAssignableFrom(iter.next().getClass())) { ctor = null; break; } } if(ctor != null) { break; } } } if(ctor == null) { StringBuffer buf = new StringBuffer(); buf.append("There is no ctor in ") .append(cls) .append(" that would take the following arguments:\n"); int cnt = 0; for(Iterator i = values.iterator(); i.hasNext();) { Object o = i.next(); buf.append(' ').append(++cnt).append(") ").append(o.getClass()).append(": ").append(o).append('\n'); } throw new IllegalStateException(buf.toString()); } try { return ctor.newInstance(values.toArray()); } catch(Exception e) { throw new IllegalStateException("Failed to create immutable instance of " + cls + " using arguments: " + values + ": " + e.getMessage() ); } } }; ValueListHandler NON_DEFAULT_CTOR = new ValueListHandler() { public Object newInstance(ParticleBinding particle, ValueList valueList) { Class cls = valueList.getTargetClass(); int size = valueList.size(); if(size == 0) { try { return newInstance(cls.getConstructor(null), null); } catch(NoSuchMethodException e) { throw new JBossXBRuntimeException( "Value list does not contain non-required values and there is no no-arg ctor in " + cls ); } } Constructor ctor = matchBestCtor(cls, valueList); if(ctor == null) { StringBuffer buf = new StringBuffer(); buf.append("Failed to find no-arg ctor or best-match ctor in ") .append(cls) .append(", property values:\n"); int cnt = 0; for(int i = 0; i < size; ++i) { Object o = valueList.getValue(i).value; buf.append(' ').append(++cnt).append(") ").append(o).append('\n'); } throw new JBossXBRuntimeException(buf.toString()); } Object o; int argsTotal = ctor.getParameterTypes().length; if(argsTotal == size) { Object[] args = getArgs(ctor, valueList); o = newInstance(ctor, args); } else { Object[] args = getArgs(ctor, valueList); o = newInstance(ctor, args); int i = argsTotal; while(i < size) { ValueList.NonRequiredValue valueEntry = valueList.getValue(i++); Object binding = valueEntry.binding; if(binding instanceof ParticleBinding) { Object handler = valueEntry.handler; ParticleBinding childParticle = (ParticleBinding)binding; if(handler instanceof ParticleHandler) { ParticleHandler pHandler = (ParticleHandler)handler; if(childParticle.isRepeatable()) { TermBinding term = childParticle.getTerm(); /* Has to be commented for the NOOP RepeatableParticleHandler * if(!(o instanceof GenericValueContainer) && term.getAddMethodMetaData() == null && term.getMapEntryMetaData() == null && term.getPutMethodMetaData() == null) { pHandler.setParent(o, valueEntry.value, valueEntry.qName, childParticle, particle); } else */ { Collection col = (Collection)valueEntry.value; for(Iterator iter = col.iterator(); iter.hasNext();) { pHandler.setParent(o, iter.next(), valueEntry.qName, childParticle, particle); } } } else { pHandler.setParent(o, valueEntry.value, valueEntry.qName, childParticle, particle); } } else { ((CharactersHandler)handler).setValue(valueEntry.qName, (ElementBinding)childParticle.getTerm(), o, valueEntry.value ); } } else if(binding instanceof AttributeBinding) { AttributeBinding attr = (AttributeBinding)binding; AttributeHandler handler = attr.getHandler(); if(handler != null) { handler.attribute(valueEntry.qName, attr.getQName(), attr, o, valueEntry.value); } else { throw new JBossXBRuntimeException("Attribute binding present but has no handler: element=" + valueEntry.qName + ", attrinute=" + attr.getQName() ); } } else { throw new JBossXBRuntimeException("Unexpected binding type: " + binding); } } } return o; } private Constructor matchBestCtor(Class cls, ValueList valueList) { Constructor bestMatch = null; int bestMatchArgsTotal = 0; Constructor[] ctors = cls.getConstructors(); int size = valueList.size(); for(int i = 0; i < ctors.length; ++i) { Constructor ctor = ctors[i]; Class[] types = ctor.getParameterTypes(); if((types == null || types.length == 0) && bestMatch == null) { bestMatch = ctor; continue; } if(bestMatchArgsTotal <= types.length) { int typeInd = 0; for(int valueInd = 0; typeInd < types.length && valueInd < size; ++typeInd, ++valueInd) { Class type = types[typeInd]; if(type.isPrimitive()) { type = Classes.getPrimitiveWrapper(type); } ValueList.NonRequiredValue valueEntry = valueList.getValue(valueInd); Object value = valueEntry.value; if(value != null && !(type.isAssignableFrom(value.getClass()) || // if particle is repeatable and the type is array of a specific collection // then we assume we can convert the arg later at creation time // todo this code should be smarter valueEntry.binding instanceof ParticleBinding && ((ParticleBinding)valueEntry.binding).isRepeatable() && type.isArray() )) { break; } if(bestMatchArgsTotal == types.length && !bestMatch.getParameterTypes()[typeInd].isAssignableFrom(type)) { break; } } if(typeInd == types.length) { bestMatch = ctor; bestMatchArgsTotal = types.length; } } } return bestMatch; } private Object newInstance(Constructor bestMatch, Object[] args) { try { return bestMatch.newInstance(args); } catch(Exception e) { throw new JBossXBRuntimeException("Failed to create an instance of " + bestMatch.getDeclaringClass() + " using the following ctor arguments " + Arrays.asList(args), e ); } } private Object[] getArgs(Constructor ctor, ValueList valueList) { Class[] types = ctor.getParameterTypes(); Object[] args = new Object[types.length]; for(int i = 0; i < types.length; ++i) { ValueList.NonRequiredValue valueEntry = valueList.getValue(i); Object arg = valueEntry.value; if(valueEntry.value != null && !types[i].isAssignableFrom(arg.getClass())) { // if type is array then convert collection to array // todo this part should be smarter about collections if(types[i].isArray() && Collection.class.isAssignableFrom(arg.getClass())) { Collection col = (Collection)arg; arg = Array.newInstance(types[i].getComponentType(), col.size()); int arrInd = 0; for(Iterator iter = col.iterator(); iter.hasNext();) { Array.set(arg, arrInd++, iter.next()); } } } args[i] = arg; } return args; } }; class FACTORY { /** * Collects children and adds them all at the time the newInstance is called. * * @param parent the parent object * @return the parent object */ public static ValueListHandler lazy(final Object parent) { return new ValueListHandler() { private final ValueList parentValueList = parent instanceof ValueList ? (ValueList)parent : null; public Object newInstance(ParticleBinding particle, ValueList valueList) { for(int i = 0; i < valueList.size(); ++i) { ValueList.NonRequiredValue valueEntry = valueList.getValue(i); Object binding = valueEntry.binding; if(binding instanceof ParticleBinding) { Object handler = valueEntry.handler; ParticleBinding childParticle = (ParticleBinding)binding; if(handler instanceof ParticleHandler) { ParticleHandler pHandler = (ParticleHandler)handler; if(childParticle.isRepeatable()) { if(parentValueList != null) { parentValueList.addTermValue(valueEntry.qName, childParticle, pHandler, valueEntry.value, null); } else { Collection col = (Collection) valueEntry.value; //System.out.println("newInstance: " + childParticle.getTerm() + "=" + col); pHandler.setParent(parent, col, valueEntry.qName, childParticle, valueEntry.parentParticle); /* for (Iterator iter = col.iterator(); iter.hasNext();) { pHandler.setParent(parent, iter.next(), valueEntry.qName, childParticle, valueEntry.parentParticle); } */ } } else { if(parentValueList != null) { parentValueList.addTermValue(valueEntry.qName, childParticle, pHandler, valueEntry.value, valueEntry.parentParticle); } else { pHandler.setParent(parent, valueEntry.value, valueEntry.qName, childParticle, valueEntry.parentParticle); } } } else { CharactersHandler cHandler = (CharactersHandler)handler; if(parentValueList != null) { parentValueList.addTextValue(valueEntry.qName, childParticle, cHandler, valueEntry.value); } else { cHandler.setValue(valueEntry.qName, (ElementBinding) childParticle.getTerm(), parent, valueEntry.value); } } } else if(binding instanceof AttributeBinding) { AttributeBinding attr = (AttributeBinding)binding; AttributeHandler handler = attr.getHandler(); if(handler != null) { if(parentValueList != null) { parentValueList.setAttributeValue(attr.getQName(), attr, valueEntry.value); } else { handler.attribute(valueEntry.qName, attr.getQName(), attr, parent, valueEntry.value); } } else { throw new JBossXBRuntimeException("Attribute binding present but has no handler: element=" + valueEntry.qName + ", attrinute=" + attr.getQName() ); } } else { throw new JBossXBRuntimeException("Unexpected binding type: " + binding); } } return parent; } }; } public static ValueListHandler child() { return new ValueListHandler() { public Object newInstance(ParticleBinding particle, ValueList valueList) { if(valueList.size() > 1) { String msg = "Expected only one child for " + particle.getTerm() + " but got:"; for(int i = 0; i < valueList.size(); ++i) { ValueList.NonRequiredValue valueEntry = valueList.getValue(0); msg += " " + valueEntry.value + ";"; } throw new JBossXBRuntimeException(msg); } ValueList.NonRequiredValue valueEntry = valueList.getValue(0); return valueEntry.value; } }; } }; Object newInstance(ParticleBinding particle, ValueList valueList); } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/group/ValueListRepeatableParticleHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/group/ValueListRepeatable0000644000175000017500000001057611274325076033215 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.group; import java.util.ArrayList; import java.util.Collection; import javax.xml.namespace.QName; import org.jboss.xb.binding.GenericValueContainer; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.group.ValueList.NonRequiredValue; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.RepeatableParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; /** * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ValueListRepeatableParticleHandler implements RepeatableParticleHandler { public static final ValueListRepeatableParticleHandler INSTANCE = new ValueListRepeatableParticleHandler(); public Object startRepeatableParticle(Object parent, QName startName, ParticleBinding particle) { TermBinding term = particle.getTerm(); if(term.isSkip()) { return null; } if(parent != null && !(parent instanceof GenericValueContainer) && (parent instanceof Collection == false) && term.getAddMethodMetaData() == null && term.getMapEntryMetaData() == null && term.getPutMethodMetaData() == null) { ValueListHandler handler = ValueListHandler.FACTORY.lazy(parent); Class cls = parent.getClass(); return new ValueListInitializer().newValueList(handler, cls); } return null; } public void endRepeatableParticle(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { if (o == null) throw new IllegalArgumentException("Collection value is null for repeatable particle " + particle.getTerm()); ValueList valueList = (ValueList) o; if (valueList.size() == 0) return; if (particle.getTerm().isWildcard()) { ParticleHandler handler = null; // that's not good. some elements can be handled as "unresolved" and some as "resolved" QName qName = valueList.getValue(0).qName; Collection col = new ArrayList(); for (int i = 0; i < valueList.size(); ++i) { NonRequiredValue value = valueList.getValue(i); col.add(value.value); if (handler != value.handler) { if (handler == null && i == 0) { handler = (ParticleHandler) value.handler; } else { throw new JBossXBRuntimeException("Handlers in the list are supposed to be the same."); } } } handler.setParent(parent, col, qName, particle, parentParticle); } else { valueList.getHandler().newInstance(particle, valueList); } } public void addTermValue(Object particleValue, Object termValue, QName elementName, ParticleBinding particle, ParticleBinding parentParticle, ParticleHandler handler) { ValueList valueList = (ValueList)particleValue; valueList.getInitializer().addTermValue(elementName, particle, handler, valueList, termValue, parentParticle); } }libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/group/ValueList.java0000755000175000017500000001723111062060756032142 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.group; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtUtil; /** * @author Alexey Loubyansky * @version $Revision: 2917 $ */ public class ValueList { private final ValueListInitializer initializer; private final ValueListHandler handler; private final Class targetClass; //private final int requiredTotal; //private final Object[] requiredValues; //private int state; //private Map nonRequiredValues = Collections.EMPTY_MAP; //private List nonRequiredBindings; private List nonRequiredValues = Collections.EMPTY_LIST; ValueList(ValueListInitializer initializer, ValueListHandler handler, Class targetClass) { this.initializer = initializer; this.handler = handler; this.targetClass = targetClass; //this.requiredTotal = initializer.getRequiredBindings().size(); //requiredValues = new Object[requiredTotal]; } void setRequiredValue(int index, int stateIncrement, Object value) { throw new UnsupportedOperationException(); /* if(index >= requiredTotal) { throw new JBossXBRuntimeException( "Maximum argument index for this value list is " + requiredTotal + " but got " + index ); } requiredValues[index] = value; state += stateIncrement; */ } Object getRequiredValue(int index) { /* if(index >= requiredTotal) { throw new JBossXBRuntimeException( "Maximum argument index for this value list is " + requiredTotal + " but got " + index ); } return requiredValues[index]; */ throw new UnsupportedOperationException(); } int getState() { // return state; throw new UnsupportedOperationException(); } void setAttributeValue(QName qName, AttributeBinding binding, Object value) { setNonRequiredValue(qName, binding, null, value, null); } void addTextValue(QName qName, ParticleBinding particle, CharactersHandler handler, Object value) { setNonRequiredValue(qName, particle, handler, value, null); } void addTermValue(QName qName, ParticleBinding binding, Object handler, Object value, ParticleBinding parentParticle) { setNonRequiredValue(qName, binding, handler, value, parentParticle); } void addRepeatableTermValue(QName qName, ParticleBinding binding, Object handler, Object value, ParticleBinding parentParticle) { NonRequiredValue last = (NonRequiredValue) (nonRequiredValues.isEmpty() ? null : nonRequiredValues.get(nonRequiredValues.size() - 1)); boolean isSameBinding; if(last == null) isSameBinding = false; else if(last.binding == binding) isSameBinding = true; else if(!(last.binding instanceof ParticleBinding)) isSameBinding = false; else { ParticleBinding lastBinding = (ParticleBinding) last.binding; if(lastBinding.getTerm().isElement() && binding.getTerm().isElement()) isSameBinding = ((ElementBinding)lastBinding.getTerm()).getQName().equals(((ElementBinding)binding.getTerm()).getQName()); else isSameBinding = false; } if (!isSameBinding) { Collection col; PropertyMetaData propMetaData = binding.getTerm().getPropertyMetaData(); if(propMetaData != null && propMetaData.getCollectionType() != null) { Class colCls = RtUtil.loadClass(propMetaData.getCollectionType(), true); try { col = (Collection) colCls.newInstance(); } catch (Exception e) { throw new JBossXBRuntimeException("Failed to create an instance of " + colCls.getName() + " for property " + propMetaData.getName()); } } else { col = new ArrayList(); } col.add(value); setNonRequiredValue(qName, binding, handler, col, parentParticle); } else { Collection col = (Collection) last.value; col.add(value); } } void setNonRequiredValue(QName qName, Object binding, Object handler, Object value, ParticleBinding parentParticle) { NonRequiredValue val = new NonRequiredValue(qName, binding, handler, value, parentParticle); switch(nonRequiredValues.size()) { case 0: nonRequiredValues = Collections.singletonList(val); break; case 1: nonRequiredValues = new ArrayList(nonRequiredValues); default: nonRequiredValues.add(val); } } Object getNonRequiredValue(QName qName) { // return nonRequiredValues.get(qName); throw new UnsupportedOperationException(); } public ValueListInitializer getInitializer() { return initializer; } public List getRequiredValues() { // return Arrays.asList(requiredValues); throw new UnsupportedOperationException(); } public Map getNonRequiredValues() { // return nonRequiredValues; throw new UnsupportedOperationException(); } public List getNonRequiredBindings() { // return nonRequiredBindings; throw new UnsupportedOperationException(); } public ValueListHandler getHandler() { return handler; } public Class getTargetClass() { return targetClass; } public NonRequiredValue getValue(int i) { return (NonRequiredValue)nonRequiredValues.get(i); } public int size() { return nonRequiredValues.size(); } public static final class NonRequiredValue { public final QName qName; public final Object binding; public final Object handler; public Object value; public ParticleBinding parentParticle; public NonRequiredValue(QName qName, Object binding, Object handler, Object value, ParticleBinding parentParticle) { this.qName = qName; this.binding = binding; this.handler = handler; this.value = value; this.parentParticle = parentParticle; } } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/group/ValueListInitializer.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/group/ValueListInitialize0000755000175000017500000001375611061473704033254 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.group; import java.util.Map; import java.util.Collections; import java.util.List; import javax.xml.namespace.QName; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; /** * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class ValueListInitializer { //private int initializedState; private Map attrIndex = Collections.EMPTY_MAP; private Map elemIndex = Collections.EMPTY_MAP; //private List requiredBindings = Collections.EMPTY_LIST; public void addRequiredAttribute(QName qName, AttributeBinding binding) { /* Integer index = new Integer(requiredBindings.size()); switch(attrIndex.size()) { case 0: attrIndex = Collections.singletonMap(qName, index); break; case 1: attrIndex = new HashMap(attrIndex); default: attrIndex.put(qName, index); } addBinding(binding); initializedState += Math.abs(qName.hashCode()); */ throw new UnsupportedOperationException(); } public void addRequiredElement(QName qName, ElementBinding binding) { /* Integer index = new Integer(requiredBindings.size()); switch(elemIndex.size()) { case 0: elemIndex = Collections.singletonMap(qName, index); break; case 1: elemIndex = new HashMap(elemIndex); default: elemIndex.put(qName, index); } addBinding(binding); initializedState += Math.abs(qName.hashCode()); */ throw new UnsupportedOperationException(); } public ValueList newValueList(ValueListHandler handler, Class targetClass) { return new ValueList(this, handler, targetClass); } public void addAttributeValue(QName qName, AttributeBinding binding, ValueList valueList, Object value) { Integer index = (Integer)attrIndex.get(qName); if(index == null) { valueList.setAttributeValue(qName, binding, value); } else { if(isInitialized(valueList)) { throw new JBossXBRuntimeException("The value list has already been initialized!"); } valueList.setRequiredValue(index.intValue(), qName.hashCode(), value); } } public void addTextValue(QName qName, ParticleBinding particle, CharactersHandler handler, ValueList valueList, Object value) { valueList.addTextValue(qName, particle, handler, value); } public void addTermValue(QName qName, ParticleBinding binding, Object handler, ValueList valueList, Object value, ParticleBinding parentParticle) { Integer index = (Integer)elemIndex.get(qName); if(index == null) { if(binding.isRepeatable()) { valueList.addRepeatableTermValue(qName, binding, handler, value, parentParticle); } else { valueList.addTermValue(qName, binding, handler, value, parentParticle); } } else { if(isInitialized(valueList)) { throw new JBossXBRuntimeException("The value list has already been initialized!"); } valueList.setRequiredValue(index.intValue(), qName.hashCode(), value); } } public boolean isInitialized(ValueList valueList) { // return requiredBindings.size() == 0 || initializedState == valueList.getState(); throw new UnsupportedOperationException(); } public Object getAttributeValue(QName qName, ValueList valueList) { /* Object value; Integer index = (Integer)attrIndex.get(qName); if(index == null) { value = valueList.getNonRequiredValue(qName); } else { value = valueList.getRequiredValue(index.intValue()); } return value; */ throw new UnsupportedOperationException(); } public Object getElementValue(QName qName, ValueList valueList) { /* Object value; Integer index = (Integer)elemIndex.get(qName); if(index == null) { value = valueList.getNonRequiredValue(qName); } else { value = valueList.getRequiredValue(index.intValue()); } return value; */ throw new UnsupportedOperationException(); } public List getRequiredBindings() { // return requiredBindings; throw new UnsupportedOperationException(); } // Private /* private void addBinding(Object binding) { if(requiredBindings == Collections.EMPTY_LIST) { requiredBindings = new ArrayList(); } requiredBindings.add(binding); } */} libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/UnmarshallerFactory.java0000644000175000017500000001134111477212467033064 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import java.util.Map; import java.util.HashMap; import java.util.Iterator; import org.jboss.xb.binding.parser.JBossXBParser; /** * @author Alexey Loubyansky * @version $Revision: 4874 $ */ public abstract class UnmarshallerFactory { protected Map features; protected Boolean validation; protected Boolean namespaces; protected Boolean warnOnParserErrors; public static UnmarshallerFactory newInstance() { return new UnmarshallerFactoryImpl(); } public abstract Unmarshaller newUnmarshaller(); public void setFeature(String name, Object value) { Boolean bValue; if(value == null) { bValue = null; } else if(value instanceof String) { bValue = Boolean.valueOf((String)value); } else if(value instanceof Boolean) { bValue = (Boolean)value; } else { throw new JBossXBRuntimeException( "Allowed feature values are null, 'true, 'false', Boolean.TRUE, Boolean.FALSE. Passed in value: " + value ); } if(Unmarshaller.VALIDATION.equals(name)) { validation = bValue; } else if(Unmarshaller.NAMESPACES.equals(name)) { namespaces = bValue; } else { if(features == null) { features = new HashMap(); } features.put(name, value); } } /** * This property controls whether the (underlying) parser errors should be * logged as warnings or should they terminate parsing with errors. */ public void setWarnOnParserErrors(boolean value) { this.warnOnParserErrors = value; } /** * This property controls whether the (underlying) parser errors should be * logged as warnings or should they terminate parsing with errors. * The default is to terminate parsing by re-throwing parser errors. * * @return false if parser errors should be logged as warnings, otherwise - true */ public boolean isWarnOnParserErrors() { return warnOnParserErrors == null ? false : warnOnParserErrors; } // Inner static class UnmarshallerFactoryImpl extends UnmarshallerFactory { public Unmarshaller newUnmarshaller() { UnmarshallerImpl unmarshaller; try { unmarshaller = new UnmarshallerImpl(); } catch(JBossXBException e) { throw new JBossXBRuntimeException(e.getMessage(), e); } JBossXBParser parser = unmarshaller.getParser(); if(validation != null) parser.setFeature(Unmarshaller.VALIDATION, validation.booleanValue()); if(namespaces != null) parser.setFeature(Unmarshaller.NAMESPACES, namespaces.booleanValue()); if(features != null) { for(Iterator i = features.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry)i.next(); if(entry.getValue() != null) { Boolean value = (Boolean)entry.getValue(); parser.setFeature((String)entry.getKey(), value.booleanValue()); } } } //parser.setFeature(Unmarshaller.SCHEMA_VALIDATION, true); //parser.setFeature(Unmarshaller.SCHEMA_FULL_CHECKING, true); try { parser.setFeature(Unmarshaller.DYNAMIC_VALIDATION, true); } catch(JBossXBRuntimeException e) { // dynamic_validation is a required xerces-specific feature } return unmarshaller; } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/resolver/0000755000175000017500000000000011620316770030065 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/resolver/MutableSchemaResolver.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/resolver/MutableSchemaRes0000644000175000017500000002020311225350072033163 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.resolver; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingInitializer; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; /** * A MutableSchemaResolver. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public interface MutableSchemaResolver extends SchemaBindingResolver { /** * @return true if resolved SchemaBinding's are cached, false otherwise */ boolean isCacheResolvedSchemas(); /** * If the implementation supports caching of the resolved schema bindings then * passing in true will enable caching. * False will (possibly) flush the cache and make the schema resolver resolve schemas * on each request. * * @param cacheResolvedSchemas cache resolved schemas flag */ void setCacheResolvedSchemas(boolean cacheResolvedSchemas); /** * Registers a location for the namespace URI.

* * The location may be a classpath location if the implementation supports searching in the classpath * (e.g. using JBossEntityResolver) * * @param nsUri the namespace URI * @param location the schema location */ void mapSchemaLocation(String nsUri, String location); /** * Removes a location for the namespace URI. * * @param nsUri the namespace location */ void removeSchemaLocation(String nsUri); /** * Whether to parse XSD annotations for this namespace. * * @param nsUri the namespace * @param value the value of the option */ void setParseXSDAnnotations(String nsUri, boolean value); /** * Clears the flag to parse XSD annotations for the namespace URI. * The default setting for parsing XSD annotations will be applied to this namespace URI after this method is called. * * @param nsURI the namespace URI * @return the value previously set or null, if no value was set for this namespace URI */ Boolean unsetParseXSDAnnotations(String nsURI); /** * Registers a SchemaBindingInitializer for the namespace URI. * When the schema binding that corresponds to the namespace URI * is resolved, the init(SchemaBinding schema) method will be invoked on the * instance of SchemaBindingInitializer with the SchemaBinding returned from the * XsdBinder.bind() method. * * @param nsUri the namespace URI to register the schema initializer for * @param sbiClassName the class name SchemaBindingInitializer * @throws Exception for any error */ void mapSchemaInitializer(String nsUri, String sbiClassName) throws Exception; /** * Registers an instance of SchemaBindingInitializer for the namespace URI. * When the schema binding that corresponds to the namespace URI * is resolved, the init(SchemaBinding schema) method will be invoked on the * instance of SchemaBindingInitializer with the SchemaBinding returned from the * XsdBinder.bind() method. * * @param nsUri the namespace URI to register the schema initializer for * @param sbi an instance of SchemaBindingInitializer */ void mapSchemaInitializer(String nsUri, SchemaBindingInitializer sbi); /** * Unregisters and returns the SchemaBindingInitializer for the namespace URI. * @param nsUri the namespace URI to unregister SchemaBindingInitializer for * @return unregistered SchemaBindingInitializer for the namespace URI or null * if there was no SchemaBindingInitialzer registered for the namespace URI */ SchemaBindingInitializer removeSchemaInitializer(String nsUri); /** * Maps a namespace URI to a class which will be used as the base for the SchemaBinding. * * @param nsUri the namespace URI * @param reference fully qualified class name to build the SchemaBinding from * @throws ClassNotFoundException if the reference cannot be loaded */ void mapURIToClass(String nsUri, String reference) throws ClassNotFoundException; /** * Maps a namespace URI to a class which will be used as the base for the SchemaBinding. * * @param nsUri the namespace URI * @param clazz class to build the SchemaBinding from */ void mapURIToClass(String nsUri, Class clazz); /** * Maps a namespace URI to an array of classes that will be used as the base for the SchemaBinding. * * @param nsUri the namespace URI * @param reference array of fully qualified class names to build the SchemaBinding from * @throws ClassNotFoundException if at least one of the references cannot be loaded */ void mapURIToClasses(String nsUri, String... reference) throws ClassNotFoundException; /** * Maps a namespace URI to an array of classes that will be used as the base for the SchemaBinding. * * @param nsUri the namespace URI * @param reference array of classes to build the SchemaBinding from */ void mapURIToClasses(String nsUri, Class... clazz); /** * Removes namespace URI to class mapping * * @param nsUri the namespace URI to unmap * @return classes mapped to the namespace URI or null if the URI was not mapped. */ Class[] removeURIToClassMapping(String nsUri); /** * Maps schema location to a class which should be used as the base for the SchemaBinding. * * @param schemaLocation the location of the schema * @param reference the fully qualified class name to build the SchemaBinding from * @throws ClassNotFoundException if the reference cannot be loaded */ void mapLocationToClass(String schemaLocation, String reference) throws ClassNotFoundException; /** * Maps schema location to a class which should be used as the base for the SchemaBinding. * * @param schemaLocation the location of the schema * @param clazz the class to build the SchemaBinding from */ void mapLocationToClass(String schemaLocation, Class clazz); /** * Maps schema location to an array of classes that should be used as the base for the SchemaBinding. * * @param schemaLocation the location of the schema * @param reference the array of fully qualified class names to build the SchemaBinding from * @throws ClassNotFoundException if at least one of the references cannot be loaded */ void mapLocationToClasses(String schemaLocation, String... reference) throws ClassNotFoundException; /** * Maps schema location to an array of classes that should be used as the base for the SchemaBinding. * * @param schemaLocation the location of the schema * @param classes the array of classes to build the SchemaBinding from */ void mapLocationToClasses(String schemaLocation, Class... classes); /** * Removes schema location to class mapping. * * @param schemaLocation the schema location * @return the array of classes used to build the SchemaBinding or null, if the schema location wasn't mapped. */ Class[] removeLocationToClassMapping(String schemaLocation); } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/resolver/MultiClassSchemaResolver.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/resolver/MultiClassSchema0000644000175000017500000001126211477442270033220 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.resolver; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.util.xml.JBossEntityResolver; /** * A default SchemaBindingResolver that uses a JBossEntityResolver to locate * the schema xsd. * * @author Scott.Stark@jboss.org * @author alex@jboss.org * @version $Revision: 2913 $ */ public class MultiClassSchemaResolver extends AbstractMutableSchemaResolver { private static Logger log = Logger.getLogger(MultiClassSchemaResolver.class); /** Namespace to JBossXBBuilder binding class */ private Map[]> uriToClass = new HashMap[]>(); /** SchemaLocation to JBossXBBuilder binding class */ private Map[]> schemaLocationToClass = new HashMap[]>(); private Map[]> qNameToClass; public MultiClassSchemaResolver() { super(log); } public MultiClassSchemaResolver(JBossEntityResolver resolver) { super(log, resolver); } @Override protected Class[] getClassesForSchemaLocation(String uri) { return schemaLocationToClass.get(uri); } @Override protected Class[] getClassesForURI(String uri) { return uriToClass.get(uri); } public void mapLocationToClass(String schemaLocation, Class clazz) { if(schemaLocation == null) throw new IllegalArgumentException("schemaLocation is null"); if(clazz == null) throw new IllegalArgumentException("clazz is null"); schemaLocationToClass.put(schemaLocation, new Class[]{clazz}); } public void mapLocationToClasses(String schemaLocation, Class... classes) { if(schemaLocation == null) throw new IllegalArgumentException("schemaLocation is null"); if(classes == null) throw new IllegalArgumentException("classes is null"); schemaLocationToClass.put(schemaLocation, classes); } public void mapURIToClass(String nsUri, Class clazz) { if(nsUri == null) throw new IllegalArgumentException("nsUri is null"); if(clazz == null) throw new IllegalArgumentException("clazz is null"); uriToClass.put(nsUri, new Class[]{clazz}); } public void mapURIToClasses(String nsUri, Class... classes) { if(nsUri == null) throw new IllegalArgumentException("schemaLocation is null"); if(classes == null) throw new IllegalArgumentException("classes is null"); uriToClass.put(nsUri, classes); } public Class[] removeLocationToClassMapping(String schemaLocation) { return schemaLocationToClass.remove(schemaLocation); } public Class[] removeURIToClassMapping(String nsUri) { return uriToClass.remove(nsUri); } @Override protected Class[] getClassesForQName(QName elementName) { if(qNameToClass == null) return null; return qNameToClass.get(elementName); } public void mapQNameToClasses(QName elementName, Class... classes) { if(elementName == null) throw new IllegalArgumentException("QName can't be null."); if(classes == null) throw new IllegalArgumentException("Classes can't be null."); if(qNameToClass == null) qNameToClass = new HashMap[]>(); qNameToClass.put(elementName, classes); } public Class[] removeQNameToClassMapping(QName elementName) { if(qNameToClass == null) return null; return qNameToClass.remove(elementName); } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/resolver/MutableSchemaResolverWithQNameMapping.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/resolver/MutableSchemaRes0000644000175000017500000000365011453330564033201 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.resolver; import javax.xml.namespace.QName; /** * A MutableSchemaResolverWithQNameMapping. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public interface MutableSchemaResolverWithQNameMapping extends MutableSchemaResolver { /** * Maps element name to an array of classes that should be used as the base for the SchemaBinding. * * @param elementName the name of the root element * @param classes the array of classes to build the SchemaBinding from */ void mapQNameToClasses(QName elementName, Class... classes); /** * Removes element name to class mapping. * * @param elementName the root element name * @return the array of classes used to build the SchemaBinding or null, if the schema location wasn't mapped. */ Class[] removeQNameToClassMapping(QName elementName); } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/resolver/AbstractMutableSchemaResolver.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/resolver/AbstractMutableS0000644000175000017500000005076611453330564033227 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.resolver; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.util.xml.JBossEntityResolver; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.sunday.unmarshalling.LSInputAdaptor; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingInitializer; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder; import org.jboss.xb.builder.JBossXBBuilder; import org.jboss.xb.util.DefaultSchemaBindingValidator; import org.jboss.xb.util.SchemaBindingValidator; import org.w3c.dom.ls.LSInput; import org.xml.sax.InputSource; /** * A AbstractMutableSchemaResolver. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public abstract class AbstractMutableSchemaResolver implements MutableSchemaResolverWithQNameMapping { private Logger log; private String baseURI; private JBossEntityResolver resolver; private boolean cacheResolvedSchemas = true; /** Namespace to SchemaBinding cache */ private Map schemasByUri = Collections.emptyMap(); /** Namespace to processAnnotations flag used with the XsdBinder.bind call */ private Map schemaParseAnnotationsByUri = Collections.emptyMap(); private Map schemaInitByUri = Collections.emptyMap(); private boolean validateBinding = false; private SchemaBindingValidator validator; protected AbstractMutableSchemaResolver(Logger log) { this(log, new JBossEntityResolver()); } protected AbstractMutableSchemaResolver(Logger log, JBossEntityResolver resolver) { if(log == null) throw new IllegalArgumentException("Logger is null!"); this.log = log; this.resolver = resolver; } /** * Checks whether SchemaBinding instances built from JAXB/JBossXB annotations should be validated * for structural consistency with the corresponding XSD. * By default the validation is turned off for performance reasons. * * @return true is validation is on. */ public boolean isValidateBinding() { return validateBinding; } /** * Enables/disables validation of SchemaBinding instances built from JAXB/JBossXB annotations * against the corresponding XSD schemas. * * @param validateBinding validate binding flag */ public void setValidateBinding(boolean validateBinding) { this.validateBinding = validateBinding; } /** * Returns the validator which is used to validate SchemaBinding instances if validation is enabled. * By default validator is not initialized. And if validation is enabled a new instance of SchemaBindingValidator * will be created and used for validation for every new SchemaBinding. * * @return user provided instance of SchemaBindingValidator or null if the user chose not too provide one */ public SchemaBindingValidator getBindingValidator() { return validator; } /** * Sets the validator which should be used to validate SchemaBinding instances built from JAXB/JBossXB annotations * if validation is enabled. * By default validator is not initialized. And if validation is enabled a new instance of DefaultSchemaBindingValidator * will be created and used for validation for every new SchemaBinding. * * @param validator the schema binding validator */ public void setBindingValidator(SchemaBindingValidator validator) { this.validator = validator; } public boolean isCacheResolvedSchemas() { return cacheResolvedSchemas; } /** * Passing in true will make the schema resolver to cache successfully resolved * schemas (which is the default) with namespace URI being the identifier of a schema. * False will flush the cache and make the schema resolver to resolve schemas * on each request. * * @param cacheResolvedSchemas do we cache resolved schemas */ public void setCacheResolvedSchemas(boolean cacheResolvedSchemas) { this.cacheResolvedSchemas = cacheResolvedSchemas; if(cacheResolvedSchemas == false) { schemasByUri = Collections.emptyMap(); } } /** * Registers a location for the namespace URI.

* * This location is looked using the JBossEntityResolver, i.e. it is a classpath location * * @param nsUri the namespace location * @param location the classpath location */ public void mapSchemaLocation(String nsUri, String location) { resolver.registerLocalEntity(nsUri, location); } /** * Removes a location for the namespace URI. * * @todo actually remove it rather than setting null * @param nsUri the namespace location */ public void removeSchemaLocation(String nsUri) { resolver.registerLocalEntity(nsUri, null); } /** * Whether to parse annotations for this namespace. * * @param nsUri the namespace * @param value the value of the option */ public void setParseXSDAnnotations(String nsUri, boolean value) { if (nsUri == null) throw new IllegalArgumentException("Null namespace uri"); switch(schemaParseAnnotationsByUri.size()) { case 0: schemaParseAnnotationsByUri = Collections.singletonMap(nsUri, value); break; case 1: schemaParseAnnotationsByUri = new HashMap(schemaParseAnnotationsByUri); default: schemaParseAnnotationsByUri.put(nsUri, value); } } public Boolean unsetParseXSDAnnotations(String nsURI) { if (nsURI == null) throw new IllegalArgumentException("Null namespace uri"); return schemaParseAnnotationsByUri.remove(nsURI); } /** * Registers a SchemaBindingInitializer for the namespace URI. * When the schema binding that corresponds to the namespace URI * is resolved, the init(SchemaBinding schema) method will be invoked on the * instance of SchemaBindingInitializer with the SchemaBinding returned from the * XsdBinder.bind() method. * * @param nsUri the namespace URI to register the schema initializer for * @param sbiClassName the class name SchemaBindingInitializer * @throws Exception for any error */ public void mapSchemaInitializer(String nsUri, String sbiClassName) throws Exception { Class clazz = loadReference(sbiClassName); Object object = clazz.newInstance(); if (object instanceof SchemaBindingInitializer == false) throw new IllegalArgumentException(clazz.getName() + " is not an instance of " + SchemaBindingInitializer.class.getName()); SchemaBindingInitializer sbi = (SchemaBindingInitializer) object; mapSchemaInitializer(nsUri, sbi); } /** * Registers an instance of SchemaBindingInitializer for the namespace URI. * When the schema binding that corresponds to the namespace URI * is resolved, the init(SchemaBinding schema) method will be invoked on the * instance of SchemaBindingInitializer with the SchemaBinding returned from the * XsdBinder.bind() method. * * @param nsUri the namespace URI to register the schema initializer for * @param sbi an instance of SchemaBindingInitializer */ public void mapSchemaInitializer(String nsUri, SchemaBindingInitializer sbi) { if (nsUri == null) throw new IllegalArgumentException("Null namespace uri"); if (sbi == null) throw new IllegalArgumentException("Null schema binding initializer"); switch(schemaInitByUri.size()) { case 0: schemaInitByUri = Collections.singletonMap(nsUri, sbi); break; case 1: schemaInitByUri = new HashMap(schemaInitByUri); default: schemaInitByUri.put(nsUri, sbi); } } /** * Unregisters and returns the SchemaBindingInitializer for the namespace URI. * @param nsUri the namespace URI to unregister SchemaBindingInitializer for * @return unregistered SchemaBindingInitializer for the namespace URI or null * if there was no SchemaBindingInitialzer registered for the namespace URI */ public SchemaBindingInitializer removeSchemaInitializer(String nsUri) { if (nsUri == null) throw new IllegalArgumentException("Null namespace uri"); return schemaInitByUri.remove(nsUri); } public String getBaseURI() { return baseURI; } public void setBaseURI(String baseURI) { this.baseURI = baseURI; } /** * Uses the JBossEntityResolver.resolveEntity by: * * 1. Using the nsUri as the systemID * 2. Using the schemaLocation as the systemID * 3. If that fails, the baseURI is not null, the xsd is located using URL(baseURL, schemaLocation) * 4. If the baseURI is null, the xsd is located using URL(schemaLocation) */ public SchemaBinding resolve(String nsURI, String localName, String schemaLocation) { boolean trace = log.isTraceEnabled(); // Was the schema binding based on the nsURI boolean foundByNS = false; SchemaBinding schema = schemasByUri.get(nsURI); if(schema != null) { if(trace) log.trace("resolved cached schema, nsURI="+nsURI+", schema: " + schema); return schema; } Class[] classes = null; if(localName != null) classes = getClassesForQName(new QName(nsURI, localName)); // Look for a class binding by schemaLocation if(classes == null) classes = resolveClassFromSchemaLocation(schemaLocation, trace); if (classes == null) { // Next look by namespace classes = getClassesForURI(nsURI); if(classes != null) foundByNS = true; } if (classes != null) { if( trace ) { log.trace("found bindingClass, nsURI=" + nsURI + ", localName=" + localName + ", schemaLocation=" + schemaLocation + ", classes=" + Arrays.asList(classes)); } schema = JBossXBBuilder.build(classes); } else { // Parse the schema InputSource is = getInputSource(nsURI, null, schemaLocation); if( trace ) { String msg = (is == null ? "couldn't find" : "found") + " schema InputSource, nsURI=" + nsURI + ", localName=" + localName + ", schemaLocation=" + schemaLocation; log.trace(msg); } if (is != null) { Boolean processAnnotationsBoolean = schemaParseAnnotationsByUri.get(nsURI); boolean processAnnotations = (processAnnotationsBoolean == null) || processAnnotationsBoolean; try { schema = XsdBinder.bind(is.getByteStream(), null, this.baseURI, processAnnotations); foundByNS = true; } catch(RuntimeException e) { String msg = "Failed to parse schema for nsURI="+nsURI +", localName="+localName +", schemaLocation="+schemaLocation; throw new JBossXBRuntimeException(msg, e); } } } if(schema != null) { schema.setSchemaResolver(this); SchemaBindingInitializer sbi = schemaInitByUri.get(nsURI); if(sbi != null) schema = sbi.init(schema); if(schema != null && nsURI.length() > 0 && cacheResolvedSchemas && foundByNS) { if(schemasByUri.isEmpty()) schemasByUri = new HashMap(); schemasByUri.put(nsURI, schema); } } if(trace) log.trace("resolved schema: " + schema); // validate binding built from Java annotations // to avoid recursions the validation is done after the schema binding is cached if(classes != null) { if(validateBinding) { InputSource is = getInputSource(nsURI, null, schemaLocation); if(is != null) { SchemaBindingValidator validator = this.validator; if(validator == null) validator = new DefaultSchemaBindingValidator(this); try { validator.validate(is, schema); } catch(RuntimeException rt) { // don't cache invalid schema schemasByUri.remove(nsURI); throw rt; } } else log.warn("schema binding validation is on but skipped since XSD nsURI=" + nsURI + ", schemaLocation=" + schemaLocation + " could not be found."); } } return schema; } public void mapURIToClass(String nsUri, String reference) throws ClassNotFoundException { mapURIToClass(nsUri, loadReference(reference)); } public void mapURIToClasses(String nsUri, String... reference) throws ClassNotFoundException { Class[] classes = new Class[reference.length]; int i = 0; for(String ref : reference) classes[i++] = loadReference(ref); mapURIToClasses(nsUri, classes); } public void mapLocationToClass(String schemaLocation, String reference) throws ClassNotFoundException { mapLocationToClass(schemaLocation, loadReference(reference)); } public void mapLocationToClasses(String schemaLocation, String... reference) throws ClassNotFoundException { Class[] classes = new Class[reference.length]; int i = 0; for(String ref : reference) classes[i++] = loadReference(ref); mapLocationToClasses(schemaLocation, classes); } protected Class loadReference(String sbiClassName) throws ClassNotFoundException { if (sbiClassName == null) throw new IllegalArgumentException("Null class name"); return Thread.currentThread().getContextClassLoader().loadClass(sbiClassName); } /** * Lookup a binding class by schemaLocation. This first uses the * schemaLocation as is, then parses this as a URI to obtain the * final path component. This allows registration of a binding class * using jboss_5_0.dtd rather than http://www.jboss.org/j2ee/schema/jboss_5_0.xsd * * @param schemaLocation the schema location from the parser * @param trace - logging trace flag * @return the binding class if found. */ protected Class[] resolveClassFromSchemaLocation(String schemaLocation, boolean trace) { Class[] classes = getClassesForSchemaLocation(schemaLocation); if (classes == null && schemaLocation != null && schemaLocation.length() > 0) { // Parse the schemaLocation as a uri to get the final path component try { URI url = new URI(schemaLocation); String path = url.getPath(); if( path == null ) path = url.getSchemeSpecificPart(); int slash = path.lastIndexOf('/'); String filename; if( slash >= 0 ) filename = path.substring(slash + 1); else filename = path; if(path.length() == 0) return null; if (trace) log.trace("Mapped schemaLocation to filename: " + filename); classes = getClassesForSchemaLocation(filename); } catch (URISyntaxException e) { if (trace) log.trace("schemaLocation: is not a URI, using systemId as resource", e); } } return classes; } public LSInput resolveAsLSInput(String nsURI, String baseURI, String schemaLocation) { LSInput lsInput = null; InputSource is = getInputSource(nsURI, baseURI, schemaLocation); if (is != null) { String publicId = is.getPublicId(); String systemId = is.getSystemId(); lsInput = new LSInputAdaptor(publicId, systemId, baseURI); lsInput.setCharacterStream(is.getCharacterStream()); lsInput.setByteStream(is.getByteStream()); lsInput.setEncoding(is.getEncoding()); } return lsInput; } private InputSource getInputSource(String nsURI, String baseURI, String schemaLocation) { boolean trace = log.isTraceEnabled(); InputSource is = null; if( trace ) log.trace("getInputSource, nsURI="+nsURI+", baseURI="+baseURI+", schemaLocation="+schemaLocation); // First try what is requested try { is = resolver.resolveEntity(nsURI, schemaLocation); if (trace) { String msg = (is == null ? "Couldn't resolve" : "Resolved") + " schema using namespace as publicId and schemaLocation as systemId"; log.trace(msg); } } catch (Exception e) { if (trace) log.trace("Failed to use nsUri/schemaLocation", e); } // Next, try to use the baseURI to resolve the schema location if(baseURI == null) { baseURI = this.baseURI; } if (is == null && baseURI != null && schemaLocation != null) { try { URL url = new URL(baseURI); url = new URL(url, schemaLocation); String resolvedSchemaLocation = url.toString(); // No point if the schema location was already absolute if (schemaLocation.equals(resolvedSchemaLocation) == false) { is = resolver.resolveEntity(null, url.toString()); if( trace && is != null ) log.trace("Resolved schema location using baseURI"); } } catch (Exception e) { if (trace) log.trace("Failed to use schema location with baseURI", e); } } // Finally, just try the namespace as the system id if (is == null && nsURI != null) { try { is = resolver.resolveEntity(null, nsURI); if( trace && is != null ) log.trace("Resolved namespace as system id"); } catch (Exception e) { if (trace) log.trace("Failed to use namespace as system id", e); } } if( trace ) { log.trace("getInputSource, nsURI="+nsURI+", baseURI=" +baseURI+", schemaLocation="+schemaLocation+", is="+is); } return is; } protected abstract Class[] getClassesForURI(String uri); protected abstract Class[] getClassesForSchemaLocation(String uri); protected abstract Class[] getClassesForQName(QName elementName); } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/introspection/0000755000175000017500000000000011620316770031124 5ustar twernertwerner././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/introspection/ClassInfos.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/introspection/ClassInfos.0000644000175000017500000001266011061473704033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.introspection; import java.util.Map; import java.util.WeakHashMap; import java.util.concurrent.ConcurrentHashMap; import java.lang.ref.WeakReference; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.util.NoopMap; /** * @author Alexey Loubyansky * @version $Revision: $ */ public class ClassInfos { private static final Map>> NO_CACHE = new NoopMap>>(); private static Map>> classloaderCache = new WeakHashMap>>(); /** * Disables caching of ClassInfo's. Already cached ClassInfo's will be lost after * the method returns. */ public static void disableCache() { synchronized(classloaderCache) { classloaderCache = NO_CACHE; } } /** * Enables caching of ClassInfo's unless caching is already enabled. */ public static void enableCache() { synchronized(classloaderCache) { if(!isCacheEnabled()) { classloaderCache = new WeakHashMap>>(); } } } /** * @return true if caching is enabled, false otherwise. */ public static boolean isCacheEnabled() { synchronized(classloaderCache) { return classloaderCache != NO_CACHE; } } /** * Flushes all the cached ClassInfo's. */ public static void flushCache() { synchronized(classloaderCache) { classloaderCache.clear(); } } /** * Evicts ClassInfo for a specific class. * @param cls fully qualified class name of the class */ public static void flushCache(String cls) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); Map> classLoaderCache = getClassLoaderCache(cl); classLoaderCache.remove(cls); } /** * Evicts ClassInfo for a specific class. * @param cls the class to remove the ClassInfo for */ public static void flushCache(Class cls) { Map> classLoaderCache = getClassLoaderCache(cls.getClassLoader()); classLoaderCache.remove(cls.getName()); } public static ClassInfo getClassInfo(Class cls) { Map> classLoaderCache = getClassLoaderCache(cls.getClassLoader()); WeakReference weak = classLoaderCache.get(cls.getName()); if(weak != null) { Object result = weak.get(); if(result != null) { return (ClassInfo)result; } } ClassInfo clsInfo = new ClassInfo(cls); weak = new WeakReference(clsInfo); classLoaderCache.put(cls.getName(), weak); return clsInfo; } public static ClassInfo getClassInfo(String name, boolean required) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); Map> classLoaderCache = getClassLoaderCache(cl); WeakReference weak = classLoaderCache.get(name); if(weak != null) { Object result = weak.get(); if(result != null) { return (ClassInfo)result; } } try { ClassInfo clsInfo = new ClassInfo(cl.loadClass(name)); weak = new WeakReference(clsInfo); classLoaderCache.put(name, weak); return clsInfo; } catch(ClassNotFoundException e) { if(required) { throw new JBossXBRuntimeException("Failed to load class " + name); } } return null; } private static Map> getClassLoaderCache(ClassLoader cl) { synchronized(classloaderCache) { Map> result = classloaderCache.get(cl); if (result == null) { result = new ConcurrentHashMap>(); classloaderCache.put(cl, result); } return result; } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/introspection/ClassInfo.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/introspection/ClassInfo.j0000644000175000017500000000765411061473704033174 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.introspection; import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; import java.lang.reflect.Method; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.jboss.xb.binding.JBossXBRuntimeException; /** * @author Alexey Loubyansky * @version $Revision: $ */ public class ClassInfo { private static final Object FIELD_INFO_NA = new Object(); private final Class type; private Map fields = new ConcurrentHashMap(); private boolean introspected; public ClassInfo(Class cls) { this.type = cls; } public Class getType() { return type; } /** * @param name the name of the field * @param required if true never returns null (if the FieldInfo is not available, an exception will be thrown). * If false and FieldInfo is not available then null will be returned. * @return an instance of FieldInfo or null */ public FieldInfo getFieldInfo(String name, boolean required) { Object o = fields.get(name); if(o == null) { FieldInfo fieldInfo = FieldInfo.getFieldInfo(this, name); if(fieldInfo == null) { fields.put(name, FIELD_INFO_NA); } else { return fieldInfo; } } else if(o != FIELD_INFO_NA) { return (FieldInfo)o; } if(required) { throw new JBossXBRuntimeException( "Failed to find read method or field for property '" + name + "' in " + type ); } return null; } void addFieldInfo(FieldInfo fieldInfo) { fields.put(fieldInfo.getName(), fieldInfo); } FieldInfo introspect(String name) { if(introspected) { return null; } try { BeanInfo info = java.beans.Introspector.getBeanInfo(type); PropertyDescriptor[] props = info.getPropertyDescriptors(); if(props != null) { for(int i = 0; i < props.length; ++i) { PropertyDescriptor prop = props[i]; Method readMethod = prop.getReadMethod(); // todo: there are issues with null readMethod, e.g. scale in BigDecimal... if(readMethod != null) { Method writeMethod = prop.getWriteMethod(); FieldInfo fieldInfo = new FieldInfo(type, prop.getName(), readMethod, writeMethod); addFieldInfo(fieldInfo); } } } } catch(IntrospectionException e) { } introspected = true; return getFieldInfo(name, false); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/introspection/FieldInfo.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/introspection/FieldInfo.j0000644000175000017500000002002411061473704033134 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.introspection; import java.lang.reflect.Method; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import org.jboss.util.Classes; import org.jboss.xb.binding.JBossXBRuntimeException; /** * @author Alexey Loubyansky * @version $Revision: $ */ public class FieldInfo { private static final Object[] NO_ARGS = new Object[0]; private interface GetValueAccess { Object get(Object owner) throws IllegalAccessException, InvocationTargetException; } public static class GetValueAccessFactory { public static GetValueAccess fieldAccess(final Field field) { return new GetValueAccess() { public Object get(Object owner) throws IllegalAccessException { return field.get(owner); } }; } public static GetValueAccess methodAccess(final Method m) { return new GetValueAccess() { public Object get(Object owner) throws IllegalAccessException, InvocationTargetException { return m.invoke(owner, NO_ARGS); } }; } } private interface SetValueAccess { void set(Object owner, Object value) throws IllegalAccessException, InvocationTargetException; } public static class SetValueAccessFactory { public static SetValueAccess fieldAccess(final Field field) { return new SetValueAccess() { public void set(Object owner, Object value) throws IllegalAccessException { field.set(owner, value); } }; } public static SetValueAccess methodAccess(final Method m) { return new SetValueAccess() { public void set(Object owner, Object value) throws IllegalAccessException, InvocationTargetException { Object[] arguments = new Object[] { value }; try { m.invoke(owner, new Object[]{value}); } catch (IllegalArgumentException e) { if (owner == null) throw new IllegalArgumentException("Null target for " + m.getName()); ArrayList expected = new ArrayList(); Class[] parameters = m.getParameterTypes(); if (parameters != null) { for (int i = 0; i < parameters.length; ++i) expected.add(parameters[i].getName()); } ArrayList actual = new ArrayList(); if (arguments != null) { for (int i = 0; i < arguments.length; ++i) { if (arguments[i] == null) actual.add(null); else actual.add(arguments[i].getClass().getName()); } } throw new IllegalArgumentException("Wrong arguments. " + m.getName() + " for target " + owner + " expected=" + expected + " actual=" + actual); } } }; } } static FieldInfo getFieldInfo(ClassInfo clsInfo, String name) { FieldInfo fieldInfo = null; try { Method getter = Classes.getAttributeGetter(clsInfo.getType(), name); fieldInfo = new FieldInfo(clsInfo.getType(), name, getter); clsInfo.addFieldInfo(fieldInfo); } catch(NoSuchMethodException e) { try { Field field = clsInfo.getType().getField(name); fieldInfo = new FieldInfo(clsInfo.getType(), field); clsInfo.addFieldInfo(fieldInfo); } catch(NoSuchFieldException e1) { fieldInfo = clsInfo.introspect(name); } } return fieldInfo; } public static FieldInfo getFieldInfo(Class cls, String fieldName, boolean required) { return ClassInfos.getClassInfo(cls).getFieldInfo(fieldName, required); } private final Class owner; private final String name; private final Class type; private final GetValueAccess getter; private SetValueAccess setter; private boolean setterInitialized; public FieldInfo(Class owner, String name, Method getter) { this.owner = owner; this.name = name; this.type = getter.getReturnType(); this.getter = GetValueAccessFactory.methodAccess(getter); } public FieldInfo(Class owner, String name, Method getter, Method setter) { this.owner = owner; this.name = name; this.type = getter.getReturnType(); this.getter = GetValueAccessFactory.methodAccess(getter); this.setter = SetValueAccessFactory.methodAccess(setter); setterInitialized = true; } public FieldInfo(Class owner, Field field) { this.owner = owner; this.name = field.getName(); this.type = field.getType(); this.getter = GetValueAccessFactory.fieldAccess(field); this.setter = SetValueAccessFactory.fieldAccess(field); setterInitialized = true; } public Class getOwner() { return owner; } public String getName() { return name; } public Class getType() { return type; } public boolean isReadable() { return true; } public boolean isWritable() { if(!setterInitialized) { initializeSetter(); } return setter != null; } public Object getValue(Object owner) { try { return getter.get(owner); } catch(Exception e) { throw new JBossXBRuntimeException( "Failed to get value of the property '" + name + "' defined in " + owner + " from instance " + owner, e ); } } public void setValue(Object owner, Object value) { if(!isWritable()) { throw new JBossXBRuntimeException( "Failed to find setter or field for property '" + name + "' in " + owner ); } try { setter.set(owner, value); } catch(Exception e) { throw new JBossXBRuntimeException( "Failed to set value '" + value + "' for property '" + name + "' defined in " + owner.getClass().getName() + " on instance " + owner, e ); } } private void initializeSetter() { try { setter = SetValueAccessFactory.methodAccess(Classes.getAttributeSetter(owner, name, type)); } catch(NoSuchMethodException e) { } setterInitialized = true; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/FeatureAware.java0000644000175000017500000000271011154324425031440 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2008, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; /** * We can set the feature on this impl. * * @author Ales Justin */ public interface FeatureAware { /** * Apply feature. * * @param featureName the feature name * @param flag the feature flag * @throws Exception for any error */ void setFeature(String featureName, boolean flag) throws Exception; } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/Marshaller.java0000644000175000017500000001020511166362435031163 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; import java.io.Reader; import java.io.IOException; import java.io.Writer; import java.security.AccessController; import java.security.PrivilegedAction; /** * An interface for marshaller implementations, e.g. DTD and XML schema marshallers. * * @version $Revision: 3091 $ * @author Alexey Loubyansky */ public interface Marshaller { /** * Allowed values are true and false. If not set, true is assumed. * If true, xml version and encoding will be included into the marshalled XML content. */ String PROP_OUTPUT_XML_VERSION = "org.jboss.xml.binding.marshalling.version"; /** * The value should be a fully qualified class name of the Marshaller implementation. * Used by the FACTORY.getInstance(). */ String PROP_MARSHALLER = "org.jboss.xml.binding.Marshaller"; /** * Allowed values are true and false. If not set, true is assumed. * If true, XML content will be written with indentations, otherwise in one string. */ String PROP_OUTPUT_INDENTATION = "org.jboss.xml.binding.marshalling.indent"; class FACTORY { public static Marshaller getInstance() { String impl = AccessController.doPrivileged(new PrivilegedAction() { public String run() { return System.getProperty(PROP_MARSHALLER); }} ); if(impl == null) { throw new IllegalStateException("Required system property is not set: " + PROP_MARSHALLER); } Class implCls; try { implCls = Thread.currentThread().getContextClassLoader().loadClass(impl); } catch(ClassNotFoundException e) { throw new IllegalStateException("Failed to load marshaller implementation class: " + impl); } try { return (Marshaller)implCls.newInstance(); } catch(Exception e) { throw new IllegalStateException("Failed to instantiate a marshaller: " + implCls); } } } String VERSION = "1.0"; String ENCODING = "UTF-8"; void setVersion(String version); void setEncoding(String encoding); void mapPublicIdToSystemId(String publicId, String systemId); void mapClassToGlobalElement(Class cls, String localName, String nsUri, String schemaUrl, ObjectModelProvider provider); void mapClassToGlobalType(Class cls, String localName, String nsUri, String schemaUrl, ObjectModelProvider provider); void addRootElement(String namespaceUri, String prefix, String name); void marshal(String schemaUri, ObjectModelProvider provider, Object root, Writer writer) throws IOException, ParserConfigurationException, SAXException; void marshal(Reader schema, ObjectModelProvider provider, Object document, Writer writer) throws IOException, SAXException, ParserConfigurationException; void setProperty(String name, String value); String getProperty(String name); } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/AbstractMarshaller.java0000644000175000017500000003613611061473704032656 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import java.io.IOException; import java.io.Writer; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Iterator; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.xb.binding.introspection.FieldInfo; import org.xml.sax.SAXException; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public abstract class AbstractMarshaller implements Marshaller { protected final Logger log = Logger.getLogger(getClass()); protected String version = VERSION; protected String encoding = ENCODING; protected List rootQNames = new ArrayList(); protected NamespaceRegistry nsRegistry = new NamespaceRegistry(); private Map, ClassMapping> classMappings = Collections.emptyMap(); protected Map, FieldToWildcardMapping> field2WildcardMap = Collections.emptyMap(); protected Map, QName> cls2TypeMap = Collections.emptyMap(); /** * Content the result is written to */ protected Content content = new Content(); private Properties props; // Marshaller implementation public void mapClassToGlobalElement(Class cls, String localName, String namespaceUri, String schemaUrl, ObjectModelProvider provider) { GenericObjectModelProvider delProv = null; if(provider != null) { delProv = provider instanceof GenericObjectModelProvider ? (GenericObjectModelProvider)provider : new DelegatingObjectModelProvider(provider); } ClassMapping mapping = new ClassMapping(cls, localName, null, namespaceUri, schemaUrl, delProv ); addClassMapping(mapping); } public void mapClassToGlobalType(Class cls, String localName, String nsUri, String schemaUrl, ObjectModelProvider provider) { ClassMapping mapping = new ClassMapping(cls, null, localName, nsUri, schemaUrl, provider instanceof GenericObjectModelProvider ? (GenericObjectModelProvider)provider : new DelegatingObjectModelProvider(provider) ); addClassMapping(mapping); } public void mapFieldToWildcard(Class cls, String field, ObjectLocalMarshaller marshaller) { FieldToWildcardMapping mapping = new FieldToWildcardMapping(cls, field, marshaller); if(field2WildcardMap.isEmpty()) field2WildcardMap = new HashMap, FieldToWildcardMapping>(field2WildcardMap); field2WildcardMap.put(cls, mapping); } public void mapClassToXsiType(Class cls, String typeNs, String typeLocalPart) { QName typeQName = new QName(typeNs, typeLocalPart); if(cls2TypeMap.isEmpty()) cls2TypeMap = new HashMap, QName>(cls2TypeMap); cls2TypeMap.put(cls, typeQName); if(log.isTraceEnabled()) log.trace("mapped " + cls + " to xsi:type " + typeQName); } public void setVersion(String version) { this.version = version; } public void setEncoding(String encoding) { this.encoding = encoding; } public void mapPublicIdToSystemId(String publicId, String systemId) { throw new UnsupportedOperationException(); } public void addRootElement(String namespaceUri, String prefix, String name) { addRootElement(new QName(namespaceUri, name, prefix)); } public void addRootElement(QName qName) { rootQNames.add(qName); } public void setProperty(String name, String value) { if(props == null) { props = new Properties(); } props.setProperty(name, value); } public String getProperty(String name) { return props == null ? null : props.getProperty(name); } /** * Defines a namespace. The namespace declaration will appear in the root element. *

If prefix argument is null or is an empty string then * the passed in URI will be used for the default namespace, i.e. xmlns. * Otherwise, the declaration will follow the format xmlns:prefix=uri. *

If the namespace with the given prefix was already declared, its value is overwritten. * * @param prefix the prefix for the namespace to declare (can be null or empty string) * @param uri the URI of the namespace. */ public void declareNamespace(String prefix, String uri) { if(prefix == null) { return; } nsRegistry.addPrefixMapping(prefix, uri); } public void removePrefixMapping(String prefix) { nsRegistry.removePrefixMapping(prefix); } public String getPrefix(String ns) { String prefix = nsRegistry.getPrefix(ns); if(prefix == null && Constants.NS_XML_NAMESPACE.equals(ns)) { prefix = "xml"; } return prefix; } protected void declareNs(AttributesImpl attrs) { for(Iterator i = nsRegistry.getRegisteredURIs(); i.hasNext();) { String uri = i.next(); String prefix = nsRegistry.getPrefix(uri); declareNs(attrs, prefix, uri); } } protected static void declareNs(AttributesImpl attrs, String prefix, String ns) { attrs.add(null, prefix, prefix.length() == 0 ? "xmlns" : "xmlns:" + prefix, "CDATA", ns); } /** * Adds xsi:type attribute and optionally declares namespaces for xsi and type's namespace. * * @param typeQName the type to declare xsi:type attribute for * @param attrs the attributes to add xsi:type attribute to * @return prefix for the type's ns if it was generated */ protected String declareXsiType(QName typeQName, AttributesImpl attrs) { String result = null; String xsiPrefix = nsRegistry.getPrefix(Constants.NS_XML_SCHEMA_INSTANCE); if(xsiPrefix == null) { declareNs(attrs, "xsi", Constants.NS_XML_SCHEMA_INSTANCE); xsiPrefix = "xsi"; } String pref = getPrefix(typeQName.getNamespaceURI()); if(pref == null) { // the ns is not declared result = pref = typeQName.getLocalPart() + "_ns"; } String qName = prefixLocalName(pref, typeQName.getLocalPart()); attrs.add(Constants.NS_XML_SCHEMA_INSTANCE, "type", xsiPrefix + ":type", "CDATA", qName); return result; } protected static String prefixLocalName(String prefix, String local) { return prefix == null || prefix.length() == 0 ? local : prefix + ':' + local; } public abstract void addAttribute(String prefix, String localName, String type, String value); // Protected protected boolean propertyIsTrueOrNotSet(String name) { String value = getProperty(name); return value == null || "true".equalsIgnoreCase(value); } protected void writeXmlVersion(Writer writer) throws IOException { String xmlVersion = getProperty(Marshaller.PROP_OUTPUT_XML_VERSION); if(xmlVersion == null || "true".equalsIgnoreCase(xmlVersion)) { writer.write("\n"); } } protected ClassMapping getClassMapping(Class cls) { return (ClassMapping)classMappings.get(cls); } private void addClassMapping(ClassMapping mapping) { if(classMappings.isEmpty()) { classMappings = new HashMap, ClassMapping>(); } classMappings.put(mapping.cls, mapping); } // Inner protected class ClassMapping { public final Class cls; public final QName elementName; public final QName typeName; public final String schemaUrl; public final GenericObjectModelProvider provider; public ClassMapping(Class cls, String elementName, String typeName, String nsUri, String schemaUrl, GenericObjectModelProvider provider) { this.cls = cls; if(elementName != null) { this.elementName = nsUri == null ? new QName(elementName) : new QName(nsUri, elementName); this.typeName = null; } else if(typeName != null) { this.elementName = null; this.typeName = nsUri == null ? new QName(typeName) : new QName(nsUri, typeName); } else { throw new JBossXBRuntimeException("Element or type name must not null for " + cls); } this.schemaUrl = schemaUrl; this.provider = provider; } public boolean equals(Object o) { if(this == o) { return true; } if(o == null || getClass() != o.getClass()) { return false; } final ClassMapping that = (ClassMapping)o; if(cls != null ? !cls.equals(that.cls) : that.cls != null) { return false; } if(elementName != null ? !elementName.equals(that.elementName) : that.elementName != null) { return false; } if(provider != null ? !provider.equals(that.provider) : that.provider != null) { return false; } if(schemaUrl != null ? !schemaUrl.equals(that.schemaUrl) : that.schemaUrl != null) { return false; } if(typeName != null ? !typeName.equals(that.typeName) : that.typeName != null) { return false; } return true; } public int hashCode() { int result; result = (cls != null ? cls.hashCode() : 0); result = 29 * result + (elementName != null ? elementName.hashCode() : 0); result = 29 * result + (typeName != null ? typeName.hashCode() : 0); result = 29 * result + (schemaUrl != null ? schemaUrl.hashCode() : 0); result = 29 * result + (provider != null ? provider.hashCode() : 0); return result; } } protected class FieldToWildcardMapping { public final Class cls; public final ObjectLocalMarshaller marshaller; public final FieldInfo fieldInfo; public FieldToWildcardMapping(Class cls, String field, ObjectLocalMarshaller marshaller) { if(log.isTraceEnabled()) { log.trace("new FieldToWildcardMapping: [cls=" + cls.getName() + ",field=" + field + "]" ); } this.cls = cls; this.marshaller = marshaller; this.fieldInfo = FieldInfo.getFieldInfo(cls, field, true); } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof FieldToWildcardMapping)) { return false; } final FieldToWildcardMapping fieldToWildcardMapping = (FieldToWildcardMapping)o; if(!cls.equals(fieldToWildcardMapping.cls)) { return false; } if(!fieldInfo.getName().equals(fieldToWildcardMapping.fieldInfo.getName())) { return false; } return true; } public int hashCode() { int result; result = cls.hashCode(); result = 29 * result + fieldInfo.getName().hashCode(); return result; } } protected static interface Stack { void clear(); void push(Object o); Object pop(); Object peek(); boolean isEmpty(); } public static class StackImpl implements Stack { private List list = new ArrayList(); public void clear() { list.clear(); } public void push(Object o) { list.add(o); } public Object pop() { return list.remove(list.size() - 1); } public Object peek() { return list.get(list.size() - 1); } public boolean isEmpty() { return list.isEmpty(); } } public class ContentHandlerAdaptor implements ContentHandler { public void setDocumentLocator(Locator locator) { } public void startDocument() throws SAXException { // this is used to marshal a fragment of a document so we don't delegate startDocument } public void endDocument() throws SAXException { // this is used to marshal a fragment of a document so we don't delegate endDocument } public void startPrefixMapping(String prefix, String uri) throws SAXException { content.startPrefixMapping(prefix, uri); } public void endPrefixMapping(String prefix) throws SAXException { content.endPrefixMapping(prefix); } public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { content.startElement(uri, localName, qName, atts); } public void endElement(String uri, String localName, String qName) throws SAXException { content.endElement(uri, localName, qName); } public void characters(char ch[], int start, int length) throws SAXException { content.characters(ch, start, length); } public void ignorableWhitespace(char ch[], int start, int length) throws SAXException { } public void processingInstruction(String target, String data) throws SAXException { } public void skippedEntity(String name) throws SAXException { } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/ContentWriter.java0000644000175000017500000001610110470642610031672 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import java.io.IOException; import java.io.Writer; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; /** * org.xml.sax.ContentHandler implementation that serializes an instance of org.jboss.xb.binding.Content * to a java.io.Writer. * * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class ContentWriter implements ContentHandler { final boolean useIndent; private String indent = " "; private int depth = 0; private boolean started = false; private final Writer writer; public ContentWriter(Writer writer, boolean indent) { this.writer = writer; this.useIndent = indent; } public void setDocumentLocator(Locator locator) { throw new UnsupportedOperationException(); } public void startDocument() throws SAXException { } public void endDocument() throws SAXException { } public void startPrefixMapping(String prefix, String uri) throws SAXException { throw new UnsupportedOperationException(); } public void endPrefixMapping(String prefix) throws SAXException { throw new UnsupportedOperationException(); } public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { if(useIndent) { write(writer, '\n'); for(int j = 0; j < depth; ++j) { write(writer, indent); } } if(!started) { started = true; } ++depth; write(writer, '<'); write(writer, qName); if(atts != null && atts.getLength() > 0) { for(int i = 0; i < atts.getLength(); ++i) { write(writer, ' '); write(writer, atts.getQName(i)); write(writer, "=\""); writeNormalized(writer, atts.getValue(i)); write(writer, '\"'); } } /*if(namespaceURI != null && namespaceURI.length() > 1) { int colon = qName.indexOf(':'); / * if(colon < 0) { throw new IllegalStateException( "Namespace URI specified (" + namespaceURI + ") but no qName found in qualified name '" + qName ); } * / if(colon >= 0) { String prefix = qName.substring(0, colon); if(useIndent) { write(writer, '\n'); for(int i = 0; i < depth + 1; ++i) { write(writer, indent); } } else { write(writer, ' '); } write(writer, "xmlns:"); write(writer, prefix); write(writer, "=\""); write(writer, namespaceURI); write(writer, "\""); } }*/ write(writer, '>'); } public void endElement(String namespaceURI, String localName, String qName) throws SAXException { --depth; if(!started) { if(useIndent) { write(writer, '\n'); for(int j = 0; j < depth; ++j) { write(writer, indent); } } } else { started = false; } write(writer, "'); } public void characters(char ch[], int start, int length) throws SAXException { writeNormalized(writer, ch, start, length); } public void ignorableWhitespace(char ch[], int start, int length) throws SAXException { throw new UnsupportedOperationException(); } public void processingInstruction(String target, String data) throws SAXException { throw new UnsupportedOperationException(); } public void skippedEntity(String name) throws SAXException { throw new UnsupportedOperationException(); } // Private private static void write(Writer writer, String str) throws SAXException { try { writer.write(str); } catch(IOException e) { throw new SAXException("Writting failed: " + e.getMessage(), e); } } private static void writeNormalized(Writer writer, String str) throws SAXException { writeNormalized(writer, str.toCharArray(), 0, str.length()); } private static void write(Writer writer, int ch) throws SAXException { try { writer.write(ch); } catch(IOException e) { throw new SAXException("Writting failed: " + e.getMessage(), e); } } private static void writeNormalized(Writer writer, char[] ch, int start, int length) throws SAXException { try { int left = start; int i = start; while(i < start + length) { char c = ch[i++]; if(c == '<') { writer.write(ch, left, i - left - 1); writer.write("<"); left = i; } else if(c == '>') { writer.write(ch, left, i - left - 1); writer.write(">"); left = i; } else if(c == '&') { writer.write(ch, left, i - left - 1); writer.write("&"); left = i; } else if(c == '\'') { writer.write(ch, left, i - left - 1); writer.write("'"); left = i; } else if(c == '\"') { writer.write(ch, left, i - left - 1); writer.write("""); left = i; } } if(left < i) { writer.write(ch, left, i - left); } } catch(IOException e) { throw new SAXException("Writting failed: " + e.getMessage(), e); } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/SimpleTypeBindings.java0000644000175000017500000017430311305204145032640 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import java.io.ByteArrayOutputStream; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.math.BigInteger; import java.net.URISyntaxException; import java.text.DecimalFormat; import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.StringTokenizer; import java.util.TimeZone; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.util.Base64; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; /** * @author Alexey Loubyansky * @author Thomas.Diesler@jboss.org * @version $Revision: 3816 $ */ public final class SimpleTypeBindings implements Serializable { static final long serialVersionUID = 4372272109355825813L; public static final String XS_ANYSIMPLETYPE_NAME = "anySimpleType"; // // primitive datatypes // public static final String XS_STRING_NAME = "string"; public static final String XS_BOOLEAN_NAME = "boolean"; public static final String XS_DECIMAL_NAME = "decimal"; public static final String XS_FLOAT_NAME = "float"; public static final String XS_DOUBLE_NAME = "double"; public static final String XS_DURATION_NAME = "duration"; public static final String XS_DATETIME_NAME = "dateTime"; public static final String XS_TIME_NAME = "time"; public static final String XS_DATE_NAME = "date"; public static final String XS_GYEARMONTH_NAME = "gYearMonth"; public static final String XS_GYEAR_NAME = "gYear"; public static final String XS_GMONTHDAY_NAME = "gMonthDay"; public static final String XS_GDAY_NAME = "gDay"; public static final String XS_GMONTH_NAME = "gMonth"; public static final String XS_HEXBINARY_NAME = "hexBinary"; public static final String XS_BASE64BINARY_NAME = "base64Binary"; public static final String XS_ANYURI_NAME = "anyURI"; public static final String XS_QNAME_NAME = "QName"; public static final String XS_NOTATION_NAME = "NOTATION"; // // derived datatypes // public static final String XS_NORMALIZEDSTRING_NAME = "normalizedString"; public static final String XS_TOKEN_NAME = "token"; public static final String XS_LANGUAGE_NAME = "language"; public static final String XS_NMTOKEN_NAME = "NMTOKEN"; public static final String XS_NMTOKENS_NAME = "NMTOKENS"; public static final String XS_NAME_NAME = "Name"; public static final String XS_NCNAME_NAME = "NCName"; public static final String XS_ID_NAME = "ID"; public static final String XS_IDREF_NAME = "IDREF"; public static final String XS_IDREFS_NAME = "IDREFS"; public static final String XS_ENTITY_NAME = "ENTITY"; public static final String XS_ENTITIES_NAME = "ENTITIES"; public static final String XS_INTEGER_NAME = "integer"; public static final String XS_NONPOSITIVEINTEGER_NAME = "nonPositiveInteger"; public static final String XS_NEGATIVEINTEGER_NAME = "negativeInteger"; public static final String XS_LONG_NAME = "long"; public static final String XS_INT_NAME = "int"; public static final String XS_SHORT_NAME = "short"; public static final String XS_BYTE_NAME = "byte"; public static final String XS_NONNEGATIVEINTEGER_NAME = "nonNegativeInteger"; public static final String XS_UNSIGNEDLONG_NAME = "unsignedLong"; public static final String XS_UNSIGNEDINT_NAME = "unsignedInt"; public static final String XS_UNSIGNEDSHORT_NAME = "unsignedShort"; public static final String XS_UNSIGNEDBYTE_NAME = "unsignedByte"; public static final String XS_POSITIVEINTEGER_NAME = "positiveInteger"; public static final int XS_INT = XS_INT_NAME.hashCode(); public static final int XS_LONG = XS_LONG_NAME.hashCode(); public static final int XS_SHORT = XS_SHORT_NAME.hashCode(); public static final int XS_FLOAT = XS_FLOAT_NAME.hashCode(); public static final int XS_DOUBLE = XS_DOUBLE_NAME.hashCode(); public static final int XS_BOOLEAN = XS_BOOLEAN_NAME.hashCode(); public static final int XS_BYTE = XS_BYTE_NAME.hashCode(); public static final int XS_STRING = XS_STRING_NAME.hashCode(); public static final int XS_INTEGER = XS_INTEGER_NAME.hashCode(); public static final int XS_DECIMAL = XS_DECIMAL_NAME.hashCode(); public static final int XS_DATETIME = XS_DATETIME_NAME.hashCode(); public static final int XS_QNAME = XS_QNAME_NAME.hashCode(); public static final int XS_ANYURI = XS_ANYURI_NAME.hashCode(); public static final int XS_UNSIGNEDLONG = XS_UNSIGNEDLONG_NAME.hashCode(); public static final int XS_UNSIGNEDINT = XS_UNSIGNEDINT_NAME.hashCode(); public static final int XS_UNSIGNEDSHORT = XS_UNSIGNEDSHORT_NAME.hashCode(); public static final int XS_UNSIGNEDBYTE = XS_UNSIGNEDBYTE_NAME.hashCode(); public static final int XS_DATE = XS_DATE_NAME.hashCode(); public static final int XS_TIME = XS_TIME_NAME.hashCode(); public static final int XS_BASE64BINARY = XS_BASE64BINARY_NAME.hashCode(); public static final int XS_HEXBINARY = XS_HEXBINARY_NAME.hashCode(); public static final int XS_ANYSIMPLETYPE = XS_ANYSIMPLETYPE_NAME.hashCode(); public static final int XS_DURATION = XS_DURATION_NAME.hashCode(); public static final int XS_GYEARMONTH = XS_GYEARMONTH_NAME.hashCode(); public static final int XS_GYEAR = XS_GYEAR_NAME.hashCode(); public static final int XS_GMONTHDAY = XS_GMONTHDAY_NAME.hashCode(); public static final int XS_GMONTH = XS_GMONTH_NAME.hashCode(); public static final int XS_GDAY = XS_GDAY_NAME.hashCode(); public static final int XS_NORMALIZEDSTRING = XS_NORMALIZEDSTRING_NAME.hashCode(); public static final int XS_TOKEN = XS_TOKEN_NAME.hashCode(); public static final int XS_LANGUAGE = XS_LANGUAGE_NAME.hashCode(); public static final int XS_NAME = XS_NAME_NAME.hashCode(); public static final int XS_NCNAME = XS_NCNAME_NAME.hashCode(); public static final int XS_ID = XS_ID_NAME.hashCode(); public static final int XS_NMTOKEN = XS_NMTOKEN_NAME.hashCode(); public static final int XS_NMTOKENS = XS_NMTOKENS_NAME.hashCode(); public static final int XS_NONPOSITIVEINTEGER = XS_NONPOSITIVEINTEGER_NAME.hashCode(); public static final int XS_NEGATIVEINTEGER = XS_NEGATIVEINTEGER_NAME.hashCode(); public static final int XS_NONNEGATIVEINTEGER = XS_NONNEGATIVEINTEGER_NAME.hashCode(); public static final int XS_POSITIVEINTEGER = XS_POSITIVEINTEGER_NAME.hashCode(); public static final int XS_NOTATION = XS_NOTATION_NAME.hashCode(); public static final int XS_IDREF = XS_IDREF_NAME.hashCode(); public static final int XS_IDREFS = XS_IDREFS_NAME.hashCode(); public static final int XS_ENTITY = XS_ENTITY_NAME.hashCode(); public static final int XS_ENTITIES = XS_ENTITIES_NAME.hashCode(); public static final TypeBinding STRING = new TypeBinding() { public Object unmarshal(String value) { return value; } public String marshal(Object value) { return (String)value; } }; public static final TypeBinding INT = new TypeBinding() { public Object unmarshal(String value) { return Integer.valueOf(value); } public String marshal(Object value) { return String.valueOf(value); } }; public static final TypeBinding LONG = new TypeBinding() { public Object unmarshal(String value) { return Long.valueOf(value); } public String marshal(Object value) { return String.valueOf(value); } }; public static final TypeBinding DOUBLE = new TypeBinding() { public Object unmarshal(String value) { return Double.valueOf(value); } public String marshal(Object value) { return String.valueOf(value); } }; public static final TypeBinding FLOAT = new TypeBinding() { public Object unmarshal(String value) { return Float.valueOf(value); } public String marshal(Object value) { return String.valueOf(value); } }; public static final TypeBinding SHORT = new TypeBinding() { public Object unmarshal(String value) { return Short.valueOf(value); } public String marshal(Object value) { return String.valueOf(value); } }; public static final TypeBinding BYTE = new TypeBinding() { public Object unmarshal(String value) { return Byte.valueOf(value); } public String marshal(Object value) { return String.valueOf(value); } }; public static final TypeBinding CHAR = new TypeBinding() { public Object unmarshal(String value) { return value == null ? null : new Character(value.charAt(0)); } public String marshal(Object value) { return String.valueOf(value); } }; public static final TypeBinding JAVA_UTIL_DATE = new TypeBinding() { public Object unmarshal(String value) { return unmarshalDate(value).getTime(); } public String marshal(Object value) { Calendar c = Calendar.getInstance(); c.setTime((java.util.Date)value); return marshalDate(c); } }; // check for uniqueness of hashCode's static { int[] codes = new int[45]; String[] names = new String[codes.length]; int i = 0; names[i] = XS_INT_NAME; codes[i++] = XS_INT; names[i] = XS_LONG_NAME; codes[i++] = XS_LONG; names[i] = XS_SHORT_NAME; codes[i++] = XS_SHORT; names[i] = XS_FLOAT_NAME; codes[i++] = XS_FLOAT; names[i] = XS_DOUBLE_NAME; codes[i++] = XS_DOUBLE; names[i] = XS_BOOLEAN_NAME; codes[i++] = XS_BOOLEAN; names[i] = XS_BYTE_NAME; codes[i++] = XS_BYTE; names[i] = XS_STRING_NAME; codes[i++] = XS_STRING; names[i] = XS_INTEGER_NAME; codes[i++] = XS_INTEGER; names[i] = XS_DECIMAL_NAME; codes[i++] = XS_DECIMAL; names[i] = XS_DATETIME_NAME; codes[i++] = XS_DATETIME; names[i] = XS_QNAME_NAME; codes[i++] = XS_QNAME; names[i] = XS_ANYURI_NAME; codes[i++] = XS_ANYURI; names[i] = XS_UNSIGNEDINT_NAME; codes[i++] = XS_UNSIGNEDINT; names[i] = XS_UNSIGNEDSHORT_NAME; codes[i++] = XS_UNSIGNEDSHORT; names[i] = XS_UNSIGNEDBYTE_NAME; codes[i++] = XS_UNSIGNEDBYTE; names[i] = XS_DATE_NAME; codes[i++] = XS_DATE; names[i] = XS_TIME_NAME; codes[i++] = XS_TIME; names[i] = XS_BASE64BINARY_NAME; codes[i++] = XS_BASE64BINARY; names[i] = XS_HEXBINARY_NAME; codes[i++] = XS_HEXBINARY; names[i] = XS_ANYSIMPLETYPE_NAME; codes[i++] = XS_ANYSIMPLETYPE; names[i] = XS_DURATION_NAME; codes[i++] = XS_DURATION; names[i] = XS_GYEARMONTH_NAME; codes[i++] = XS_GYEARMONTH; names[i] = XS_GYEAR_NAME; codes[i++] = XS_GYEAR; names[i] = XS_GMONTHDAY_NAME; codes[i++] = XS_GMONTHDAY; names[i] = XS_GMONTH_NAME; codes[i++] = XS_GMONTH; names[i] = XS_GDAY_NAME; codes[i++] = XS_GDAY; names[i] = XS_NORMALIZEDSTRING_NAME; codes[i++] = XS_NORMALIZEDSTRING; names[i] = XS_TOKEN_NAME; codes[i++] = XS_TOKEN; names[i] = XS_LANGUAGE_NAME; codes[i++] = XS_LANGUAGE; names[i] = XS_NAME_NAME; codes[i++] = XS_NAME; names[i] = XS_NCNAME_NAME; codes[i++] = XS_NCNAME; names[i] = XS_ID_NAME; codes[i++] = XS_ID; names[i] = XS_NMTOKEN_NAME; codes[i++] = XS_NMTOKEN; names[i] = XS_NMTOKENS_NAME; codes[i++] = XS_NMTOKENS; names[i] = XS_NONPOSITIVEINTEGER_NAME; codes[i++] = XS_NONPOSITIVEINTEGER; names[i] = XS_NONNEGATIVEINTEGER_NAME; codes[i++] = XS_NONNEGATIVEINTEGER; names[i] = XS_POSITIVEINTEGER_NAME; codes[i++] = XS_POSITIVEINTEGER; names[i] = XS_NEGATIVEINTEGER_NAME; codes[i++] = XS_NEGATIVEINTEGER; names[i] = XS_UNSIGNEDLONG_NAME; codes[i++] = XS_UNSIGNEDLONG; names[i] = XS_NOTATION_NAME; codes[i++] = XS_NOTATION; names[i] = XS_IDREF_NAME; codes[i++] = XS_IDREF; names[i] = XS_IDREFS_NAME; codes[i++] = XS_IDREFS; names[i] = XS_ENTITY_NAME; codes[i++] = XS_ENTITY; names[i] = XS_ENTITIES_NAME; codes[i++] = XS_ENTITIES; Logger log = Logger.getLogger(SimpleTypeBindings.class); boolean allAreUnique = true; for(int outer = 0; outer < names.length; ++outer) { int outerCode = codes[outer]; String outerName = names[outer]; for(int inner = outer + 1; inner < names.length; ++inner) { int innerCode = codes[inner]; String innerName = names[inner]; if(outerCode == innerCode) { log.error("Types have the same hash code " + outerCode + ": " + outerName + " and " + innerName); allAreUnique = false; } } } if(!allAreUnique) { throw new IllegalStateException("Not all the schema types have unique hash codes! See log for more details."); } } public static Class classForType(String xsdType, boolean nillable) { Class result; int typeCode = xsdType.hashCode(); if(typeCode == XS_INT) { result = nillable ? Integer.class : int.class; } else if(typeCode == XS_LONG) { result = nillable ? Long.class : long.class; } else if(typeCode == XS_SHORT) { result = nillable ? Short.class : short.class; } else if(typeCode == XS_BYTE) { result = nillable ? Byte.class : byte.class; } else if(typeCode == XS_FLOAT) { result = nillable ? Float.class : float.class; } else if(typeCode == XS_DOUBLE) { result = nillable ? Double.class : double.class; } else if(typeCode == XS_BOOLEAN) { result = nillable ? Boolean.class : boolean.class; } else if(typeCode == XS_STRING) { result = String.class; } else if(typeCode == XS_INTEGER) { result = BigInteger.class; } else if(typeCode == XS_DECIMAL) { result = BigDecimal.class; } else if(typeCode == XS_DATETIME) { result = java.util.Calendar.class; } else if(typeCode == XS_QNAME) { result = QName.class; } else if(typeCode == XS_ANYURI) { // anyUri is by default bound to java.net.URI for now. The following is the warning from JAXB2.0: // // Design Note � xs:anyURI is not bound to java.net.URI by default since not all // possible values of xs:anyURI can be passed to the java.net.URI constructor. Using // a global JAXB customization described in Section 7.9, � // Declaration", a JAXB user can override the default mapping to map xs:anyURI to // java.net.URI. // result = java.net.URI.class; } else if(typeCode == XS_UNSIGNEDLONG) { result = BigInteger.class; } else if(typeCode == XS_UNSIGNEDINT) { result = nillable ? Long.class : long.class; } else if(typeCode == XS_UNSIGNEDSHORT) { result = nillable ? Integer.class : int.class; } else if(typeCode == XS_UNSIGNEDBYTE) { result = nillable ? Short.class : short.class; } else if(typeCode == XS_DATE) { result = Calendar.class; } else if(typeCode == XS_TIME) { result = Calendar.class; } else if(typeCode == XS_BASE64BINARY) { result = byte[].class; } else if(typeCode == XS_HEXBINARY) { result = byte[].class; } else if(typeCode == XS_ANYSIMPLETYPE) { result = String.class; } else if(typeCode == XS_DURATION) { // todo XS_DURATION throw new IllegalStateException("Recognized but not supported xsdType: " + XS_DURATION_NAME); } else if(typeCode == XS_GYEARMONTH) { result = Calendar.class; } else if(typeCode == XS_GYEAR) { result = Calendar.class; } else if(typeCode == XS_GMONTHDAY) { result = Calendar.class; } else if(typeCode == XS_GMONTH) { result = Calendar.class; } else if(typeCode == XS_GDAY) { result = Calendar.class; } else if(typeCode == XS_NORMALIZEDSTRING) { result = String.class; } else if(typeCode == XS_TOKEN) { result = String.class; } else if(typeCode == XS_LANGUAGE) { result = String.class; } else if(typeCode == XS_NAME) { result = String.class; } else if(typeCode == XS_NCNAME) { result = String.class; } else if(typeCode == XS_ID) { result = String.class; } else if(typeCode == XS_NMTOKEN) { result = String.class; } else if(typeCode == XS_NMTOKENS) { result = String[].class; } else if(typeCode == XS_NONPOSITIVEINTEGER) { result = BigInteger.class; } else if(typeCode == XS_NEGATIVEINTEGER) { result = BigInteger.class; } else if(typeCode == XS_NONNEGATIVEINTEGER) { result = BigInteger.class; } else if(typeCode == XS_POSITIVEINTEGER) { result = BigInteger.class; } else if(typeCode == XS_NOTATION) { result = String.class; } else if(typeCode == XS_IDREF) { result = String.class; } else if(typeCode == XS_IDREFS) { result = String[].class; } else if(typeCode == XS_ENTITY) { result = String.class; } else if(typeCode == XS_ENTITIES) { result = String[].class; } else { throw new IllegalStateException("Not supported xsdType: " + xsdType + ", hashCode=" + xsdType.hashCode()); } return result; } public static Object unmarshal(String xsdType, String value, NamespaceContext nsCtx) { if (xsdType == null) throw new IllegalArgumentException("Schema type cannot be null"); if (value == null) throw new IllegalArgumentException("Value string cannot be null"); int typeCode = xsdType.hashCode(); Object result; if(typeCode == XS_INT) { result = Integer.valueOf(value); } else if(typeCode == XS_LONG) { result = Long.valueOf(value); } else if(typeCode == XS_SHORT) { result = Short.valueOf(value); } else if(typeCode == XS_BYTE) { result = Byte.valueOf(value); } else if(typeCode == XS_FLOAT) { if("INF".equals(value)) { result = new Float(Float.POSITIVE_INFINITY); } else if("-INF".equals(value)) { result = new Float(Float.NEGATIVE_INFINITY); } else { result = Float.valueOf(value); } } else if(typeCode == XS_DOUBLE) { if("INF".equals(value)) { result = new Double(Double.POSITIVE_INFINITY); } else if("-INF".equals(value)) { result = new Double(Double.NEGATIVE_INFINITY); } else { result = Double.valueOf(value); } } else if(typeCode == XS_BOOLEAN) { if(value.length() == 1) { switch(value.charAt(0)) { case '1': result = Boolean.TRUE; break; case '0': result = Boolean.FALSE; break; default: throw new JBossXBValueFormatException("An instance of a datatype that is defined as ?boolean? can have the following legal literals" + " {true, false, 1, 0}. But got: " + value ); } } else { result = Boolean.valueOf(value); } } else if(typeCode == XS_STRING) { result = value; } else if(typeCode == XS_INTEGER) { result = new BigInteger(value); } else if(typeCode == XS_DECIMAL) { result = new BigDecimal(value); } else if(typeCode == XS_DATETIME) { result = unmarshalDateTime(value); } else if(typeCode == XS_QNAME) { result = unmarshalQName(value, nsCtx); } else if(typeCode == XS_ANYURI) { // anyUri is by default bound to java.net.URI for now. The following is the warning from JAXB2.0: // // Design Note � xs:anyURI is not bound to java.net.URI by default since not all // possible values of xs:anyURI can be passed to the java.net.URI constructor. Using // a global JAXB customization described in Section 7.9, � // Declaration", a JAXB user can override the default mapping to map xs:anyURI to // java.net.URI. // try { result = new java.net.URI(value); } catch(URISyntaxException e) { throw new JBossXBValueFormatException("Failed to unmarshal anyURI value " + value, e); } } else if(typeCode == XS_UNSIGNEDLONG) { BigInteger d = new BigInteger(value); if(d.doubleValue() < 0 || d.doubleValue() > 18446744073709551615D) { throw new JBossXBValueFormatException("Invalid unsignedLong value: " + value); } result = d; } else if(typeCode == XS_UNSIGNEDINT) { long l = Long.parseLong(value); if(l < 0 || l > 4294967295L) { throw new JBossXBValueFormatException("Invalid unsignedInt value: " + value); } result = new Long(l); } else if(typeCode == XS_UNSIGNEDSHORT) { int i = Integer.parseInt(value); if(i < 0 || i > 65535) { throw new JBossXBValueFormatException("Invalid unsignedShort value: " + value); } result = new Integer(i); } else if(typeCode == XS_UNSIGNEDBYTE) { short s = Short.parseShort(value); if(s < 0 || s > 255) { throw new JBossXBValueFormatException("Invalid unsignedByte value: " + value); } result = new Short(s); } else if(typeCode == XS_DATE) { result = unmarshalDate(value); } else if(typeCode == XS_TIME) { result = unmarshalTime(value); } else if(typeCode == XS_BASE64BINARY) { result = unmarshalBase64(value); } else if(typeCode == XS_HEXBINARY) { result = unmarshalHexBinary(value); } else if(typeCode == XS_ANYSIMPLETYPE) { result = value; } else if(typeCode == XS_DURATION) { // todo XS_DURATION throw new IllegalStateException("Recognized but not supported xsdType: " + XS_DURATION_NAME); } else if(typeCode == XS_GYEARMONTH) { result = unmarshalGYearMonth(value); } else if(typeCode == XS_GYEAR) { result = unmarshalGYear(value); } else if(typeCode == XS_GMONTHDAY) { result = unmarshalGMonthDay(value); } else if(typeCode == XS_GMONTH) { return unmarshalGMonth(value); } else if(typeCode == XS_GDAY) { return unmarshalGDay(value); } else if(typeCode == XS_NORMALIZEDSTRING) { if(isNormalizedString(value)) { result = value; } else { throw new JBossXBValueFormatException("Invalid normalizedString value: " + value); } } else if(typeCode == XS_TOKEN) { if(isValidToken(value)) { result = value; } else { throw new JBossXBValueFormatException("Invalid token value: " + value); } } else if(typeCode == XS_LANGUAGE) { result = value; } else if(typeCode == XS_NAME) { result = value; } else if(typeCode == XS_NCNAME) { result = value; } else if(typeCode == XS_ID) { result = value; } else if(typeCode == XS_NMTOKEN) { result = value; } else if(typeCode == XS_NMTOKENS) { result = unmarshalNMTokens(value); } else if(typeCode == XS_NONPOSITIVEINTEGER) { result = new BigInteger(value); if(BigInteger.ZERO.compareTo((BigInteger)result) < 0) { throw new JBossXBValueFormatException("Invalid nonPositiveInteger value: " + value); } } else if(typeCode == XS_NEGATIVEINTEGER) { result = new BigInteger(value); if(BigInteger.ZERO.compareTo((BigInteger)result) <= 0) { throw new JBossXBValueFormatException("Invalid negativeInteger value: " + value); } } else if(typeCode == XS_NONNEGATIVEINTEGER) { result = new BigInteger(value); if(BigInteger.ZERO.compareTo((BigInteger)result) > 0) { throw new JBossXBValueFormatException("Invalid nonNegativeInteger value: " + value); } } else if(typeCode == XS_POSITIVEINTEGER) { result = new BigInteger(value); if(BigInteger.ZERO.compareTo((BigInteger)result) >= 0) { throw new JBossXBValueFormatException("Invalid positiveInteger value: " + value); } } else if(typeCode == XS_NOTATION) { // todo NOTATION result = value; } else if(typeCode == XS_IDREF) { result = value; } else if(typeCode == XS_IDREFS) { result = unmarshalIdRefs(value); } else if(typeCode == XS_ENTITY) { result = value; } else if(typeCode == XS_ENTITIES) { result = unmarshalIdRefs(value); } else { throw new IllegalStateException("Not supported xsdType: " + xsdType + ", hashCode=" + xsdType.hashCode()); } return result; } public static List unmarshalList(String itemType, String value, NamespaceContext nsCtx) { StringTokenizer tokenizer = new StringTokenizer(value); int total = tokenizer.countTokens(); List list = new ArrayList(total); for(int i = 0; i < total; ++i) { Object o = unmarshal(itemType, tokenizer.nextToken(), nsCtx); list.add(o); } return list; } public static List unmarshalList(String itemType, String value, NamespaceContext nsCtx, ValueAdapter adapter) { StringTokenizer tokenizer = new StringTokenizer(value); int total = tokenizer.countTokens(); List list = new ArrayList(total); for(int i = 0; i < total; ++i) { Object o = unmarshal(itemType, tokenizer.nextToken(), nsCtx); o = adapter.cast(o, null); list.add(o); } return list; } public static String marshalList(String itemType, List value, NamespaceContext nsCtx) { StringBuffer buf = new StringBuffer(); for(int i = 0; i < value.size(); ++i) { String item = marshal(itemType, value.get(i), nsCtx); if(i > 0) { buf.append(' '); } buf.append(item); } return buf.toString(); } public static Object unmarshal(String value, Class javaType) { Object result; if(String.class == javaType) { result = value; } else if(int.class == javaType || Integer.class == javaType) { result = Integer.valueOf(value); } else if(long.class == javaType || Long.class == javaType) { result = Long.valueOf(value); } else if(double.class == javaType || Double.class == javaType) { result = Double.valueOf(value); } else if(float.class == javaType || Float.class == javaType) { result = Float.valueOf(value); } else if(short.class == javaType || Short.class == javaType) { result = Short.valueOf(value); } else if(byte.class == javaType || Byte.class == javaType) { result = Byte.valueOf(value); } else if(char.class == javaType || Character.class == javaType) { result = new Character(value.charAt(0)); } else if(java.util.Date.class == javaType) { final String FORMAT = "yyyy-MM-dd"; try { result = new java.text.SimpleDateFormat(FORMAT).parse(value); } catch(ParseException e) { throw new JBossXBRuntimeException( "Failed to parse date accroding to " + FORMAT + " format: " + value + ": " + e.getMessage() ); } } else if(Object.class == javaType) { result = value; } else { throw new JBossXBRuntimeException("Unexpected field type " + javaType); } return result; } public static String marshal(String xsdType, Object value, NamespaceContext nsCtx) { if(value == null) { throw new IllegalArgumentException("Can't marshal null value!"); } int typeCode = xsdType.hashCode(); String result; if(typeCode == XS_INT) { Integer i = (Integer)value; result = i.toString(); } else if(typeCode == XS_LONG) { Long l = (Long)value; result = l.toString(); } else if(typeCode == XS_SHORT) { Short s = (Short)value; result = s.toString(); } else if(typeCode == XS_BYTE) { Byte b = (Byte)value; result = b.toString(); } else if(typeCode == XS_FLOAT) { Float f = (Float)value; if(f.floatValue() == Float.POSITIVE_INFINITY) { result = "INF"; } else if(f.floatValue() == Float.NEGATIVE_INFINITY) { result = "-INF"; } else { result = f.toString(); } } else if(typeCode == XS_DOUBLE) { Double d = (Double)value; if(d.doubleValue() == Double.POSITIVE_INFINITY) { result = "INF"; } else if(d.doubleValue() == Double.NEGATIVE_INFINITY) { result = "-INF"; } else { result = d.toString(); } } else if(typeCode == XS_BOOLEAN) { if(value instanceof Boolean) { result = ((Boolean)value).booleanValue() ? "true" : "false"; } else if(value instanceof Number) { Number n = (Number)value; switch(n.byteValue()) { case 1: result = "1"; break; case 0: result = "0"; break; default: throw new JBossXBValueFormatException("An instance of a datatype that is defined as ?boolean? can have the following legal literals" + " {true, false, 1, 0}. But got: " + value ); } } else { throw new JBossXBValueFormatException("Java value for XSD boolean type expected to be an instance of java.lang.Boolean or java.lang.Number. But the value is of type " + value.getClass().getName() ); } } else if(typeCode == XS_STRING) { result = (String)value; } else if(typeCode == XS_INTEGER) { BigInteger bi = (BigInteger)value; result = bi.toString(); } else if(typeCode == XS_DECIMAL) { BigDecimal bd = (BigDecimal)value; result = bd.toPlainString(); } else if(typeCode == XS_DATETIME) { Calendar c; if(java.util.Date.class.isAssignableFrom(value.getClass())) { c = Calendar.getInstance(TimeZone.getTimeZone("GMT")); c.clear(); c.setTime((java.util.Date)value); } else { c = (Calendar)value; } result = marshalDateTime(c); } else if(typeCode == XS_QNAME) { QName qName = (QName)value; result = marshalQName(qName, nsCtx); } else if(typeCode == XS_ANYURI) { java.net.URI u = (java.net.URI)value; result = u.toString(); } else if(typeCode == XS_UNSIGNEDLONG) { BigInteger d = (BigInteger)value; if (d.doubleValue() < 0 || d.doubleValue() > 18446744073709551615D) { throw new JBossXBValueFormatException("Invalid unsignedLong value: " + value); } result = d.toString(); } else if(typeCode == XS_UNSIGNEDINT) { Long l = (Long)value; if(l.longValue() < 0 || l.longValue() > 4294967295L) { throw new JBossXBValueFormatException("Invalid unsignedInt value: " + value); } result = l.toString(); } else if(typeCode == XS_UNSIGNEDSHORT) { Integer i = (Integer)value; if(i.intValue() < 0 || i.intValue() > 65535) { throw new JBossXBValueFormatException("Invalid unsignedShort value: " + value); } result = i.toString(); } else if(typeCode == XS_UNSIGNEDBYTE) { Short s = (Short)value; if(s.shortValue() < 0 || s.shortValue() > 255) { throw new JBossXBValueFormatException("Invalid unsignedByte value: " + value); } result = s.toString(); } else if(typeCode == XS_DATE) { Calendar c = (Calendar)value; result = marshalDate(c); } else if(typeCode == XS_TIME) { Calendar c = (Calendar)value; result = marshalTime(c); } else if(typeCode == XS_BASE64BINARY) { byte[] b = (byte[])value; result = marshalBase64(b); } else if(typeCode == XS_HEXBINARY) { byte[] b = (byte[])value; result = marshalHexBinary(b); } else if(typeCode == XS_ANYSIMPLETYPE) { return (String)value; } else if(typeCode == XS_DURATION) { // todo XS_DURATION throw new IllegalStateException("Recognized but not supported xsdType: " + xsdType); } else if(typeCode == XS_GYEARMONTH) { Calendar c = (Calendar)value; result = marshalGYearMonth(c); } else if(typeCode == XS_GYEAR) { Calendar c = (Calendar)value; result = marshalGYear(c); } else if(typeCode == XS_GMONTHDAY) { Calendar c = (Calendar)value; result = marshalGMonthDay(c); } else if(typeCode == XS_GMONTH) { Calendar c = (Calendar)value; result = marshalGMonth(c); } else if(typeCode == XS_GDAY) { Calendar c = (Calendar)value; result = marshalGDay(c); } else if(typeCode == XS_NORMALIZEDSTRING) { String s = (String)value; if(isNormalizedString(s)) { result = s; } else { throw new JBossXBValueFormatException("Invalid normalizedString value: " + value); } } else if(typeCode == XS_TOKEN) { String s = (String)value; if(isValidToken(s)) { result = s; } else { throw new JBossXBValueFormatException("Invalid token value: " + value); } } else if(typeCode == XS_LANGUAGE) { result = (String)value; } else if(typeCode == XS_NAME) { result = (String)value; } else if(typeCode == XS_NCNAME) { result = (String)value; } else if(typeCode == XS_ID) { result = (String)value; } else if(typeCode == XS_NMTOKEN) { result = (String)value; } else if(typeCode == XS_NMTOKENS) { String[] tokens = (String[])value; if(tokens.length > 0) { result = tokens[0]; for(int i = 1; i < tokens.length; ++i) { result += ' ' + tokens[i]; } } else { result = ""; } } else if(typeCode == XS_NONPOSITIVEINTEGER) { BigInteger bi = (BigInteger)value; if(BigInteger.ZERO.compareTo(bi) < 0) { throw new JBossXBValueFormatException("Invalid nonPositiveInteger value: " + value); } result = bi.toString(); } else if(typeCode == XS_NEGATIVEINTEGER) { BigInteger bi = (BigInteger)value; if(BigInteger.ZERO.compareTo(bi) <= 0) { throw new JBossXBValueFormatException("Invalid negativeInteger value: " + value); } result = bi.toString(); } else if(typeCode == XS_NONNEGATIVEINTEGER) { BigInteger bi = (BigInteger)value; if(BigInteger.ZERO.compareTo(bi) > 0) { throw new JBossXBValueFormatException("Invalid nonNegativeInteger value: " + value); } result = bi.toString(); } else if(typeCode == XS_POSITIVEINTEGER) { BigInteger bi = (BigInteger)value; if(BigInteger.ZERO.compareTo(bi) >= 0) { throw new JBossXBValueFormatException("Invalid positiveInteger value: " + value); } result = bi.toString(); } else if(typeCode == XS_NOTATION) { // todo NOTATION result = (String)value; } else if(typeCode == XS_IDREF) { result = (String)value; } else if(typeCode == XS_IDREFS) { String[] refs = (String[])value; if(refs.length > 0) { result = refs[0]; for(int i = 1; i < refs.length; ++i) { result += ' ' + refs[i]; } } else { result = ""; } } else if(typeCode == XS_ENTITY) { result = (String)value; } else if(typeCode == XS_ENTITIES) { String[] refs = (String[])value; if(refs.length > 0) { result = refs[0]; for(int i = 1; i < refs.length; ++i) { result += ' ' + refs[i]; } } else { result = ""; } } else { throw new IllegalStateException("Not supported xsdType: " + xsdType + ", hashCode=" + xsdType.hashCode()); } return result; } public static QName typeQName(Class cls) { if(cls == null) { throw new IllegalArgumentException("The argument must not be null."); } QName result = null; if(Integer.class == cls || Integer.TYPE == cls) { result = Constants.QNAME_INT; } else if(cls == Long.class || Long.TYPE == cls) { result = Constants.QNAME_LONG; } else if(cls == Short.class || Short.TYPE == cls) { result = Constants.QNAME_SHORT; } else if(cls == Byte.class || Byte.TYPE == cls) { result = Constants.QNAME_BYTE; } else if(cls == Float.class || Float.TYPE == cls) { result = Constants.QNAME_FLOAT; } else if(cls == Double.class || Double.TYPE == cls) { result = Constants.QNAME_DOUBLE; } else if(cls == Boolean.class || Boolean.TYPE == cls) { result = Constants.QNAME_BOOLEAN; } else if(cls == String.class) { result = Constants.QNAME_STRING; } else if(cls == BigInteger.class) { result = Constants.QNAME_INTEGER; } else if(cls == BigDecimal.class) { result = Constants.QNAME_DECIMAL; } else if(cls == java.util.Date.class || java.util.Calendar.class.isAssignableFrom(cls)) { result = Constants.QNAME_DATETIME; } else if(cls == QName.class) { result = Constants.QNAME_QNAME; } else if(cls == java.net.URI.class) { result = Constants.QNAME_ANYURI; } else if(cls == byte[].class) { result = Constants.QNAME_BASE64BINARY; } return result; } public static String[] unmarshalNMTokens(String value) { StringTokenizer tokenizer = new StringTokenizer(value); String[] tokens = new String[tokenizer.countTokens()]; for(int i = 0; i < tokens.length; ++i) { tokens[i] = tokenizer.nextToken(); } return tokens; } public static String[] unmarshalIdRefs(String value) { StringTokenizer tokenizer = new StringTokenizer(value); String[] tokens = new String[tokenizer.countTokens()]; for(int i = 0; i < tokens.length; ++i) { tokens[i] = tokenizer.nextToken(); } return tokens; } /** * --MM-DD[timezone] * * @param value * @return unmarshalled Calendar */ public static Calendar unmarshalGMonthDay(String value) { if(value.length() < 6 || value.charAt(0) != '-' || value.charAt(1) != '-' || value.charAt(4) != '-') { throw new JBossXBValueFormatException( "gMonthDay value does not follow the format '--MM-DD[timezone]: " + value ); } Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(Calendar.MONTH, Integer.parseInt(value.substring(2, 4)) - 1); cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(value.substring(5, 7))); if(value.length() > 7) { cal.setTimeZone(parseTimeZone(value, 7)); } return cal; } /** * --MM-DD[timezone] * * @param value * @return */ public static String marshalGMonthDay(Calendar value) { String result = "--"; result += marshalInt(value.get(Calendar.MONTH) + 1, 2); result += '-'; result += marshalInt(value.get(Calendar.DAY_OF_MONTH), 2); result += marshalTimeZone(value); return result; } /** * --MM[timezone] * * @param value * @return */ public static Calendar unmarshalGMonth(String value) { if(value.length() < 4 || value.charAt(0) != '-' || value.charAt(1) != '-') { throw new JBossXBValueFormatException("gMonth value does not follow the format '--MM': " + value); } Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(Calendar.MONTH, Integer.parseInt(value.substring(2, 4)) - 1); if(value.length() > 4) { cal.setTimeZone(parseTimeZone(value, 4)); } return cal; } /** * --MM[timezone] * * @param value * @return */ public static String marshalGMonth(Calendar value) { String result = "--"; result += marshalInt(value.get(Calendar.MONTH) + 1, 2); result += marshalTimeZone(value); return result; } public static Calendar unmarshalGYear(String value) { Calendar cal = Calendar.getInstance(); cal.clear(); int timeZone = parseGYear(value, 0, cal); if(value.length() > timeZone) { TimeZone tz = parseTimeZone(value, timeZone); cal.setTimeZone(tz); } return cal; } public static String marshalGYear(Calendar value) { String result = String.valueOf(value.get(Calendar.YEAR)); result += marshalTimeZone(value); return result; } /** * Unmarshals gYearDate string following the format [-]CCYY-MM[timezone] * * @param value * @return */ public static Calendar unmarshalGYearMonth(String value) { Calendar cal = Calendar.getInstance(); cal.clear(); int month = parseGYear(value, 0, cal); if(value.charAt(month) != '-') { throw new JBossXBValueFormatException( "gYearMonth value does not follow the format '[-]CCYY-MM[timezone]': " + value ); } cal.set(Calendar.MONTH, Integer.parseInt(value.substring(month + 1, month + 3)) - 1); if(value.length() > month + 3) { TimeZone tz = parseTimeZone(value, month + 3); cal.setTimeZone(tz); } return cal; } /** * [-]CCYY-MM[timezone] * * @param value * @return */ public static String marshalGYearMonth(Calendar value) { String result = String.valueOf(value.get(Calendar.YEAR)); result += '-'; result += marshalInt(value.get(Calendar.MONTH) + 1, 2); result += marshalTimeZone(value); return result; } /** * ---DD[timezonePart] * * @param value * @return */ public static Calendar unmarshalGDay(String value) { if(value.length() < 5 || value.charAt(0) != '-' || value.charAt(1) != '-' || value.charAt(2) != '-') { throw new NumberFormatException("gDay value does not follow the format (---DD[timezonePart]): " + value); } // validate day int day = Integer.parseInt(value.substring(3, 5)); if(day < 1 || day > 31) { throw new NumberFormatException("gDay value is not in the interval [1..31]: " + day); } // validate timezonePart TimeZone tz = parseTimeZone(value, 5); Calendar cal = Calendar.getInstance(); cal.clear(); if(tz != null) { cal.setTimeZone(tz); } cal.set(Calendar.DAY_OF_MONTH, day); return cal; } /** * ---DD[timezonePart] * * @param value * @return */ public static String marshalGDay(Calendar value) { String result = "---"; result += marshalInt(value.get(Calendar.DAY_OF_MONTH), 2); result += marshalTimeZone(value); return result; } /** * Parses a string value that represents date following the format defined in * http://www.w3.org/TR/xmlschema-2/#dateTime, i.e. '-'? yyyy '-' mm '-' dd. * Creates an instance of java.util.Calendar and initializes it to the parsed values of the year, month and day. * * @param value string date value * @return equivalent date as an instance of java.util.Calendar. */ public static Calendar unmarshalDate(String value) { Calendar cal = Calendar.getInstance(); cal.clear(); int ind = parseDate(value, 0, cal); TimeZone tz = null; if(ind < value.length()) { tz = parseTimeZone(value, ind); } if(tz != null) { cal.setTimeZone(tz); } return cal; } /** * [-]yyyy-mm-dd * * @param value string date value * @return equivalent date as an instance of java.util.Calendar. */ public static String marshalDate(Calendar value) { String result = marshalInt(value.get(Calendar.YEAR), 4); result += '-'; result += marshalInt(value.get(Calendar.MONTH) + 1, 2); result += '-'; result += marshalInt(value.get(Calendar.DAY_OF_MONTH), 2); result += marshalTimeZone(value); return result; } /** * Parses string representation of time following the format hh:mm:ss:sss with optional timezone indicator. * * @param value * @return */ public static Calendar unmarshalTime(String value) { Calendar cal = Calendar.getInstance(); cal.clear(); int tzLoc = parseTime(value, 0, cal); TimeZone tz = null; if(value.length() > tzLoc) { tz = parseTimeZone(value, tzLoc); } if(tz != null) { cal.setTimeZone(tz); } return cal; } /** * hh:mm:ss:sss[timezone] * * @param value * @return */ public static String marshalTime(Calendar value) { String result = marshalInt(value.get(Calendar.HOUR_OF_DAY), 2); result += ':'; result += marshalInt(value.get(Calendar.MINUTE), 2); result += ':'; result += marshalInt(value.get(Calendar.SECOND), 2); result += '.'; int millis = value.get(Calendar.MILLISECOND); if(millis > 99) { result += String.valueOf(millis); } else if(millis > 9) { result += "0" + String.valueOf(millis); } else { result += "00" + String.valueOf(millis); } result += marshalTimeZone(value); return result; } /** * Parses string value of datetime following the format [-]yyyy-mm-ddThh:mm:ss[.s+][timezone]. * * @param value * @return */ public static Calendar unmarshalDateTime(String value) { Calendar cal = Calendar.getInstance(); cal.clear(); int timeInd = parseDate(value, 0, cal); if(value.charAt(timeInd) != 'T') { throw new JBossXBValueFormatException("DateTime value does not follow the format '[-]yyyy-mm-ddThh:mm:ss[.s+][timezone]': expected 'T' but got " + value.charAt(timeInd) ); } int tzStart = parseTime(value, timeInd + 1, cal); TimeZone tz = null; if(value.length() > tzStart) { tz = parseTimeZone(value, tzStart); } if(tz != null) { cal.setTimeZone(tz); } return cal; } /** * [-]yyyy-mm-ddThh:mm:ss[.s+][timezone] * * @param value * @return */ public static String marshalDateTime(Calendar value) { String result = marshalInt(value.get(Calendar.YEAR), 4); result += '-'; result += marshalInt(value.get(Calendar.MONTH) + 1, 2); result += '-'; result += marshalInt(value.get(Calendar.DAY_OF_MONTH), 2); result += 'T'; result += marshalInt(value.get(Calendar.HOUR_OF_DAY), 2); result += ':'; result += marshalInt(value.get(Calendar.MINUTE), 2); result += ':'; result += marshalInt(value.get(Calendar.SECOND), 2); result += '.'; int millis = value.get(Calendar.MILLISECOND); if(millis > 99) { result += String.valueOf(millis); } else if(millis > 9) { result += "0" + String.valueOf(millis); } else { result += "00" + String.valueOf(millis); } result += marshalTimeZone(value); return result; } /** * Converts hexBinary value into byte array by encoding two subsequent hexadecimal digits into one byte. * * @param value * @return */ public static byte[] unmarshalHexBinary(String value) { if(value.length() % 2 != 0) { throw new IllegalArgumentException("hexBinary value must have even length."); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); for(int i = 0; i < value.length(); i += 2) { char c1 = value.charAt(i); char c2 = value.charAt(i + 1); byte b = 0; if((c1 >= '0') && (c1 <= '9')) { b += ((c1 - '0') * 16); } else if((c1 >= 'a') && (c1 <= 'f')) { b += ((c1 - 'a' + 10) * 16); } else if((c1 >= 'A') && (c1 <= 'F')) { b += ((c1 - 'A' + 10) * 16); } else { throw new IllegalArgumentException("hexBinary value contains illegal character: " + value); } if((c2 >= '0') && (c2 <= '9')) { b += (c2 - '0'); } else if((c2 >= 'a') && (c2 <= 'f')) { b += (c2 - 'a' + 10); } else if((c2 >= 'A') && (c2 <= 'F')) { b += (c2 - 'A' + 10); } else { throw new IllegalArgumentException("hexBinary value contains illegal character: " + value); } baos.write(b); } return (baos.toByteArray()); } /** * @param value * @return */ public static String marshalHexBinary(byte[] value) { StringBuffer result = new StringBuffer(2 * value.length); for(int i = 0; i < value.length; ++i) { result.append(convertDigit((value[i] >> 4))); result.append(convertDigit((value[i] & 0x0f))); } return result.toString(); } public static boolean isNormalizedString(String value) { for(int i = 0; i < value.length(); ++i) { char c = value.charAt(i); if(c == 0x09 || c == 0x0A || c == 0x0D) { return false; } } return true; } /** * Converts base64Binary value into byte array. */ public static byte[] unmarshalBase64(String value) { byte[] valueBytes; try { valueBytes = value.getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { valueBytes = value.getBytes(); } return Base64.decode(valueBytes, 0, valueBytes.length); } /** * Converts byte array into a base64Binary value. */ public static String marshalBase64(byte[] value) { return Base64.encodeBytes(value); } /** * Converts a value of form prefix:localPart into a QName * The prefix must be registered previously */ public static QName unmarshalQName(String value, NamespaceContext nsRegistry) { if(value.charAt(0) == '{') { int i = value.lastIndexOf('}'); if(i == -1) throw new IllegalStateException("Malformed QName: the closing '}' not found in " + value); String nsURI = value.substring(1, i); return new QName(nsURI, value.substring(i + 1)); } int colonIndex = value.lastIndexOf(":"); if(colonIndex > 0) { String prefix = value.substring(0, colonIndex); String nsURI = nsRegistry.getNamespaceURI(prefix); if(nsURI == null) { throw new IllegalStateException("No namespace URI registered for prefix: " + prefix); } String localPart = value.substring(colonIndex + 1); return new QName(nsURI, localPart, prefix); } else { return new QName(value); } } /** * Converts a QName value to form prefix:localPart * The prefix must be registered previously */ public static String marshalQName(QName value, NamespaceContext nsRegistry) { String nsURI = value.getNamespaceURI(); if(nsURI.length() > 0) { String prefix; if(nsRegistry != null) { prefix = nsRegistry.getPrefix(nsURI); if(prefix == null) { return '{' + nsURI + '}' + value.getLocalPart(); } } else { // WARN prefix = value.getPrefix(); } return prefix.length() > 0 ? prefix + ":" + value.getLocalPart() : value.getLocalPart(); } else { return value.getLocalPart(); } } public static boolean isValidToken(String value) { if(value != null && value.length() > 0) { if(value.charAt(0) == 0x20 || value.charAt(value.length() - 1) == 0x20) { return false; } for(int i = 0; i < value.length(); ++i) { char c = value.charAt(i); if(c == 0x09 || c == 0x0A || c == 0x0D) { return false; } else if(c == 0x20) { if(i + 1 < value.length() && value.charAt(i + 1) == 0x20) { return false; } } } } return true; } private static int parseGYear(String value, int start, Calendar cal) { int negative = (value.charAt(start) == '-' ? 1 : 0); cal.set(Calendar.YEAR, Integer.parseInt(value.substring(start, start + 4 + negative))); return start + 4 + negative; } private static int parseDate(String value, int start, Calendar cal) { if(value.charAt(start) == '-') { ++start; } if(!Character.isDigit(value.charAt(start))) { throw new JBossXBValueFormatException( "Date value does not follow the format '-'? yyyy '-' mm '-' dd: " + value ); } int nextToken = value.indexOf('-', start); if(nextToken == -1 || nextToken - start < 4) { throw new JBossXBValueFormatException( "Date value does not follow the format '-'? yyyy '-' mm '-' dd: " + value ); } int year = Integer.parseInt(value.substring(start, nextToken)); start = nextToken + 1; nextToken = value.indexOf('-', start); if(nextToken == -1 || nextToken - start < 2) { throw new JBossXBValueFormatException( "Date value does not follow the format '-'? yyyy '-' mm '-' dd: " + value ); } int month = Integer.parseInt(value.substring(start, nextToken)); start = nextToken + 1; nextToken += 3; int day = Integer.parseInt(value.substring(start, nextToken)); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month - 1); cal.set(Calendar.DAY_OF_MONTH, day); return nextToken; } /** * Parses string value of time following the format 'hh:mm:ss:sss' and sets time value on the passed in * java.util.Calendar instace. * * @param value * @param cal */ private static int parseTime(String value, int start, Calendar cal) { if(value.charAt(start + 2) != ':' || value.charAt(start + 5) != ':') { throw new JBossXBValueFormatException("Time value does not follow the format 'hh:mm:ss.[s+]': " + value); } int hh = Integer.parseInt(value.substring(start, start + 2)); int mm = Integer.parseInt(value.substring(start + 3, start + 5)); int ss = Integer.parseInt(value.substring(start + 6, start + 8)); int millis = 0; int x = start + 8; if(value.length() > x && value.charAt(x) == '.') { int mul = 100; for(x += 1; x < value.length(); x++) { char c = value.charAt(x); if(Character.isDigit(c)) { if(mul != 0) { millis += Character.digit(c, 10) * mul; mul = (mul == 1) ? 0 : mul / 10; } } else { break; } } } cal.set(Calendar.HOUR_OF_DAY, hh); cal.set(Calendar.MINUTE, mm); cal.set(Calendar.SECOND, ss); cal.set(Calendar.MILLISECOND, millis); return x; } /** * Parses timzone. * Format: [+/-]HH:MM * * @return */ private static TimeZone parseTimeZone(String value, int start) { TimeZone tz; if(value.charAt(start) == '+' || (value.charAt(start) == '-')) { if(value.length() - start == 6 && Character.isDigit(value.charAt(start + 1)) && Character.isDigit(value.charAt(start + 2)) && value.charAt(start + 3) == ':' && Character.isDigit(value.charAt(start + 4)) && Character.isDigit(value.charAt(start + 5))) { tz = TimeZone.getTimeZone("GMT" + value.substring(start)); } else { throw new NumberFormatException( "Timezone value does not follow the format ([+/-]HH:MM): " + value.substring(start) ); } } else if(value.charAt(start) == 'Z') { tz = TimeZone.getTimeZone("GMT"); } else { throw new NumberFormatException( "Timezone value does not follow the format ([+/-]HH:MM): " + value.substring(start) ); } return tz; } /** * Parses timezone. * Format: [+/-]HH:MM * * @return */ private static String marshalTimeZone(Calendar value) { int offset = value.get(Calendar.ZONE_OFFSET) + value.get(Calendar.DST_OFFSET); if(offset == 0) { return "Z"; } DecimalFormat hourFormat = new DecimalFormat("'+'00;-00"); DecimalFormat minuteFormat = new DecimalFormat("00"); int minutes = offset / (1000 * 60); int hours = minutes / 60; minutes -= (hours * 60); return hourFormat.format(hours) + ":" + minuteFormat.format(minutes); } private static String marshalInt(int value, int length) { String result = String.valueOf(value); if(result.length() < length) { while(result.length() < length) { result = '0' + result; } } else if(result.length() > length) { throw new JBossXBValueFormatException( "Can't marshal int value " + value + " to a string with length of " + length ); } return result; } private static char convertDigit(int value) { value &= 0x0f; if(value >= 10) { return ((char)(value - 10 + 'a')); } else { return ((char)(value + '0')); } } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/GenericObjectModelProvider.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/GenericObjectModelProvide0000644000175000017500000000433310470642610033164 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; /** * Direct implementations of ObjectModelProvider interface can be thought of as "typed" providers in a sense that * arguments of getChildren, getElementValue and getAttributeValue methods * are supposed to be of concrete Java types (other than java.lang.Object) from the target class hierarchy. * Contrary, in GenericObjectModelFactory these arguments are of type java.lang.Object. * The framework won't introspect an implementation of GenericObjectModelProvider to find "typed" implementations of * getChildren, getElementValue and getAttributeValue. * Instead it will call the generic methods. * * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public interface GenericObjectModelProvider extends ObjectModelProvider { Object getChildren(Object o, MarshallingContext ctx, String namespaceURI, String localName); Object getElementValue(Object o, MarshallingContext ctx, String namespaceURI, String localName); Object getAttributeValue(Object o, MarshallingContext ctx, String namespaceURI, String localName); } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/TypeBinding.java0000644000175000017500000000237710470642610031311 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public interface TypeBinding { Object unmarshal(String value); String marshal(Object value); } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/0000755000175000017500000000000011620316767030012 5ustar twernertwerner././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/CharactersMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/CharactersMetaDa0000644000175000017500000000376110470642610033066 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.metadata; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class CharactersMetaData { private PropertyMetaData property; private ValueMetaData value; private boolean mapEntryValue; private boolean mapEntryKey; public PropertyMetaData getProperty() { return property; } public void setProperty(PropertyMetaData property) { this.property = property; } public ValueMetaData getValue() { return value; } public void setValue(ValueMetaData value) { this.value = value; } public boolean isMapEntryValue() { return mapEntryValue; } public void setMapEntryValue(boolean mapEntryValue) { this.mapEntryValue = mapEntryValue; } public boolean isMapEntryKey() { return mapEntryKey; } public void setMapEntryKey(boolean mapEntryKey) { this.mapEntryKey = mapEntryKey; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/AddMethodMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/AddMethodMetaDat0000755000175000017500000000337710470642610033032 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.metadata; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class AddMethodMetaData { private String methodName; private String valueType; private boolean childType; public String getMethodName() { return methodName; } public void setMethodName(String methodName) { this.methodName = methodName; } public String getValueType() { return valueType; } public void setValueType(String valueType) { this.valueType = valueType; } public boolean isChildType() { return childType; } public void setChildType(boolean childType) { this.childType = childType; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/PutMethodMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/PutMethodMetaDat0000644000175000017500000000535010470642610033100 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.metadata; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class PutMethodMetaData { private String methodName; private String keyType; private String valueType; public String getName() { return methodName; } public void setName(String methodName) { this.methodName = methodName; } public String getKeyType() { return keyType; } public void setKeyType(String keyType) { this.keyType = keyType; } public String getValueType() { return valueType; } public void setValueType(String valueType) { this.valueType = valueType; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof PutMethodMetaData)) { return false; } final PutMethodMetaData putMethodMetaData = (PutMethodMetaData)o; if(keyType != null ? !keyType.equals(putMethodMetaData.keyType) : putMethodMetaData.keyType != null) { return false; } if(methodName != null ? !methodName.equals(putMethodMetaData.methodName) : putMethodMetaData.methodName != null) { return false; } if(valueType != null ? !valueType.equals(putMethodMetaData.valueType) : putMethodMetaData.valueType != null) { return false; } return true; } public int hashCode() { int result; result = (methodName != null ? methodName.hashCode() : 0); result = 29 * result + (keyType != null ? keyType.hashCode() : 0); result = 29 * result + (valueType != null ? valueType.hashCode() : 0); return result; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/PackageMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/PackageMetaData.0000644000175000017500000000424210470642610032740 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.metadata; import org.jboss.util.JBossStringBuilder; import org.jboss.util.Strings; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class PackageMetaData { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof PackageMetaData)) { return false; } final PackageMetaData packageMetaData = (PackageMetaData)o; if(name != null ? !name.equals(packageMetaData.name) : packageMetaData.name != null) { return false; } return true; } public int hashCode() { return (name != null ? name.hashCode() : 0); } public String toString() { JBossStringBuilder buffer = new JBossStringBuilder(); Strings.defaultToString(buffer, this); buffer.append('['); buffer.append("name=").append(name); buffer.append(']'); return buffer.toString(); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/XsdAnnotation.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/XsdAnnotation.ja0000644000175000017500000006046110470642610033115 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.metadata; import java.io.StringReader; import javax.xml.namespace.QName; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.GenericObjectModelFactory; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.Unmarshaller; import org.jboss.xb.binding.UnmarshallerFactory; import org.jboss.xb.binding.UnmarshallingContext; import org.jboss.logging.Logger; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class XsdAnnotation extends XsdElement { private static final Logger log = Logger.getLogger(XsdAnnotation.class); public XsdAnnotation(QName qName) { super(qName); } public static final XsdAnnotation unmarshal(String annotation) { Unmarshaller unmarshaller = UnmarshallerFactory.newInstance().newUnmarshaller(); unmarshaller.mapFactoryToNamespace(JaxbObjectModelFactory.INSTANCE, Constants.NS_JAXB); unmarshaller.mapFactoryToNamespace(JbxbObjectModelFactory.INSTANCE, Constants.NS_JBXB); try { return (XsdAnnotation)unmarshaller.unmarshal(new StringReader(annotation), XsdObjectModelFactory.INSTANCE, (Object)null ); } catch(JBossXBException e) { throw new JBossXBRuntimeException("Failed to parse annotation string: " + annotation + ": " + e.getMessage(), e ); } } public XsdAppInfo getAppInfo() { return (XsdAppInfo)getChild(XsdAppInfo.QNAME); } // Inner private static abstract class AbstractGOMF implements GenericObjectModelFactory { public Object newChild(Object parent, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs) { return null; } public void addChild(Object parent, Object child, UnmarshallingContext ctx, String namespaceURI, String localName) { XsdElement p = (XsdElement)parent; XsdElement c = (XsdElement)child; p.addChild(c); } public void setValue(Object o, UnmarshallingContext ctx, String namespaceURI, String localName, String value) { XsdElement e = (XsdElement)o; e.setData(value); } public Object completeRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName) { return root; } } private static final class XsdObjectModelFactory extends AbstractGOMF { public static final GenericObjectModelFactory INSTANCE = new XsdObjectModelFactory(); public Object newChild(Object parent, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs) { XsdElement element = null; if("appinfo".equals(localName)) { element = new XsdAppInfo(); for(int i = 0; i < attrs.getLength(); ++i) { element.addAttribute(new QName(attrs.getURI(i), attrs.getLocalName(i)), attrs.getValue(i)); } } return element; } public void addChild(Object parent, Object child, UnmarshallingContext ctx, String namespaceURI, String localName) { if(parent instanceof XsdAppInfo) { XsdAppInfo appInfo = (XsdAppInfo)parent; if(child instanceof ClassMetaData) { appInfo.setClassMetaData((ClassMetaData)child); } else if(child instanceof PropertyMetaData) { appInfo.setPropertyMetaData((PropertyMetaData)child); } else if(child instanceof SchemaMetaData) { appInfo.setSchemaMetaData((SchemaMetaData)child); } else if(child instanceof ValueMetaData) { appInfo.setValueMetaData((ValueMetaData)child); } else if(child instanceof CharactersMetaData) { appInfo.setCharactersMetaData((CharactersMetaData)child); } } else { super.addChild(parent, child, ctx, namespaceURI, localName); } } public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs) { return new XsdAnnotation(new QName(namespaceURI, localName)); } } private static final class JaxbObjectModelFactory implements GenericObjectModelFactory { public static final GenericObjectModelFactory INSTANCE = new JaxbObjectModelFactory(); public Object newChild(Object parent, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs) { Object element = null; if("package".equals(localName)) { element = new PackageMetaData(); setAttributes(element, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("name".equals(localName)) { ((PackageMetaData)o).setName(value); } } } ); } else if("javaType".equals(localName)) { ValueMetaData valueMetaData = new ValueMetaData(); setAttributes(valueMetaData, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("parseMethod".equals(localName)) { ((ValueMetaData)o).setUnmarshalMethod(value); } else if("printMethod".equals(localName)) { ((ValueMetaData)o).setMarshalMethod(value); } } } ); // todo review this... XsdAppInfo appInfo = (XsdAppInfo)parent; appInfo.setValueMetaData(valueMetaData); } return element; } public void addChild(Object parent, Object child, UnmarshallingContext ctx, String namespaceURI, String localName) { if(parent instanceof SchemaMetaData) { SchemaMetaData schemaMetaData = (SchemaMetaData)parent; if(child instanceof PackageMetaData) { schemaMetaData.setPackage((PackageMetaData)child); } else { schemaMetaData.addValue((ValueMetaData)child); } } } public void setValue(Object o, UnmarshallingContext ctx, String namespaceURI, String localName, String value) { } public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs) { Object element = null; if("schemaBindings".equals(localName)) { element = new SchemaMetaData(); } else if("property".equals(localName)) { PropertyMetaData property = new PropertyMetaData(); setAttributes(property, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("name".equals(localName)) { ((PropertyMetaData)o).setName(value); } else if("collectionType".equals(localName)) { ((PropertyMetaData)o).setCollectionType(value); } } } ); //element = property; XsdAppInfo appInfo = (XsdAppInfo)root; appInfo.setPropertyMetaData(property); // return null; } else if("class".equals(localName)) { element = new ClassMetaData(); setAttributes(element, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("implClass".equals(localName)) { ((ClassMetaData)o).setImpl(value); } } } ); } else if("javaType".equals(localName)) { element = new ValueMetaData(); setAttributes(element, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("printMethod".equals(localName)) { ((ValueMetaData)o).setMarshalMethod(value); } else if("parseMethod".equals(localName)) { ((ValueMetaData)o).setUnmarshalMethod(value); } } } ); } return element; } public Object completeRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName) { return root; } private void setAttributes(Object o, Attributes attrs, AttributeSetter attrSetter) { for(int i = 0; i < attrs.getLength(); ++i) { attrSetter.setAttribute(o, attrs.getURI(i), attrs.getLocalName(i), attrs.getValue(i)); } } } private static final class JbxbObjectModelFactory implements GenericObjectModelFactory { public static final JbxbObjectModelFactory INSTANCE = new JbxbObjectModelFactory(); public Object newChild(Object parent, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs) { Object child = null; // schemaBindings/package if("package".equals(localName)) { child = new PackageMetaData(); setAttributes(child, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("name".equals(localName)) { ((PackageMetaData)o).setName(value); } } } ); } else if("value".equals(localName)) { child = new ValueMetaData(); setAttributes(child, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("marshalMethod".equals(localName)) { ((ValueMetaData)o).setMarshalMethod(value); } else if("unmarshalMethod".equals(localName)) { ((ValueMetaData)o).setUnmarshalMethod(value); } } } ); } else if("property".equals(localName)) { PropertyMetaData property = new PropertyMetaData(); setAttributes(property, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("name".equals(localName)) { ((PropertyMetaData)o).setName(value); } else if("collectionType".equals(localName)) { ((PropertyMetaData)o).setCollectionType(value); } } } ); if(parent instanceof XsdAppInfo) { ((XsdAppInfo)parent).setPropertyMetaData(property); } else { ((CharactersMetaData)parent).setProperty(property); } } else if("mapEntryKey".equals(localName)) { if(parent instanceof XsdAppInfo) { ((XsdAppInfo)parent).setMapEntryKey(true); } else { ((CharactersMetaData)parent).setMapEntryKey(true); } } else if("mapEntryValue".equals(localName)) { if(parent instanceof XsdAppInfo) { ((XsdAppInfo)parent).setMapEntryValue(true); } else { ((CharactersMetaData)parent).setMapEntryValue(true); } } else if("skip".equals(localName)) { XsdAppInfo appInfo = (XsdAppInfo)parent; appInfo.setSkip(true); } else { // Log a warning for any unexpected elements if( "ignoreUnresolvedFieldOrClass".equals(localName) == false && "replacePropertyRefs".equals(localName) == false ) { log.warn("newChild: " + localName); } } return child; } public void addChild(Object parent, Object child, UnmarshallingContext ctx, String namespaceURI, String localName) { if(child instanceof PackageMetaData) { SchemaMetaData schema = (SchemaMetaData)parent; schema.setPackage((PackageMetaData)child); } else if(child instanceof ValueMetaData) { ValueMetaData valueMetaData = (ValueMetaData)child; if(parent instanceof XsdAppInfo) { ((XsdAppInfo)parent).setValueMetaData(valueMetaData); } else { ((CharactersMetaData)parent).setValue(valueMetaData); } } else if(child instanceof CharactersMetaData) { CharactersMetaData charMD = (CharactersMetaData)child; ((XsdAppInfo)parent).setCharactersMetaData(charMD); } else { log.warn("addChild: " + localName + "=" + child); } } public void setValue(Object o, UnmarshallingContext ctx, String namespaceURI, String localName, String value) { // schemaBindings/ignoreUnresolvedFieldOrClass if( "ignoreUnresolvedFieldOrClass".equals(localName) ) { SchemaMetaData schema = (SchemaMetaData) o; Boolean flag = Boolean.valueOf(value); schema.setIgnoreUnresolvedFieldOrClass(flag.booleanValue()); } // schemaBindings/replacePropertyRefs else if( "replacePropertyRefs".equals(localName) ) { SchemaMetaData schema = (SchemaMetaData) o; Boolean flag = Boolean.valueOf(value); schema.setReplacePropertyRefs(flag.booleanValue()); } else { log.warn("setValue: " + localName + "=" + value); } } public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs) { Object element = null; if("schemaBindings".equals(localName)) { element = new SchemaMetaData(); } // Legacy schema element name change to schemaBindings for jaxb consistency else if("schema".equals(localName)) { element = new SchemaMetaData(); } else if("value".equals(localName)) { element = new ValueMetaData(); setAttributes(element, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("marshalMethod".equals(localName)) { ((ValueMetaData)o).setMarshalMethod(value); } else if("unmarshalMethod".equals(localName)) { ((ValueMetaData)o).setUnmarshalMethod(value); } } } ); } else if("class".equals(localName)) { element = new ClassMetaData(); setAttributes(element, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("impl".equals(localName)) { ((ClassMetaData)o).setImpl(value); } } } ); } else if("property".equals(localName)) { PropertyMetaData property = new PropertyMetaData(); setAttributes(property, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("name".equals(localName)) { ((PropertyMetaData)o).setName(value); } else if("collectionType".equals(localName)) { ((PropertyMetaData)o).setCollectionType(value); } } } ); XsdAppInfo appInfo = (XsdAppInfo)root; appInfo.setPropertyMetaData(property); } else if("putMethod".equals(localName)) { PutMethodMetaData putMethod = new PutMethodMetaData(); setAttributes(putMethod, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("name".equals(localName)) { ((PutMethodMetaData)o).setName(value); } else if("keyType".equals(localName)) { ((PutMethodMetaData)o).setKeyType(value); } else if("valueType".equals(localName)) { ((PutMethodMetaData)o).setValueType(value); } } } ); XsdAppInfo appInfo = (XsdAppInfo)root; appInfo.setPutMethodMetaData(putMethod); } else if("addMethod".equals(localName)) { AddMethodMetaData addMethod = new AddMethodMetaData(); setAttributes(addMethod, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("name".equals(localName)) { ((AddMethodMetaData)o).setMethodName(value); } else if("valueType".equals(localName)) { if("child".equals(value)) { ((AddMethodMetaData)o).setChildType(true); } else { ((AddMethodMetaData)o).setValueType(value); } } } } ); XsdAppInfo appInfo = (XsdAppInfo)root; appInfo.setAddMethodMetaData(addMethod); } else if("mapEntry".equals(localName)) { MapEntryMetaData mapEntry = new MapEntryMetaData(); setAttributes(mapEntry, attrs, new AttributeSetter() { public void setAttribute(Object o, String nsUri, String localName, String value) { if("impl".equals(localName)) { ((MapEntryMetaData)o).setImpl(value); } else if("getKeyMethod".equals(localName)) { ((MapEntryMetaData)o).setGetKeyMethod(value); } else if("setKeyMethod".equals(localName)) { ((MapEntryMetaData)o).setSetKeyMethod(value); } else if("getValueMethod".equals(localName)) { ((MapEntryMetaData)o).setGetValueMethod(value); } else if("setValueMethod".equals(localName)) { ((MapEntryMetaData)o).setSetValueMethod(value); } else if("valueType".equals(localName)) { ((MapEntryMetaData)o).setValueType(value); } else if("nonNullValue".equals(localName)) { boolean b = Boolean.valueOf(value).booleanValue(); ((MapEntryMetaData)o).setNonNullValue(b); } } } ); XsdAppInfo appInfo = (XsdAppInfo)root; appInfo.setMapEntryMetaData(mapEntry); } else if("mapEntryKey".equals(localName)) { XsdAppInfo appInfo = (XsdAppInfo)root; appInfo.setMapEntryKey(true); } else if("mapEntryValue".equals(localName)) { XsdAppInfo appInfo = (XsdAppInfo)root; appInfo.setMapEntryValue(true); } else if("characters".equals(localName)) { element = new CharactersMetaData(); } else if("skip".equals(localName)) { XsdAppInfo appInfo = (XsdAppInfo)root; appInfo.setSkip(true); } else { log.warn("Unexpected jbxb annotation: ns=" + namespaceURI + ", localName=" + localName); } return element; } public Object completeRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName) { return root; } // Private private void setAttributes(Object o, Attributes attrs, AttributeSetter attrSetter) { for(int i = 0; i < attrs.getLength(); ++i) { attrSetter.setAttribute(o, attrs.getURI(i), attrs.getLocalName(i), attrs.getValue(i)); } } } interface AttributeSetter { void setAttribute(Object o, String nsUri, String localName, String value); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/ValueMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/ValueMetaData.ja0000644000175000017500000000613310470642610032775 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.metadata; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class ValueMetaData { private String id; private String ref; private String unmarshalMethod; private String marshalMethod; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getRef() { return ref; } public void setRef(String ref) { this.ref = ref; } public String getUnmarshalMethod() { return unmarshalMethod; } public void setUnmarshalMethod(String unmarshalMethod) { this.unmarshalMethod = unmarshalMethod; } public String getMarshalMethod() { return marshalMethod; } public void setMarshalMethod(String marshalMethod) { this.marshalMethod = marshalMethod; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof ValueMetaData)) { return false; } final ValueMetaData valueMetaData = (ValueMetaData)o; if(id != null ? !id.equals(valueMetaData.id) : valueMetaData.id != null) { return false; } if(marshalMethod != null ? !marshalMethod.equals(valueMetaData.marshalMethod) : valueMetaData.marshalMethod != null) { return false; } if(ref != null ? !ref.equals(valueMetaData.ref) : valueMetaData.ref != null) { return false; } if(unmarshalMethod != null ? !unmarshalMethod.equals(valueMetaData.unmarshalMethod) : valueMetaData.unmarshalMethod != null) { return false; } return true; } public int hashCode() { int result; result = (id != null ? id.hashCode() : 0); result = 29 * result + (ref != null ? ref.hashCode() : 0); result = 29 * result + (unmarshalMethod != null ? unmarshalMethod.hashCode() : 0); result = 29 * result + (marshalMethod != null ? marshalMethod.hashCode() : 0); return result; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/SchemaMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/SchemaMetaData.j0000644000175000017500000000525511061473704032767 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.metadata; import java.util.Map; import java.util.Collections; import java.util.HashMap; /** * Metadata for the SchemaBinding instance. * * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class SchemaMetaData { private PackageMetaData packageMetaData; private Map values = Collections.emptyMap(); private boolean ignoreUnresolvedFieldOrClass = true; private boolean replacePropertyRefs = true; public boolean isIgnoreUnresolvedFieldOrClass() { return ignoreUnresolvedFieldOrClass; } public void setIgnoreUnresolvedFieldOrClass(boolean flag) { this.ignoreUnresolvedFieldOrClass = flag; } public boolean isReplacePropertyRefs() { return replacePropertyRefs; } public void setReplacePropertyRefs(boolean flag) { this.replacePropertyRefs = flag; } public PackageMetaData getPackage() { return packageMetaData; } public void setPackage(PackageMetaData pkg) { this.packageMetaData = pkg; } public ValueMetaData getValue(String id) { return (ValueMetaData)values.get(id); } public void addValue(ValueMetaData value) { if(value.getId() == null) { throw new IllegalArgumentException("ValueMetaData must have a non-null id."); } switch(values.size()) { case 0: values = Collections.singletonMap(value.getId(), value); break; case 1: values = new HashMap(values); default: values.put(value.getId(), value); } } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/MapEntryMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/MapEntryMetaData0000644000175000017500000000510510470642610033065 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.metadata; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class MapEntryMetaData { private String impl; private String getKeyMethod; private String setKeyMethod; private String getValueMethod; private String setValueMethod; private String valueType; private boolean nonNullValue; public String getImpl() { return impl; } public void setImpl(String impl) { this.impl = impl; } public String getGetKeyMethod() { return getKeyMethod; } public void setGetKeyMethod(String getKeyMethod) { this.getKeyMethod = getKeyMethod; } public String getSetKeyMethod() { return setKeyMethod; } public void setSetKeyMethod(String setKeyMethod) { this.setKeyMethod = setKeyMethod; } public String getGetValueMethod() { return getValueMethod; } public void setGetValueMethod(String getValueMethod) { this.getValueMethod = getValueMethod; } public String getSetValueMethod() { return setValueMethod; } public void setSetValueMethod(String setValueMethod) { this.setValueMethod = setValueMethod; } public String getValueType() { return valueType; } public void setValueType(String valueType) { this.valueType = valueType; } public boolean isNonNullValue() { return nonNullValue; } public void setNonNullValue(boolean nonNullValue) { this.nonNullValue = nonNullValue; } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/PropertyMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/PropertyMetaData0000644000175000017500000000307310470642610033154 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.metadata; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class PropertyMetaData { private String name; private String collectionType; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCollectionType() { return collectionType; } public void setCollectionType(String collectionType) { this.collectionType = collectionType; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/unmarshalling/0000755000175000017500000000000011620316767032656 5ustar twernertwerner././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/unmarshalling/DocumentBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/unmarshalling/Do0000644000175000017500000000235610470642610033140 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.metadata.unmarshalling; /** * @author Alexey Loubyansky * @version $Revision: $ */ public interface DocumentBinding { } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/XsdAppInfo.java0000644000175000017500000000775110470642610032671 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.metadata; import javax.xml.namespace.QName; import org.jboss.xb.binding.Constants; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class XsdAppInfo extends XsdElement { static final QName QNAME = new QName(Constants.NS_XML_SCHEMA, "appinfo"); private SchemaMetaData schemaMetaData; private ClassMetaData classMetaData; private PropertyMetaData propertyMetaData; private MapEntryMetaData mapEntryMetaData; private PutMethodMetaData putMethodMetaData; private AddMethodMetaData addMethodMetaData; private ValueMetaData valueMetaData; private CharactersMetaData charactersMetaData; private boolean mapEntryKey; private boolean mapEntryValue; private boolean skip; public XsdAppInfo() { super(QNAME); } public SchemaMetaData getSchemaMetaData() { return schemaMetaData; } public void setSchemaMetaData(SchemaMetaData schema) { this.schemaMetaData = schema; } public ClassMetaData getClassMetaData() { return classMetaData; } public void setClassMetaData(ClassMetaData classMetaData) { this.classMetaData = classMetaData; } public PropertyMetaData getPropertyMetaData() { return propertyMetaData; } public void setPropertyMetaData(PropertyMetaData propertyMetaData) { this.propertyMetaData = propertyMetaData; } public MapEntryMetaData getMapEntryMetaData() { return mapEntryMetaData; } public void setMapEntryMetaData(MapEntryMetaData mapEntryMetaData) { this.mapEntryMetaData = mapEntryMetaData; } public ValueMetaData getValueMetaData() { return valueMetaData; } public void setValueMetaData(ValueMetaData valueMetaData) { this.valueMetaData = valueMetaData; } public boolean isMapEntryKey() { return mapEntryKey; } public void setMapEntryKey(boolean mapEntryKey) { this.mapEntryKey = mapEntryKey; } public boolean isMapEntryValue() { return mapEntryValue; } public void setMapEntryValue(boolean mapEntryValue) { this.mapEntryValue = mapEntryValue; } public PutMethodMetaData getPutMethodMetaData() { return putMethodMetaData; } public void setPutMethodMetaData(PutMethodMetaData putMethodMetaData) { this.putMethodMetaData = putMethodMetaData; } public void setAddMethodMetaData(AddMethodMetaData addMethod) { this.addMethodMetaData = addMethod; } public AddMethodMetaData getAddMethodMetaData() { return addMethodMetaData; } public boolean isSkip() { return skip; } public void setSkip(boolean skip) { this.skip = skip; } public CharactersMetaData getCharactersMetaData() { return charactersMetaData; } public void setCharactersMetaData(CharactersMetaData charactersMetaData) { this.charactersMetaData = charactersMetaData; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/ClassMetaData.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/ClassMetaData.ja0000644000175000017500000000530610470642610032767 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.metadata; import org.jboss.util.JBossStringBuilder; import org.jboss.util.Strings; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class ClassMetaData { private String impl; private Boolean useNoArgCtor; public String getImpl() { return impl; } public void setImpl(String impl) { this.impl = impl; } /** * Whether no-arg ctor should be used if it declared even if there are * other ctors declared. * * @return true - no-arg ctor should be used if it declared even if there are * other ctors declared; * false - no-arg ctor should be used only if other ctors could not be; * null - use SchemaBinding's default. */ public Boolean isUseNoArgCtor() { return useNoArgCtor; } public void setUseNoArgCtor(Boolean useNoArgCtor) { this.useNoArgCtor = useNoArgCtor; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof ClassMetaData)) { return false; } final ClassMetaData classMetaData = (ClassMetaData)o; if(impl != null ? !impl.equals(classMetaData.impl) : classMetaData.impl != null) { return false; } return true; } public int hashCode() { return (impl != null ? impl.hashCode() : 0); } public String toString() { JBossStringBuilder buffer = new JBossStringBuilder(); Strings.defaultToString(buffer, this); buffer.append('['); buffer.append("impl=").append(impl); buffer.append(']'); return buffer.toString(); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/metadata/XsdElement.java0000644000175000017500000000637511061473704032732 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.metadata; import java.util.HashMap; import java.util.Collections; import java.util.Map; import javax.xml.namespace.QName; /** * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class XsdElement { public static final QName QNAME_NAME = new QName("name"); private final QName qName; private Map attributes = Collections.emptyMap(); private Map children = Collections.emptyMap(); private String data; public XsdElement(QName qName) { this.qName = qName; } public String getAttribute(QName qName) { return (String)attributes.get(qName); } public void addAttribute(QName qName, String value) { switch(attributes.size()) { case 0: attributes = Collections.singletonMap(qName, value); break; case 1: attributes = new HashMap(attributes); default: attributes.put(qName, value); } } public XsdElement getChild(QName qName) { return (XsdElement)children.get(qName); } public void addChild(XsdElement child) { switch(children.size()) { case 0: children = Collections.singletonMap(child.qName, child); break; case 1: children = new HashMap(children); default: children.put(child.qName, child); } } public String getData() { return data; } public void setData(String data) { this.data = data; } public QName getQName() { return qName; } public String getNameAttribute() { return getAttribute(QNAME_NAME); } public void setNameAttribute(String name) { addAttribute(QNAME_NAME, name); } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof XsdElement)) { return false; } final XsdElement xsdElement = (XsdElement)o; if(!qName.equals(xsdElement.qName)) { return false; } return true; } public int hashCode() { return qName.hashCode(); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/ObjectModelProvider.java0000644000175000017500000001232610470642610032772 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; /** * The interface all object model providers must implement. Object model providers are used on marshalling * providing data for XML content based on the object model and XML schema or DTD. *

* Each object model provider must implement one method getRoot defined in ObjectModelProvider interface * and a set of getChildren, getElementValue and getAttributeValue methods descovered by the framework at runtime * with introspection. *

So, the following methods should be implemented: *

    *
  • getRoot method *
     *    java.lang.Object getRoot(java.lang.Object o, java.lang.String namespaceURI, java.lang.String localName)
     * 
    * This method is called on the object model provider by the framework when a root XML element is marshalled. * The method returns an object that represents the root of the XML content corresponding to the namespace URI and * local name. *
  • *
  • a set of getChildren methods * This method is called on the object model provider by the framework when marshalling of a new XML element started. * Each getChildren method must have three arguments: *
      *
    1. parent object of a concrete Java type (not java.lang.Object) that is "asked" for its children
    2. *
    3. namespace URI of the child XML element as java.lang.String
    4. *
    5. local name of the child element as java.lang.String
    6. *
    * A getChildren method returns children that represent the namespace URI and local name in XML content. * The method can return null if there are no children in this object graph corresponding to the namespace and local name. * The method can return a single object if there is only one child object corresponding to the namespace and local name. * If there are many children that match the namespace URI and local name, the method can return them as an array, * java.util.List, java.util.Collection or java.util.Iterator. *
  • *
  • a set of getElementValue methods * This method is called on the object model provider by the framework for objects that represent XML elements with * simple content, i.e. elements that don't contain nested XML elements. * The method must have three arguments: *
      *
    1. an object of a concrete Java type (not java.lang.Object) that is "asked" to provide a value of the XML element * being marshalled
    2. *
    3. namespace URI as java.lang.String of the XML element being marshalled
    4. *
    5. local name as java.lang.String of the XML element being marshalled
    6. *
    * The method returns either null if the object model does not have any value corresponding to the namespace URI * and local name (in this case the XML content will not contain this XML element) or the actual value of the XML element. *
  • *
  • a set of getAttributeValue methods * This method is called on the object model provider by the framework for objects that represent XML elements with * attributes. * The method must have three arguments: *
      *
    1. an object of a concrete Java type (not java.lang.Object) that is "asked" to provide a value for the XML attribute * being marshalled
    2. *
    3. namespace URI of the XML attribute being marshalled
    4. *
    5. local name of the XML attribute being marshalled
    6. *
    * The method returns either null if the object graph does not have any value corresponding to the namespace URI * and local name (in this case the XML content will not contain this attribute) or the actual value of the XML attribute. *
  • * * * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public interface ObjectModelProvider { /** * Called by the framework when a root XML element is marshalled. * * @param o the root of the object graph * @param ctx * @param namespaceURI namespace URI of the root XML element being marshalled * @param localName local name of the root XML element being marshalled * @return an object that represents the root XML element corresponding to the namespace URI and local name */ Object getRoot(Object o, MarshallingContext ctx, String namespaceURI, String localName); } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/UnmarshallerImpl.java0000644000175000017500000001763111477212467032366 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import java.io.InputStream; import java.io.Reader; import org.jboss.xb.binding.metadata.unmarshalling.DocumentBinding; import org.jboss.xb.binding.parser.JBossXBParser; import org.jboss.xb.binding.parser.sax.SaxJBossXBParser; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; /** * Unmarshaller implementation. * WARNING: this implementation is not thread-safe. * * @author Alexey Loubyansky * @version $Revision: 4874 $ */ public class UnmarshallerImpl implements Unmarshaller { private ObjectModelBuilder builder; private final JBossXBParser parser; // Constructor /** * The constructor for DTD and XSD client awareness. */ public UnmarshallerImpl() throws JBossXBException { parser = new SaxJBossXBParser(); } public void setValidation(boolean validation) throws JBossXBException { parser.setFeature(VALIDATION, validation); /* Only set DYNAMIC_VALIDATION to false. Setting this to true if its not already requires a document to have a DOCTYPE declaring the root element */ if( validation == false ) parser.setFeature(DYNAMIC_VALIDATION, false); } public void setSchemaValidation(boolean validation) throws JBossXBException { parser.setFeature(SCHEMA_VALIDATION, validation); } public void setFeature(String feature, boolean value) throws JBossXBException { parser.setFeature(feature, value); } public void setNamespaceAware(boolean namespaces) throws JBossXBException { parser.setFeature(NAMESPACES, namespaces); } public void setEntityResolver(EntityResolver entityResolver) throws JBossXBException { parser.setEntityResolver(entityResolver); } public void setErrorHandler(ErrorHandler errorHandler) { // todo reader.setErrorHandler(errorHandler); } public void setWarnOnParserErrors(boolean value) { parser.setWarnOnParserErrors(value); } public boolean isWarnOnParserErrors() { return parser.getWarnOnParserErrors(); } public void mapFactoryToNamespace(ObjectModelFactory factory, String namespaceUri) { if(builder == null) { builder = new ObjectModelBuilder(); } builder.mapFactoryToNamespace(factory, namespaceUri); } public Object unmarshal(String xmlFile) throws JBossXBException { // todo throw new UnsupportedOperationException(); } public Object unmarshal(String xmlFile, JBossXBParser.ContentHandler handler) throws JBossXBException { parser.parse(xmlFile, handler); return handler.getRoot(); } public Object unmarshal(String xml, SchemaBinding schemaBinding) throws JBossXBException { JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaBinding); parser.parse(xml, cHandler); return cHandler.getRoot(); } public Object unmarshal(Reader xmlReader, SchemaBinding schemaBinding) throws JBossXBException { JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaBinding); parser.parse(xmlReader, cHandler); return cHandler.getRoot(); } public Object unmarshal(InputStream xmlStream, SchemaBinding schemaBinding) throws JBossXBException { JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaBinding); parser.parse(xmlStream, cHandler); return cHandler.getRoot(); } public Object unmarshal(InputSource source, SchemaBinding schemaBinding) throws JBossXBException { JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaBinding); parser.parse(source, cHandler); return cHandler.getRoot(); } public Object unmarshal(String xml, SchemaBindingResolver schemaResolver) throws JBossXBException { JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaResolver); parser.parse(xml, cHandler); return cHandler.getRoot(); } public Object unmarshal(Reader xmlReader, SchemaBindingResolver schemaResolver) throws JBossXBException { JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaResolver); parser.parse(xmlReader, cHandler); return cHandler.getRoot(); } public Object unmarshal(InputStream xmlStream, SchemaBindingResolver schemaResolver) throws JBossXBException { JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaResolver); parser.parse(xmlStream, cHandler); return cHandler.getRoot(); } public Object unmarshal(InputSource source, SchemaBindingResolver schemaResolver) throws JBossXBException { JBossXBParser.ContentHandler cHandler = new SundayContentHandler(schemaResolver); parser.parse(source, cHandler); return cHandler.getRoot(); } public Object unmarshal(Reader reader, ObjectModelFactory factory, Object root) throws JBossXBException { if(builder == null) { builder = new ObjectModelBuilder(); } builder.init(factory, root); parser.parse(reader, builder); return builder.getRoot(); } public Object unmarshal(InputStream is, ObjectModelFactory factory, Object root) throws JBossXBException { if(builder == null) { builder = new ObjectModelBuilder(); } builder.init(factory, root); parser.parse(is, builder); return builder.getRoot(); } public Object unmarshal(String systemId, ObjectModelFactory factory, Object root) throws JBossXBException { if(builder == null) { builder = new ObjectModelBuilder(); } builder.init(factory, root); parser.parse(systemId, builder); return builder.getRoot(); } public Object unmarshal(InputSource is, ObjectModelFactory factory, Object root) throws JBossXBException { if(builder == null) { builder = new ObjectModelBuilder(); } builder.init(factory, root); parser.parse(is, builder); return builder.getRoot(); } public Object unmarshal(String systemId, ObjectModelFactory factory, DocumentBinding binding) throws JBossXBException { if(binding != null) { throw new IllegalStateException("DocumentBinding API is not supported anymore!"); } return unmarshal(systemId, factory, (Object)null); } public Object unmarshal(Reader reader, ObjectModelFactory factory, DocumentBinding binding) throws JBossXBException { if(binding != null) { throw new IllegalStateException("DocumentBinding API is not supported anymore!"); } return unmarshal(reader, factory, (Object)null); } JBossXBParser getParser() { return parser; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/Unmarshaller.java0000644000175000017500000001142111477212467031533 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import java.io.InputStream; import java.io.Reader; import org.jboss.xb.binding.metadata.unmarshalling.DocumentBinding; import org.jboss.xb.binding.parser.JBossXBParser; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; /** * @author Alexey Loubyansky * @version $Revision: 4874 $ */ public interface Unmarshaller extends FeatureAware { String VALIDATION = "http://xml.org/sax/features/validation"; String NAMESPACES = "http://xml.org/sax/features/namespaces"; String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes"; // set some xerces specific features that allow transparent DTD and Schema validation String DYNAMIC_VALIDATION = "http://apache.org/xml/features/validation/dynamic"; String SCHEMA_VALIDATION = "http://apache.org/xml/features/validation/schema"; String SCHEMA_FULL_CHECKING = "http://apache.org/xml/features/validation/schema-full-checking"; void setValidation(boolean validation) throws JBossXBException; void setNamespaceAware(boolean namespaces) throws JBossXBException; void setSchemaValidation(boolean validation) throws JBossXBException; /** * This property controls whether the (underlying) parser errors should be * logged as warnings or should they terminate parsing with errors. * The default is to terminate parsing by re-throwing parser errors. */ void setWarnOnParserErrors(boolean value); /** * This property controls whether the (underlying) parser errors should be * logged as warnings or should they terminate parsing with errors. * The default is to terminate parsing by re-throwing parser errors. * * @return false if parser errors should be logged as warnings, otherwise - true */ boolean isWarnOnParserErrors(); void setEntityResolver(EntityResolver entityResolver) throws JBossXBException; /** * @deprecated */ void setErrorHandler(ErrorHandler errorHandler); void mapFactoryToNamespace(ObjectModelFactory factory, String namespaceUri); Object unmarshal(String xmlFile, JBossXBParser.ContentHandler handler) throws JBossXBException; Object unmarshal(String xmlFile) throws JBossXBException; Object unmarshal(String xml, SchemaBinding schemaBinding) throws JBossXBException; Object unmarshal(Reader xmlReader, SchemaBinding schemaBinding) throws JBossXBException; Object unmarshal(InputStream xmlStream, SchemaBinding schemaBinding) throws JBossXBException; Object unmarshal(InputSource source, SchemaBinding schemaBinding) throws JBossXBException; Object unmarshal(String xml, SchemaBindingResolver schemaResolver) throws JBossXBException; Object unmarshal(Reader xmlReader, SchemaBindingResolver schemaResolver) throws JBossXBException; Object unmarshal(InputStream xmlStream, SchemaBindingResolver schemaResolver) throws JBossXBException; Object unmarshal(InputSource source, SchemaBindingResolver schemaResolver) throws JBossXBException; Object unmarshal(Reader reader, ObjectModelFactory factory, Object root) throws JBossXBException; Object unmarshal(InputStream is, ObjectModelFactory factory, Object root) throws JBossXBException; Object unmarshal(InputSource source, ObjectModelFactory factory, Object root) throws JBossXBException; Object unmarshal(String systemId, ObjectModelFactory factory, Object root) throws JBossXBException; Object unmarshal(String systemId, ObjectModelFactory factory, DocumentBinding binding) throws JBossXBException; Object unmarshal(Reader reader, ObjectModelFactory factory, DocumentBinding binding) throws JBossXBException; } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/ObjectLocalMarshaller.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/ObjectLocalMarshaller.jav0000755000175000017500000000237010470642610033124 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public interface ObjectLocalMarshaller { void marshal(MarshallingContext ctx, Object o); } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/0000755000175000017500000000000011620316767027535 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/marshalling/0000755000175000017500000000000011620316765032034 5ustar twernertwerner././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/marshalling/AbstractAttributeMarshaller.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/marshalling/Abstra0000755000175000017500000000303010470642610033163 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.marshalling; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public abstract class AbstractAttributeMarshaller implements AttributeMarshaller { public abstract Object getValue(MarshallingContext ctx); public abstract String marshalValue(MarshallingContext ctx, Object value); public String marshal(MarshallingContext ctx) { Object value = getValue(ctx); return marshalValue(ctx, value); } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/marshalling/TermBeforeMarshallingCallback.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/marshalling/TermBe0000644000175000017500000000247510515676064033150 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.marshalling; /** * @author Alexey Loubyansky * @version $Revision: 2096 $ */ public interface TermBeforeMarshallingCallback { Object beforeMarshalling(Object o, MarshallingContext ctx); } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/marshalling/MarshallingContext.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/marshalling/Marsha0000755000175000017500000000434310513724466033202 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.marshalling; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; /** * @author Alexey Loubyansky * @version $Revision: 2128 $ */ public interface MarshallingContext extends org.jboss.xb.binding.MarshallingContext { /** * @return schema binding */ SchemaBinding getSchemaBinding(); /** * @return current attribute binding */ AttributeBinding getAttributeBinding(); /** * @return current particle */ ParticleBinding getParticleBinding(); /** * @param ns the namespace to return the prefix for * @return the prefix for the namespace (can be null if the namespace is not mapped to a prefix * and the second parameter is false) */ String getPrefix(String ns); /** * @param prefix prefix for the namespace being declared * @param ns the namespace to declare for the current component */ void declareNamespace(String prefix, String ns); /** * @return current object on the stack */ Object peek(); } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/marshalling/AttributeMarshaller.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/marshalling/Attrib0000755000175000017500000000240110470642610033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.marshalling; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public interface AttributeMarshaller { String marshal(MarshallingContext ctx); } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/marshalling/DefaultAttributeMarshaller.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/marshalling/Defaul0000755000175000017500000001625211061473704033164 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.marshalling; import java.util.Arrays; import java.util.List; import javax.xml.namespace.QName; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.Util; import org.jboss.xb.binding.introspection.FieldInfo; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; /** * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class DefaultAttributeMarshaller extends AbstractAttributeMarshaller { public static final DefaultAttributeMarshaller INSTANCE = new DefaultAttributeMarshaller(); public Object getValue(MarshallingContext ctx) { Object owner = ctx.peek(); SchemaBinding schema = ctx.getSchemaBinding(); AttributeBinding binding = ctx.getAttributeBinding(); QName qName = binding.getQName(); String fieldName = null; PropertyMetaData propertyMetaData = binding.getPropertyMetaData(); if(propertyMetaData != null) { fieldName = propertyMetaData.getName(); } if(fieldName == null) { fieldName = Util.xmlNameToFieldName(qName.getLocalPart(), schema.isIgnoreLowLine()); } FieldInfo fieldInfo = FieldInfo.getFieldInfo( owner.getClass(), fieldName, binding.getRequired() && !schema.isIgnoreUnresolvedFieldOrClass() ); Object value = null; if(fieldInfo != null) { value = fieldInfo.getValue(owner); } return value; } public String marshalValue(MarshallingContext ctx, Object value) { AttributeBinding binding = ctx.getAttributeBinding(); if(value == null) { if(binding.getRequired()) { ElementBinding element = (ElementBinding) ctx.getParticleBinding().getTerm(); throw new JBossXBRuntimeException("Missing value for the required attribute " + binding.getQName() + " of element " + element.getQName()); } return null; } String marshalled; TypeBinding attrType = binding.getType(); if(attrType.getItemType() != null) { TypeBinding itemType = attrType.getItemType(); if(Constants.NS_XML_SCHEMA.equals(itemType.getQName().getNamespaceURI())) { List list; if(value instanceof List) { list = (List)value; } else if(value.getClass().isArray()) { list = Arrays.asList((QName[])value); } else { throw new JBossXBRuntimeException("Expected value for list type is an array or " + List.class.getName() + " but got: " + value ); } if(Constants.QNAME_QNAME.getLocalPart().equals(itemType.getQName().getLocalPart())) { String attrLocal = binding.getQName().getLocalPart(); for(int listInd = 0; listInd < list.size(); ++listInd) { QName item = (QName)list.get(listInd); String itemNs = item.getNamespaceURI(); if(itemNs != null && itemNs.length() > 0) { String itemPrefix = ctx.getPrefix(itemNs); if(itemPrefix == null) { itemPrefix = item.getPrefix(); if(itemPrefix == null || itemPrefix.length() == 0) { itemPrefix = attrLocal + listInd; } ctx.declareNamespace(itemPrefix, itemNs); } if(!itemPrefix.equals(item.getPrefix())) { item = new QName(item.getNamespaceURI(), item.getLocalPart(), itemPrefix); list.set(listInd, item); } } } } marshalled = SimpleTypeBindings.marshalList(itemType.getQName().getLocalPart(), list, null); } else { throw new JBossXBRuntimeException("Marshalling of list types with item types not from " + Constants.NS_XML_SCHEMA + " is not supported." ); } } else if(attrType.getLexicalPattern() != null && attrType.getBaseType() != null && Constants.QNAME_BOOLEAN.equals(attrType.getBaseType().getQName())) { String item = attrType.getLexicalPattern().get(0); if(item.indexOf('0') != -1 && item.indexOf('1') != -1) { marshalled = ((Boolean)value).booleanValue() ? "1" : "0"; } else { marshalled = ((Boolean)value).booleanValue() ? "true" : "false"; } } else if(Constants.QNAME_QNAME.equals(attrType.getQName())) { boolean removePrefix = false; String prefix = null; String ns = ((QName)value).getNamespaceURI(); if(ns != null && ns.length() > 0) { prefix = ctx.getPrefix(ns); if(prefix == null) { prefix = ((QName)value).getPrefix(); if(prefix == null || prefix.length() == 0) { prefix = "ns_" + ((QName)value).getLocalPart(); } ctx.declareNamespace(prefix, ns); } ctx.getNamespaceContext().addPrefixMapping(prefix, ns); removePrefix = true; } marshalled = SimpleTypeBindings.marshalQName((QName)value, ctx.getNamespaceContext()); if(removePrefix) { ctx.getNamespaceContext().removePrefixMapping(prefix); } } else { marshalled = value.toString(); } return marshalled; } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/marshalling/MarshallerImpl.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/marshalling/Marsha0000755000175000017500000012756611061473704033212 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.marshalling; import java.io.IOException; import java.io.Reader; import java.io.Writer; import java.lang.reflect.Array; import java.lang.reflect.Method; import java.util.AbstractList; import java.util.Collection; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import javax.xml.parsers.ParserConfigurationException; import org.jboss.util.Classes; import org.jboss.xb.binding.AbstractMarshaller; import org.jboss.xb.binding.AttributesImpl; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.Content; import org.jboss.xb.binding.ContentWriter; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.ObjectLocalMarshaller; import org.jboss.xb.binding.ObjectModelProvider; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.Util; import org.jboss.xb.binding.NamespaceRegistry; import org.jboss.xb.binding.introspection.FieldInfo; import org.jboss.xb.binding.metadata.CharactersMetaData; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.sunday.unmarshalling.*; import org.jboss.xb.binding.sunday.xop.XOPMarshaller; import org.jboss.xb.binding.sunday.xop.XOPObject; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; /** * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class MarshallerImpl extends AbstractMarshaller { private Stack stack = new StackImpl(); private Object root; /** * Whether NULL values should be ignored or marshalled as xsi:nil='1' */ private boolean supportNil = true; private boolean ignoreUnresolvedWildcard; private QName rootTypeQName; private SchemaBindingResolver schemaResolver; private SchemaBinding schema; private MarshallingContextImpl ctx = new MarshallingContextImpl(); public boolean isIgnoreUnresolvedWildcard() { return ignoreUnresolvedWildcard; } public void setIgnoreUnresolvedWildcard(boolean ignoreUnresolvedWildcard) { this.ignoreUnresolvedWildcard = ignoreUnresolvedWildcard; } public SchemaBindingResolver getSchemaResolver() { return schemaResolver; } public void setSchemaResolver(SchemaBindingResolver schemaResolver) { this.schemaResolver = schemaResolver; } public QName getRootTypeQName() { return rootTypeQName; } public void setRootTypeQName(QName rootTypeQName) { this.rootTypeQName = rootTypeQName; } public boolean isSupportNil() { return supportNil; } public void setSupportNil(boolean supportNil) { this.supportNil = supportNil; } /** * Adds an attribute to the top most elements. * First, we check whether there is a namespace associated with the passed in prefix. * If the prefix was not declared, an exception is thrown. * * @param prefix the prefix of the attribute to be declared * @param localName local name of the attribute * @param type the type of the attribute * @param value the value of the attribute */ public void addAttribute(String prefix, String localName, String type, String value) { // todo addAttribute(String prefix, String localName, String type, String value) } // AbstractMarshaller implementation public void marshal(Reader xsdReader, ObjectModelProvider provider, Object root, Writer writer) throws IOException, SAXException, ParserConfigurationException { SchemaBinding model = XsdBinder.bind(xsdReader, null, schemaResolver); marshallInternal(root, model, writer); } public void marshal(String xsdURL, ObjectModelProvider provider, Object root, Writer writer) throws IOException, SAXException { SchemaBinding model = XsdBinder.bind(xsdURL, schemaResolver); marshallInternal(root, model, writer); } public void marshal(SchemaBinding model, ObjectModelProvider provider, Object root, Writer writer) throws IOException, SAXException { marshallInternal(root, model, writer); } private void marshallInternal(Object root, SchemaBinding schema, Writer writer) throws IOException, SAXException { if(schema == null) { throw new JBossXBRuntimeException("XSModel is not available!"); } this.schema = schema; this.root = root; content.startDocument(); if(rootTypeQName != null) { if(rootQNames.isEmpty()) { throw new JBossXBRuntimeException("If type name (" + rootTypeQName + ") for the root element is specified then the name for the root element is required!" ); } QName rootQName = rootQNames.get(0); TypeBinding type = schema.getType(rootTypeQName); if(type == null) { throw new JBossXBRuntimeException("Global type definition is not found: " + rootTypeQName); } if(isArrayWrapper(type)) { stack.push(root); marshalComplexType(rootQName, type, true, false); stack.pop(); } else { ElementBinding element = new ElementBinding(schema, rootQName, type); ctx.particle = new ParticleBinding(element); marshalElementOccurence(element, root, false, true); } } else if(rootQNames.isEmpty()) { Iterator elements = schema.getElementParticles(); if(!elements.hasNext()) { throw new JBossXBRuntimeException("The schema doesn't contain global element declarations."); } while(elements.hasNext()) { ParticleBinding element = elements.next(); ctx.particle = element; marshalElementOccurence((ElementBinding) element.getTerm(), root, true, true); } } else { for(int i = 0; i < rootQNames.size(); ++i) { QName qName = rootQNames.get(i); ParticleBinding element = schema.getElementParticle(qName); if(element == null) { Iterator components = schema.getElements(); String roots = ""; for(int j = 0; components.hasNext(); ++j) { ElementBinding xsObject = (ElementBinding)components.next(); if(j > 0) { roots += ", "; } roots += xsObject.getQName(); } throw new IllegalStateException("Root element not found: " + qName + " among " + roots); } ctx.particle = element; marshalElementOccurence((ElementBinding) element.getTerm(), root, true, true); } } content.endDocument(); // version & encoding writeXmlVersion(writer); ContentWriter contentWriter = new ContentWriter(writer, propertyIsTrueOrNotSet(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_INDENTATION) ); content.handleContent(contentWriter); if(log.isTraceEnabled()) { java.io.StringWriter traceWriter = new java.io.StringWriter(); contentWriter = new ContentWriter(traceWriter, propertyIsTrueOrNotSet(org.jboss.xb.binding.Marshaller.PROP_OUTPUT_INDENTATION) ); content.handleContent(contentWriter); log.trace("marshalled:\n" + traceWriter.getBuffer().toString()); } } private boolean marshalElementOccurence(ElementBinding element, Object value, boolean optional, boolean declareNs) { QName xsiTypeQName = null; TypeBinding xsiType = null; if(value != null) { QName typeQName = element.getType().getQName(); xsiTypeQName = (QName)cls2TypeMap.get(value.getClass()); // in case xsiTypeQName is not null, typeQName should also be not null if(xsiTypeQName != null && !(typeQName.getLocalPart().equals(xsiTypeQName.getLocalPart()) && typeQName.getNamespaceURI().equals(xsiTypeQName.getNamespaceURI()) )) { if(log.isTraceEnabled()) { log.trace(value.getClass() + " is mapped to xsi:type " + xsiTypeQName); } xsiType = schema.getType(xsiTypeQName); if(xsiType == null) { log.warn("Class " + value.getClass() + " is mapped to type " + xsiTypeQName + " but the type is not found in schema." ); } // todo should check derivation also, i.e. if(xsiType.derivedFrom()) } } TermBeforeMarshallingCallback marshallingHandler = element.getBeforeMarshallingCallback(); if(marshallingHandler != null) { value = marshallingHandler.beforeMarshalling(value, ctx); } stack.push(value); boolean marshalled = marshalElement(element, xsiType, optional, declareNs); stack.pop(); return marshalled; } private boolean marshalElement(ElementBinding element, TypeBinding xsiType, boolean optional, boolean declareNs) { Object value = stack.peek(); boolean nillable = element.isNillable(); boolean result = value != null || value == null && (optional || nillable); boolean trace = log.isTraceEnabled() && result; if(trace) { log.trace("started element " + element.getQName()); } if(value != null) { boolean declareXsiType = xsiType != null; marshalElementType(element.getQName(), declareXsiType ? xsiType : element.getType(), declareNs, declareXsiType ); } else if(nillable) { writeNillable(element.getQName(), nillable); } if(trace) { log.trace("finished element " + element.getQName()); } return result; } private void marshalElementType(QName elementQName, TypeBinding type, boolean declareNs, boolean declareXsiType) { String elementNs = elementQName.getNamespaceURI(); String elementLocal = elementQName.getLocalPart(); XOPMarshaller xopMarshaller = schema.getXopMarshaller(); if(xopMarshaller == null) { xopMarshaller = type.getXopMarshaller(); } if(xopMarshaller != null && isXopOptimizable(type)) { if(xopMarshaller.isXOPPackage()) { // XOPMarshaller callback will create the attachment part Object o = stack.peek(); String cid = xopMarshaller.addMtomAttachment(new XOPObject(o), elementNs, elementLocal); // Create the xopInclude element from CID and exit AttributesImpl attrs = null; String prefix = getPrefix(elementNs); boolean genPrefix = prefix == null && elementNs != null && elementNs.length() > 0; if(genPrefix) { prefix = "ns_" + elementLocal; attrs = new AttributesImpl(1); declareNs(attrs, prefix, elementNs); } String qName = prefixLocalName(prefix, elementLocal); content.startElement(elementNs, elementLocal, qName, attrs); AttributesImpl xopAttrs = new AttributesImpl(2); xopAttrs.add(Constants.NS_XML_SCHEMA, "xop", "xmlns:xop", "CDATA", Constants.NS_XOP_INCLUDE); xopAttrs.add(null, "href", "href", "CDATA", cid); content.startElement(Constants.NS_XOP_INCLUDE, "Include", "xop:Include", xopAttrs); content.endElement(Constants.NS_XOP_INCLUDE, "Include", "xop:Include"); content.endElement(elementNs, elementLocal, qName); // Skip further processing return; } else { // XOPMarshaller did not process the object // In this case we try to marshall the corresponding simple type if(!type.isSimple()) { if(type.hasOnlyXmlMimeAttributes()) // TODO: what's the purpose of this? It's xopOptimizable anyway... { if(log.isTraceEnabled()) { log.trace( "XML MIME attributes of type " + type.getQName() + " are ignored, the value is marshalled as " + type.getSimpleType().getQName() ); } type = type.getSimpleType(); } } } } // If we reach this point then either it wasn't a XOP element at all // or the XOPMarshaller did not process it. if(type.isSimple()) { marshalSimpleType(elementQName, type, declareNs, declareXsiType); } else { marshalComplexType(elementQName, type, declareNs, declareXsiType); } } private void marshalSimpleType(QName elementQName, TypeBinding type, boolean declareNs, boolean declareXsiType) { ctx.attrs = null; if((declareNs || declareXsiType) && nsRegistry.size() > 0) { if(ctx.attrs == null) { ctx.attrs = new AttributesImpl(nsRegistry.size() + 1); } declareNs(ctx.attrs); } String elementNs = elementQName.getNamespaceURI(); String elementLocal = elementQName.getLocalPart(); String prefix = getPrefix(elementNs); boolean genPrefix = prefix == null && elementNs != null && elementNs.length() > 0; if(genPrefix) { prefix = "ns_" + elementLocal; if(ctx.attrs == null) { ctx.attrs = new AttributesImpl(1); } declareNs(ctx.attrs, prefix, elementNs); } if(declareXsiType) { declareXsiType(type.getQName(), ctx.attrs); } String typeName = type.getQName() == null ? null : type.getQName().getLocalPart(); if(ctx.attrs == null && SimpleTypeBindings.XS_QNAME_NAME.equals(typeName) || SimpleTypeBindings.XS_NOTATION_NAME.equals(typeName) || type.getItemType() != null && (SimpleTypeBindings.XS_QNAME_NAME.equals(type.getItemType().getQName().getLocalPart()) || SimpleTypeBindings.XS_NOTATION_NAME.equals(type.getItemType().getQName().getLocalPart()) ) ) { ctx.attrs = new AttributesImpl(5); } Object value = stack.peek(); String marshalled = marshalCharacters(elementNs, prefix, type, value); String qName = prefixLocalName(prefix, elementLocal); content.startElement(elementNs, elementLocal, qName, ctx.attrs); content.characters(marshalled.toCharArray(), 0, marshalled.length()); content.endElement(elementNs, elementLocal, qName); } private void marshalComplexType(QName elementQName, TypeBinding type, boolean declareNs, boolean declareXsiType) { Collection attrBindings = type.getAttributes(); int attrsTotal = declareNs || declareXsiType ? nsRegistry.size() + attrBindings.size() + 1: attrBindings.size(); ctx.attrs = attrsTotal > 0 ? new AttributesImpl(attrsTotal) : null; if(declareNs && nsRegistry.size() > 0) { declareNs(ctx.attrs); } String generatedPrefix = null; if(declareXsiType) { generatedPrefix = declareXsiType(type.getQName(), ctx.attrs); if(generatedPrefix != null) { String typeNsWithGeneratedPrefix = type.getQName().getNamespaceURI(); declareNs(ctx.attrs, generatedPrefix, typeNsWithGeneratedPrefix); declareNamespace(generatedPrefix, typeNsWithGeneratedPrefix); } } String elementNs = elementQName.getNamespaceURI(); String elementLocal = elementQName.getLocalPart(); String prefix = getPrefix(elementNs); boolean genPrefix = prefix == null && elementNs != null && elementNs.length() > 0; if(genPrefix) { // todo: it's possible that the generated prefix already mapped. this should be fixed prefix = "ns_" + elementLocal; declareNamespace(prefix, elementNs); if(ctx.attrs == null) { ctx.attrs = new AttributesImpl(1); } declareNs(ctx.attrs, prefix, elementNs); } if(!attrBindings.isEmpty()) { for(Iterator i = attrBindings.iterator(); i.hasNext();) { AttributeBinding attrBinding = i.next(); QName attrQName = attrBinding.getQName(); if(Constants.QNAME_XMIME_CONTENTTYPE.equals(attrQName)) { continue; } ctx.attr = attrBinding; AttributeMarshaller marshaller = attrBinding.getMarshaller(); String marshalledAttr = marshaller.marshal(ctx); if(marshalledAttr != null) { if(ctx.attrs == null) { ctx.attrs = new AttributesImpl(5); } String attrNs = attrQName.getNamespaceURI(); String attrLocal = attrQName.getLocalPart(); String attrPrefix = null; if(attrNs != null) { attrPrefix = getPrefix(attrNs); if(attrPrefix == null && attrNs != null && attrNs.length() > 0) { attrPrefix = "ns_" + attrLocal; declareNs(ctx.attrs, attrPrefix, attrNs); } } String prefixedName = prefixLocalName(attrPrefix, attrLocal); ctx.attrs.add(attrNs, attrLocal, prefixedName, "CDATA", marshalledAttr); } } ctx.attr = null; } String characters = null; TypeBinding simpleType = type.getSimpleType(); if(simpleType != null && !Constants.QNAME_ANYTYPE.equals(type.getQName())) { String fieldName = ctx.getSimpleContentProperty(); CharactersMetaData charactersMetaData = type.getCharactersMetaData(); PropertyMetaData propertyMetaData = charactersMetaData == null ? null : charactersMetaData.getProperty(); if(propertyMetaData != null) { fieldName = propertyMetaData.getName(); } if(fieldName != null) { boolean ignoreUnresolvedFieldOrClass = type.getSchemaBinding().isIgnoreUnresolvedFieldOrClass(); Object o = stack.peek(); Object value = getElementValue(o, fieldName, ignoreUnresolvedFieldOrClass); if(value != null) { String typeName = simpleType.getQName().getLocalPart(); if(ctx.attrs == null && (SimpleTypeBindings.XS_QNAME_NAME.equals(typeName) || SimpleTypeBindings.XS_NOTATION_NAME.equals(typeName) || simpleType.getItemType() != null && (SimpleTypeBindings.XS_QNAME_NAME.equals(simpleType.getItemType().getQName().getLocalPart()) || SimpleTypeBindings.XS_NOTATION_NAME.equals(simpleType.getItemType().getQName().getLocalPart()) ) ) ) { ctx.attrs = new AttributesImpl(5); } characters = marshalCharacters(elementNs, prefix, simpleType, value); } } } String qName = prefixLocalName(prefix, elementLocal); content.startElement(elementNs, elementLocal, qName, ctx.attrs); ParticleBinding particle = type.getParticle(); if(particle != null) { marshalParticle(particle, false); } if(characters != null) { content.characters(characters.toCharArray(), 0, characters.length()); } content.endElement(elementNs, elementLocal, qName); ctx.attrs = null; if(genPrefix) { removePrefixMapping(prefix); } if(generatedPrefix != null) { removePrefixMapping(generatedPrefix); } } private boolean marshalParticle(ParticleBinding particle, boolean declareNs) { boolean marshalled; TermBinding term = particle.getTerm(); Object o; Iterator i; ParticleBinding ctxParticle = ctx.particle; ctx.particle = particle; if(term.isModelGroup()) { ModelGroupBinding modelGroup = (ModelGroupBinding)term; if(modelGroup.isSkip() || stack.isEmpty()) { marshalled = marshalModelGroup(modelGroup, declareNs); } else { PropertyMetaData propertyMetaData = modelGroup.getPropertyMetaData(); if(propertyMetaData == null) { throw new JBossXBRuntimeException( "Currently, property binding metadata must be available for a model group to be marshalled!" ); } o = getChildren(stack.peek(), propertyMetaData.getName(), modelGroup.getSchema().isIgnoreUnresolvedFieldOrClass() ); TermBeforeMarshallingCallback marshallingHandler = modelGroup.getBeforeMarshallingCallback(); i = o != null && isRepeatable(particle) ? getIterator(o) : null; if(i != null) { marshalled = true; while(i.hasNext() && marshalled) { Object value = i.next(); if(marshallingHandler != null) { value = marshallingHandler.beforeMarshalling(value, ctx); } stack.push(value); marshalled = marshalModelGroup(modelGroup, declareNs); stack.pop(); } } else { if(marshallingHandler != null) { o = marshallingHandler.beforeMarshalling(o, ctx); } stack.push(o); marshalled = marshalModelGroup(modelGroup, declareNs); stack.pop(); } } } else if(term.isWildcard()) { o = stack.peek(); boolean popWildcardValue = false; ObjectLocalMarshaller marshaller = null; FieldToWildcardMapping mapping = (FieldToWildcardMapping)field2WildcardMap.get(o.getClass()); if(mapping != null) { marshaller = mapping.marshaller; o = mapping.fieldInfo.getValue(o); stack.push(o); popWildcardValue = true; } TermBeforeMarshallingCallback marshallingHandler = term.getBeforeMarshallingCallback(); i = o != null && isRepeatable(particle) ? getIterator(o) : null; if(i != null) { marshalled = true; while(i.hasNext() && marshalled) { Object value = i.next(); if(marshallingHandler != null) { value = marshallingHandler.beforeMarshalling(value, ctx); } marshalled = marshalWildcardOccurence(particle, marshaller, value, declareNs); } } else { if(marshallingHandler != null) { o = marshallingHandler.beforeMarshalling(o, ctx); } marshalled = marshalWildcardOccurence(particle, marshaller, o, declareNs); } if(popWildcardValue) { stack.pop(); } } else { ElementBinding element = (ElementBinding)term; SchemaBinding schema = element.getSchema(); o = getElementValue(element, schema.isIgnoreLowLine(), schema.isIgnoreUnresolvedFieldOrClass()); i = o != null && isRepeatable(particle) ? getIterator(o) : null; if(i != null) { marshalled = true; while(i.hasNext() && marshalled) { Object value = i.next(); marshalled = marshalElementOccurence(element, value, particle.getMinOccurs() == 0, declareNs); } } else { marshalled = marshalElementOccurence(element, o, particle.getMinOccurs() == 0, declareNs); } } ctx.particle = ctxParticle; return marshalled; } private boolean marshalWildcardOccurence(ParticleBinding particle, ObjectLocalMarshaller marshaller, Object value, boolean declareNs) { boolean marshalled = true; if(marshaller != null) { marshaller.marshal(ctx, value); } else if(value != null) { stack.push(value); marshalled = marshalWildcard(particle, declareNs); stack.pop(); } return marshalled; } private boolean marshalWildcard(ParticleBinding particle, boolean declareNs) { WildcardBinding wildcard = (WildcardBinding)particle.getTerm(); Object o = stack.peek(); ClassMapping mapping = getClassMapping(o.getClass()); if(mapping == null) { // todo: YAH (yet another hack) QName autoType = SimpleTypeBindings.typeQName(o.getClass()); if(autoType != null) { String marshalled = SimpleTypeBindings.marshal(autoType.getLocalPart(), o, null); content.characters(marshalled.toCharArray(), 0, marshalled.length()); return true; } else { ObjectLocalMarshaller marshaller = wildcard.getUnresolvedMarshaller(); if(marshaller != null) { marshaller.marshal(ctx, o); return true; } String msg = "Failed to marshal wildcard: neither class mapping was found for " + o.getClass() + "@" + o.hashCode() + " (toString: " + o + ") nor marshaller for unresolved classes was setup."; if(ignoreUnresolvedWildcard) { log.warn(msg); return true; } else { throw new JBossXBRuntimeException(msg); } } } Object parentRoot = this.root; Stack parentStack = this.stack; SchemaBinding parentSchema = this.schema; this.root = o; this.stack = new StackImpl(); this.schema = mapping.schemaUrl == null ? this.schema : XsdBinder.bind(mapping.schemaUrl, schemaResolver); boolean marshalled; if(mapping.elementName != null) { ParticleBinding element = schema.getElementParticle(mapping.elementName); if(element == null) { throw new JBossXBRuntimeException("Element " + mapping.elementName + " is not declared in the schema."); } ParticleBinding ctxParticle = ctx.particle; ctx.particle = element; marshalled = marshalElementOccurence((ElementBinding) element.getTerm(), root, particle.getMinOccurs() == 0, declareNs); ctx.particle = ctxParticle; } else if(mapping.typeName != null) { TypeBinding typeDef = schema.getType(mapping.typeName); if(typeDef == null) { throw new JBossXBRuntimeException("Type " + mapping.typeName + " is not defined in the schema." ); } if(wildcard.getQName() == null) { throw new JBossXBRuntimeException("Expected the wildcard to have a non-null QName."); } ElementBinding element = new ElementBinding(schema, wildcard.getQName(), typeDef); ParticleBinding ctxParticle = ctx.particle; ctx.particle = new ParticleBinding(element); marshalled = marshalElementOccurence(element, root, particle.getMinOccurs() == 0, declareNs); ctx.particle = ctxParticle; } else { throw new JBossXBRuntimeException("Class mapping for " + mapping.cls + " is associated with neither global element name nor global type name." ); } this.root = parentRoot; this.stack = parentStack; this.schema = parentSchema; return marshalled; } private boolean marshalModelGroup(ModelGroupBinding modelGroup, boolean declareNs) { boolean marshalled; if(modelGroup instanceof AllBinding) { marshalled = marshalModelGroupAll(modelGroup.getParticles(), declareNs); } else if(modelGroup instanceof ChoiceBinding) { marshalled = marshalModelGroupChoice(modelGroup.getParticles(), declareNs); } else { marshalled = marshalModelGroupSequence(modelGroup, declareNs); } return marshalled; } private boolean marshalModelGroupAll(Collection particles, boolean declareNs) { boolean marshalled = false; for(Iterator i = particles.iterator(); i.hasNext();) { ParticleBinding particle = i.next(); marshalled |= marshalParticle(particle, declareNs); } return marshalled; } private boolean marshalModelGroupChoice(Collection particles, boolean declareNs) { boolean marshalled = false; Content mainContent = this.content; for(Iterator i = particles.iterator(); i.hasNext() && !marshalled;) { ParticleBinding particle = i.next(); this.content = new Content(); marshalled = marshalParticle(particle, declareNs); } if(marshalled) { mainContent.append(this.content); } this.content = mainContent; return marshalled; } private boolean marshalModelGroupSequence(ModelGroupBinding sequence, boolean declareNs) { // if sequence is bound to a collection, // we assume the iterator over the collection is in sync with the particle iterator Iterator valueIterator = null; if(!sequence.isSkip() && !stack.isEmpty()) { Object o = stack.peek(); if(o != null && (Collection.class.isAssignableFrom(o.getClass()) || o.getClass().isArray())) { valueIterator = getIterator(o); } } boolean marshalled = true; for(Iterator i = sequence.getParticles().iterator(); i.hasNext();) { if(valueIterator != null) { Object o = valueIterator.hasNext() ? valueIterator.next() : null; stack.push(o); } ParticleBinding particle = i.next(); marshalled &= marshalParticle(particle, declareNs); if(valueIterator != null) { stack.pop(); } } return marshalled; } private String marshalCharacters(String elementUri, String elementPrefix, TypeBinding simpleType, Object value) { String marshalled; QName simpleTypeQName = simpleType.getQName(); if(simpleType.getItemType() != null) { TypeBinding itemType = simpleType.getItemType(); if(Constants.NS_XML_SCHEMA.equals(itemType.getQName().getNamespaceURI())) { List list; if(value instanceof List) { list = (List)value; } else if(value.getClass().isArray()) { list = asList(value); } else { // todo: qname are also not yet supported throw new JBossXBRuntimeException( "Expected value for list type is an array or " + List.class.getName() + " but got: " + value ); } marshalled = SimpleTypeBindings.marshalList(itemType.getQName().getLocalPart(), list, null); } else { throw new JBossXBRuntimeException("Marshalling of list types with item types not from " + Constants.NS_XML_SCHEMA + " is not supported." ); } } else if(simpleTypeQName != null && Constants.NS_XML_SCHEMA.equals(simpleTypeQName.getNamespaceURI())) { String typeName = simpleTypeQName.getLocalPart(); String prefix = null; boolean removePrefix = false; if(SimpleTypeBindings.XS_QNAME_NAME.equals(typeName) || SimpleTypeBindings.XS_NOTATION_NAME.equals(typeName)) { QName qNameValue = (QName)value; if(qNameValue.getNamespaceURI() != null && qNameValue.getNamespaceURI().length() > 0) { prefix = nsRegistry.getPrefix(qNameValue.getNamespaceURI()); if(prefix == null) { prefix = qNameValue.getPrefix(); if(prefix == null || prefix.length() == 0) { prefix = qNameValue.getLocalPart() + "_ns"; } nsRegistry.addPrefixMapping(prefix, qNameValue.getNamespaceURI()); ctx.declareNamespace(prefix, qNameValue.getNamespaceURI()); removePrefix = true; } } } marshalled = SimpleTypeBindings.marshal(typeName, value, nsRegistry); if(removePrefix) { nsRegistry.removePrefixMapping(prefix); } } // todo: this is a quick fix for boolean pattern (0|1 or true|false) should be refactored else if(simpleType.getLexicalPattern() != null && simpleType.getBaseType() != null && Constants.QNAME_BOOLEAN.equals(simpleType.getBaseType().getQName())) { String item = simpleType.getLexicalPattern().get(0); if(item.indexOf('0') != -1 && item.indexOf('1') != -1) { marshalled = ((Boolean)value).booleanValue() ? "1" : "0"; } else { marshalled = ((Boolean)value).booleanValue() ? "true" : "false"; } } else { if(simpleType.getLexicalEnumeration() != null) { Method getValue; try { getValue = value.getClass().getMethod("value", null); } catch(NoSuchMethodException e) { try { getValue = value.getClass().getMethod("getValue", null); } catch(NoSuchMethodException e1) { throw new JBossXBRuntimeException("Failed to find neither value() nor getValue() in " + value.getClass() + " which is bound to enumeration type " + simpleTypeQName ); } } try { value = getValue.invoke(value, null); } catch(Exception e) { throw new JBossXBRuntimeException( "Failed to invoke getValue() on " + value + " to get the enumeration value", e ); } } marshalled = marshalCharacters(elementUri, elementPrefix, simpleType.getBaseType(), value ); } return marshalled; } private void writeNillable(QName elementQName, boolean nillable) { if(!supportNil) { return; } if(!nillable) { throw new JBossXBRuntimeException("Failed to marshal " + elementQName + ": Java value is null but the element is not nillable." ); } String elementNs = elementQName.getNamespaceURI(); String elementLocal = elementQName.getLocalPart(); AttributesImpl attrs; String prefix = getPrefix(elementNs); if(prefix == null && elementNs != null && elementNs.length() > 0) { prefix = "ns_" + elementLocal; attrs = new AttributesImpl(2); declareNs(attrs, prefix, elementNs); } else { attrs = new AttributesImpl(1); } String xsiPrefix = getPrefix(Constants.NS_XML_SCHEMA_INSTANCE); if(xsiPrefix == null) { xsiPrefix = "xsi"; declareNs(attrs, "xsi", Constants.NS_XML_SCHEMA_INSTANCE); } String nilQName = xsiPrefix + ":nil"; attrs.add(Constants.NS_XML_SCHEMA_INSTANCE, "nil", nilQName, null, "1"); String qName = prefixLocalName(prefix, elementLocal); content.startElement(elementNs, elementLocal, qName, attrs); content.endElement(elementNs, elementLocal, qName); } private Object getElementValue(ElementBinding element, boolean ignoreLowLine, boolean ignoreNotFoundField) { Object value; Object peeked = stack.peek(); if(peeked == null) { value = null; } else if(peeked instanceof Collection || peeked.getClass().isArray()) { value = peeked; } else { String fieldName = null; PropertyMetaData propertyMetaData = element.getPropertyMetaData(); if(propertyMetaData != null) { fieldName = propertyMetaData.getName(); } if(fieldName == null) { fieldName = Util.xmlNameToFieldName(element.getQName().getLocalPart(), ignoreLowLine); } value = getChildren(peeked, fieldName, ignoreNotFoundField); if(value == null) { value = getElementValue(peeked, fieldName, ignoreNotFoundField); } } return value; } private static boolean isArrayWrapper(TypeBinding type) { boolean is = false; if(!type.isSimple()) { ParticleBinding particle = type.getParticle(); if(particle != null) { is = particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1; } } return is; } private Iterator getIterator(Object value) { Iterator i = null; if(value instanceof Collection) { i = ((Collection)value).iterator(); } else if(value.getClass().isArray()) { final Object arr = value; i = new Iterator() { private int curInd = 0; private int length = Array.getLength(arr); public boolean hasNext() { return curInd < length; } public Object next() { return Array.get(arr, curInd++); } public void remove() { throw new UnsupportedOperationException("remove is not implemented."); } }; } else if(value instanceof Iterator) { i = (Iterator)value; } else { //throw new JBossXBRuntimeException("Unexpected type for children: " + value.getClass()); } return i; } private static Object getChildren(Object o, String fieldName, boolean ignoreNotFoundField) { Object children = null; if(!writeAsValue(o.getClass())) { children = getJavaValue(fieldName, o, true, ignoreNotFoundField); } return children; } private static Object getJavaValue(String fieldName, Object o, boolean forComplexType, boolean ignoreNotFoundField) { FieldInfo fieldInfo = FieldInfo.getFieldInfo(o.getClass(), fieldName, !ignoreNotFoundField); Object value = null; if(fieldInfo != null && (!forComplexType || forComplexType && !writeAsValue(fieldInfo.getType()))) { value = fieldInfo.getValue(o); } return value; } private static Object getElementValue(Object o, String fieldName, boolean ignoreNotFoundField) { Object value; if(writeAsValue(o.getClass())) { value = o; } else { value = getJavaValue(fieldName, o, false, ignoreNotFoundField); } return value; } private static boolean writeAsValue(final Class type) { return Classes.isPrimitive(type) || type == String.class || type == java.util.Date.class || type == java.math.BigDecimal.class || type == java.math.BigInteger.class; } private static boolean isRepeatable(ParticleBinding particle) { return particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1 || particle.getMinOccurs() > 1; } private static final List asList(final Object arr) { return new AbstractList() { private final Object array = arr; public Object get(int index) { return Array.get(array, index); } public int size() { return Array.getLength(array); } }; } private static boolean isXopOptimizable(TypeBinding type) { while(type != null) { if(Constants.QNAME_BASE64BINARY.equals(type.getQName())) { return true; } type = type.getBaseType(); } return false; } private class MarshallingContextImpl implements MarshallingContext { private ContentHandler ch; private AttributeBinding attr; private ParticleBinding particle; private AttributesImpl attrs; public boolean isAttributeRequired() { throw new UnsupportedOperationException(); } public boolean isTypeComplex() { throw new UnsupportedOperationException(); } public String getSimpleContentProperty() { return schema.getSimpleContentProperty(); } public ContentHandler getContentHandler() { if(ch == null) { ch = new ContentHandlerAdaptor(); } return ch; } public SchemaBinding getSchemaBinding() { return schema; } public AttributeBinding getAttributeBinding() { return attr; } public String getPrefix(String ns) { return MarshallerImpl.this.getPrefix(ns); } public void declareNamespace(String prefix, String ns) { declareNs(attrs, prefix, ns); nsRegistry.addPrefixMapping(prefix, ns); } public NamespaceRegistry getNamespaceContext() { return nsRegistry; } public Object peek() { return stack.isEmpty() ? null : stack.peek(); } public ParticleBinding getParticleBinding() { return particle; } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/xop/0000755000175000017500000000000011620316767030343 5ustar twernertwerner././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/xop/XOPMarshaller.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/xop/XOPMarshaller.0000755000175000017500000000314010470642610033015 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.xop; /** * This interface is a copy of AttachmentMarshaller from JAXB2.0. * It's added to avoid circular module dependecy in the build system. * * @author Alexey Loubyansky * @author Heiko Braun * @version $Revision: 1958 $ */ public interface XOPMarshaller { boolean isXOPPackage(); String addMtomAttachment(XOPObject obj, String elementNamespace, String elementName); String addMtomAttachment(byte[] data, String elementNamespace, String elementName); } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/xop/XOPElementHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/xop/XOPElementHand0000755000175000017500000000555210520124602033032 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.xop; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.DefaultHandlers; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 2147 $ */ public class XOPElementHandler implements ParticleHandler { public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { ElementBinding element = (ElementBinding)particle.getTerm(); XOPUnmarshaller xopUnmarshaller = element.getXopUnmarshaller(); if(xopUnmarshaller == null || !xopUnmarshaller.isXOPPackage()) { return null; } else { return new XOPElement(); } } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return o instanceof XOPElement ? ((XOPElement)o).value : o; } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { if(parent == o) { return; } // should actually use the handler that would normally be used by the SundayContentHandler DefaultHandlers.ELEMENT_HANDLER.setParent(parent, o, elementName, particle, parentParticle); } public static class XOPElement { public Object value; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/xop/XOPObject.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/xop/XOPObject.java0000644000175000017500000000077010470642610032776 0ustar twernertwernerpackage org.jboss.xb.binding.sunday.xop; /** * @author Heiko Braun * @since Jun 28, 2006 */ public class XOPObject { private Object content; private String contentType; public XOPObject(Object content) { this.content = content; } public Object getContent() { return content; } public String getContentType() { return contentType; } public void setContentType(String contentType) { this.contentType = contentType; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/xop/SimpleDataSource.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/xop/SimpleDataSour0000755000175000017500000000530710470642610033161 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.xop; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import javax.activation.DataSource; import org.jboss.xb.binding.JBossXBRuntimeException; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class SimpleDataSource implements DataSource { public final byte[] bytes; public final String contentType; public SimpleDataSource(Object o, String contentType) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(baos); oos.writeObject(o); } catch(IOException e) { throw new JBossXBRuntimeException("XOP failed to serialize object " + o + ": " + e.getMessage()); } finally { if(oos != null) { try { oos.close(); } catch(IOException e) { } } } bytes = baos.toByteArray(); this.contentType = contentType; } public String getContentType() { return contentType; } public InputStream getInputStream() throws IOException { return new ByteArrayInputStream(bytes); } public String getName() { throw new UnsupportedOperationException("getName is not implemented."); } public OutputStream getOutputStream() throws IOException { throw new UnsupportedOperationException("getOutputStream is not implemented."); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/xop/XOPUnmarshaller.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/xop/XOPUnmarshalle0000755000175000017500000000303110470642610033117 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.xop; /** * This interface is a copy of AttachmentUnmarshaller from JAXB2.0. * It's added to avoid circular module dependecy in the build system. * * @author Alexey Loubyansky * @author Heiko Braun * @version $Revision: 1958 $ */ public interface XOPUnmarshaller { boolean isXOPPackage(); XOPObject getAttachmentAsDataHandler(String cid); byte[] getAttachmentAsByteArray(String cid); } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/xop/XOPIncludeHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/xop/XOPIncludeHand0000755000175000017500000001130310520123274033017 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.xop; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.xml.sax.Attributes; /** * Handler impl for xop:Include type. * * @author Alexey Loubyansky * @version $Revision: 2146 $ */ public class XOPIncludeHandler implements ParticleHandler { // type that can be XOP-optimized (should actually be the element) private final TypeBinding type; private XOPUnmarshaller xopUnmarshaller; public XOPIncludeHandler(TypeBinding type) { this.type = type; } public XOPIncludeHandler(TypeBinding type, XOPUnmarshaller xopUnmarshaller) { this.type = type; this.xopUnmarshaller = xopUnmarshaller; } public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { ElementBinding xopInclude = (ElementBinding)particle.getTerm(); if(!Constants.QNAME_XOP_INCLUDE.equals(xopInclude.getQName())) { throw new JBossXBRuntimeException( "Expected " + Constants.QNAME_XOP_INCLUDE + " but got " + xopInclude.getQName() ); } XOPUnmarshaller xopUnmarshaller = this.xopUnmarshaller == null ? type.getXopUnmarshaller() : this.xopUnmarshaller; if(xopUnmarshaller == null) { throw new JBossXBRuntimeException( "Failed to process " + Constants.QNAME_XOP_INCLUDE + ": XOPUnmarshaller is not provided." ); } String cid = attrs.getValue("href"); if(cid == null) { throw new JBossXBRuntimeException(Constants.QNAME_XOP_INCLUDE + " doesn't contain required href attribute"); } XOPObject xopObject = xopUnmarshaller.getAttachmentAsDataHandler(cid); Object content = xopObject.getContent(); if(content == null) { throw new JBossXBRuntimeException("Content is not available for cid '" + cid + "'"); } if(content instanceof InputStream) { try { ObjectInputStream ois = new ObjectInputStream((InputStream)content); content = ois.readObject(); } catch(IOException e) { throw new JBossXBRuntimeException("Failed to deserialize object: " + e.getMessage()); } catch(ClassNotFoundException e) { throw new JBossXBRuntimeException("Failed to load the class to deserialize object: " + e.getMessage()); } } return content; } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return o; } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { if(parent instanceof XOPElementHandler.XOPElement) { ((XOPElementHandler.XOPElement)parent).value = o; } else { throw new JBossXBRuntimeException("Expected XOPElement as a parent but got " + parent + " for element " + elementName); } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/0000755000175000017500000000000011620316767032401 5ustar twernertwerner././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/XsdBinder.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/XsdB0000644000175000017500000015267511326355033033174 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.io.InputStream; import java.io.Reader; import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.ListIterator; import java.util.List; import java.util.ArrayList; import java.util.Set; import javax.xml.namespace.QName; import org.apache.xerces.xs.StringList; import org.apache.xerces.xs.XSAnnotation; import org.apache.xerces.xs.XSAttributeDeclaration; import org.apache.xerces.xs.XSAttributeUse; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSModel; import org.apache.xerces.xs.XSModelGroup; import org.apache.xerces.xs.XSModelGroupDefinition; import org.apache.xerces.xs.XSNamedMap; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTerm; import org.apache.xerces.xs.XSTypeDefinition; import org.apache.xerces.xs.XSWildcard; import org.jboss.logging.Logger; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.Util; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtCharactersHandler; import org.jboss.xb.binding.sunday.xop.XOPIncludeHandler; import org.jboss.xb.binding.group.ValueListRepeatableParticleHandler; import org.jboss.xb.binding.metadata.AddMethodMetaData; import org.jboss.xb.binding.metadata.CharactersMetaData; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.MapEntryMetaData; import org.jboss.xb.binding.metadata.PackageMetaData; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.metadata.PutMethodMetaData; import org.jboss.xb.binding.metadata.SchemaMetaData; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.metadata.XsdAnnotation; import org.jboss.xb.binding.metadata.XsdAppInfo; /** * @author Alexey Loubyansky * @version $Revision: 3954 $ */ public class XsdBinder { static final Logger log = Logger.getLogger(XsdBinder.class); /** * Creates a new instance of the binder the user can use to tune * configuration before parsing the XSD. * * @return a new instance of the XsdBinder */ public static XsdBinder newInstance() { return new XsdBinder(); } /** * Create a SchemaBinding from and xsd url/uri. * * @param xsdUrl * @return SchemaBinding mapping */ public static SchemaBinding bind(String xsdUrl) { MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); resolver.setBaseURI(xsdUrl); return bind(xsdUrl, resolver); } /** * Create a SchemaBinding from and xsd url/uri. * * @param xsdUrl * @param resolver the resolver will be used to resolve imported schemas in the schema being loaded * and also will be set on the returned instance of SchemaBinding * @return SchemaBinding mapping */ public static SchemaBinding bind(String xsdUrl, SchemaBindingResolver resolver) { XSModel model = Util.loadSchema(xsdUrl, resolver); return bind(model, resolver); } public static SchemaBinding bind(InputStream xsdStream, String encoding) { return bind(xsdStream, encoding, new MultiClassSchemaResolver()); } /** * Create a SchemaBinding from and xsd stream. * * @param xsdStream - the xsd InputStream * @param encoding - optional stream encoding * @return SchemaBinding mapping */ public static SchemaBinding bind(InputStream xsdStream, String encoding, String baseURI) { return bind(xsdStream, encoding, baseURI, true); } /** * Create a SchemaBinding from and xsd stream. * * @param xsdStream - the xsd InputStream * @param encoding - optional stream encoding * @param processAnnotations - process annotations * @return SchemaBinding mapping */ public static SchemaBinding bind(InputStream xsdStream, String encoding, String baseURI, boolean processAnnotations) { MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); resolver.setBaseURI(baseURI); return bind(xsdStream, encoding, resolver, processAnnotations); } /** * Create a SchemaBinding from and xsd stream. * * @param xsdStream - the xsd InputStream * @param encoding - optional stream encoding * @param resolver the resolver will be used to resolve imported schemas in the schema being loaded * and also will be set on the returned instance of SchemaBinding * @return SchemaBinding mapping */ public static SchemaBinding bind(InputStream xsdStream, String encoding, SchemaBindingResolver resolver) { return bind(xsdStream, encoding, resolver, true); } /** * Create a SchemaBinding from and xsd stream. * * @param xsdStream - the xsd InputStream * @param encoding - optional stream encoding * @param resolver the resolver will be used to resolve imported schemas in the schema being loaded * and also will be set on the returned instance of SchemaBinding * @param processAnnotations whether to process annotations * @return SchemaBinding mapping */ public static SchemaBinding bind(InputStream xsdStream, String encoding, SchemaBindingResolver resolver, boolean processAnnotations) { XSModel model = Util.loadSchema(xsdStream, encoding, resolver); return bind(model, resolver, processAnnotations); } public static SchemaBinding bind(Reader xsdReader, String encoding) { return bind(xsdReader, encoding, new MultiClassSchemaResolver()); } /** * Create a SchemaBinding from and xsd reader. * * @param xsdReader - xsd reader * @param encoding - optional reader encoding * @return SchemaBinding mapping */ public static SchemaBinding bind(Reader xsdReader, String encoding, String baseURI) { MultiClassSchemaResolver resolver = new MultiClassSchemaResolver(); resolver.setBaseURI(baseURI); return bind(xsdReader, encoding, resolver); } /** * Create a SchemaBinding from and xsd reader. * * @param xsdReader - xsd reader * @param encoding - optional reader encoding * @param resolver the resolver will be used to resolve imported schemas in the schema being loaded * and also will be set on the returned instance of SchemaBinding * @return SchemaBinding mapping */ public static SchemaBinding bind(Reader xsdReader, String encoding, SchemaBindingResolver resolver) { XSModel model = Util.loadSchema(xsdReader, encoding, resolver); return bind(model, resolver); } /** * Create a SchemaBinding from and xsd string. * * @param xsd - xsd string * @param encoding - optional string encoding * @return SchemaBinding mapping */ public static SchemaBinding bind(String xsd, String encoding) { return bind(xsd, encoding, new MultiClassSchemaResolver()); } /** * Create a SchemaBinding from and xsd string. * * @param xsd - xsd string * @param encoding - optional string encoding * @param resolver the resolver will be used to resolve imported schemas in the schema being loaded * and also will be set on the returned instance of SchemaBinding * @return SchemaBinding mapping */ public static SchemaBinding bind(String xsd, String encoding, SchemaBindingResolver resolver) { XSModel model = Util.loadSchema(xsd, encoding); return bind(model, resolver); } public static SchemaBinding bind(XSModel model, SchemaBindingResolver resolver) { return bind(model,resolver, true); } public static SchemaBinding bind(XSModel model, SchemaBindingResolver resolver, boolean processAnnotations) { XsdBinder binder = new XsdBinder(); binder.setProcessAnnotations(processAnnotations); binder.setSchemaResolver(resolver); return binder.parse(model); } /** * @param schema schema binding the type should be added to * @param type type definition to be bound * @deprecated This method is added temporary to get anonymous type binding working in JBossWS. * It will be removed when anonymous type binding in JBossWS is implemented properly. * No one else should use this method. * *

    This method binds a type definition and adds it as a global type to the passed in schema binding. */ public static void bindType(SchemaBinding schema, XSTypeDefinition type) { XsdBinder binder = new XsdBinder(schema); TypeBinding typeBinding = binder.bindType(type); schema.addType(typeBinding); } /** * @param schema schema binding the type should be added to * @param element element declaration to be bound * @param minOccurs * @param maxOccurs * @param maxOccursUnbounded * @deprecated This method is added temporary to get anonymous type binding working in JBossWS. * It will be removed when anonymous type binding in JBossWS is implemented properly. * No one else should use this method. * *

    This method binds an element declaration and adds it as a global element to the passed in schema binding. */ public static void bindElement(SchemaBinding schema, XSElementDeclaration element, int minOccurs, int maxOccurs, boolean maxOccursUnbounded) { XsdBinder binder = new XsdBinder(schema); ParticleBinding particle = binder.bindElement(element, minOccurs, maxOccurs, maxOccursUnbounded ); schema.addElementParticle(particle); } // Exposed attributes private boolean processAnnotations = true; private SchemaBindingResolver resolver; private boolean simpleContentWithIdAsSimpleType = true; private boolean unresolvedContentBoundToDOM = true; // Internal attributes private boolean trace = log.isTraceEnabled(); private final SchemaBinding schema; private SharedElements sharedElements = new SharedElements(); private final List typeGroupStack = new ArrayList(); // Ctors private XsdBinder() { this(new SchemaBinding()); } private XsdBinder(SchemaBinding schema) { this.schema = schema; } // Public public void setProcessAnnotations(boolean processAnnotations) { this.processAnnotations = processAnnotations; } public boolean isProcessAnnotations() { return processAnnotations; } public void setSchemaResolver(SchemaBindingResolver resolver) { this.resolver = resolver; } public SchemaBindingResolver getSchemaResolver() { return resolver; } public void setSimpleContentWithIdAsSimpleType(boolean simpleContentWithIdAsSimpleType) { this.simpleContentWithIdAsSimpleType = simpleContentWithIdAsSimpleType; } public boolean isSimpleContentWithIdAsSimpleType() { return simpleContentWithIdAsSimpleType; } public void setUnresolvedContentBoundToDOM(boolean toDOM) { this.unresolvedContentBoundToDOM = toDOM; } public boolean isUnresolvedContentBoundToDOM() { return this.unresolvedContentBoundToDOM; } public SchemaBinding parse(String xsdUrl) { if(resolver == null) { resolver = new MultiClassSchemaResolver(); } XSModel model = Util.loadSchema(xsdUrl, resolver); return parse(model); } public SchemaBinding parse(InputStream xsdStream, String encoding) { if(resolver == null) { resolver = new MultiClassSchemaResolver(); } XSModel model = Util.loadSchema(xsdStream, encoding, resolver); return parse(model); } public SchemaBinding parse(Reader xsdReader, String encoding) { if(resolver == null) { resolver = new MultiClassSchemaResolver(); } XSModel model = Util.loadSchema(xsdReader, encoding, resolver); return parse(model); } // Private private SchemaBinding parse(XSModel model) { schema.setSchemaResolver(resolver); // read annotations. for now just log the ones that are going to be used if (processAnnotations) { XSObjectList annotations = model.getAnnotations(); if (trace) { log.trace("started binding schema " + schema); log.trace("Schema annotations: " + annotations.getLength()); } for(int i = 0; i < annotations.getLength(); ++i) { XSAnnotation annotation = (XSAnnotation)annotations.item(i); XsdAnnotation an = XsdAnnotation.unmarshal(annotation.getAnnotationString()); XsdAppInfo appinfo = an.getAppInfo(); if(appinfo != null) { SchemaMetaData schemaBindings = appinfo.getSchemaMetaData(); if(schemaBindings != null) { // Get the ignoreUnresolvedFieldOrClass schema.setIgnoreUnresolvedFieldOrClass(schemaBindings.isIgnoreUnresolvedFieldOrClass()); // Get the ignoreUnresolvedFieldOrClass schema.setReplacePropertyRefs(schemaBindings.isReplacePropertyRefs()); // Get the default package PackageMetaData packageMetaData = schemaBindings.getPackage(); if(packageMetaData != null) { if (trace) log.trace("schema default package: " + packageMetaData.getName()); schema.setPackageMetaData(packageMetaData); } } } } } StringList namespaceList = model.getNamespaces(); Set namespaces = new LinkedHashSet(namespaceList.getLength()); for (int i = 0; i < namespaceList.getLength(); ++i) namespaces.add(namespaceList.item(i)); schema.setNamespaces(namespaces); XSNamedMap groups = model.getComponents(XSConstants.MODEL_GROUP_DEFINITION); if (trace) log.trace("Model groups: " + groups.getLength()); // First make sure we bind all the groups for(int i = 0; i < groups.getLength(); ++i) { XSModelGroupDefinition groupDef = (XSModelGroupDefinition)groups.item(i); bindGlobalGroup(groupDef); } // Now bind the particles which may have references to the other groups for(int i = 0; i < groups.getLength(); ++i) { XSModelGroupDefinition groupDef = (XSModelGroupDefinition)groups.item(i); bindGlobalGroupParticles(groupDef.getModelGroup()); } XSNamedMap types = model.getComponents(XSConstants.TYPE_DEFINITION); if (trace) log.trace("Model types: " + types.getLength()); for(int i = 0; i < types.getLength(); ++i) { XSTypeDefinition type = (XSTypeDefinition)types.item(i); if(!Constants.NS_XML_SCHEMA.equals(type.getNamespace())) { bindType(type); } } XSNamedMap elements = model.getComponents(XSConstants.ELEMENT_DECLARATION); if (trace) log.trace("Model elements: " + types.getLength()); for(int i = 0; i < elements.getLength(); ++i) { XSElementDeclaration element = (XSElementDeclaration)elements.item(i); bindElement(element, 1, 0, false); } if(unresolvedContentBoundToDOM) { schema.setUnresolvedContentBoundToDOM(unresolvedContentBoundToDOM); } if (trace) { log.trace("finished binding schema " + schema); } return schema; } // Private private TypeBinding bindType(XSTypeDefinition type) { TypeBinding binding; switch(type.getTypeCategory()) { case XSTypeDefinition.SIMPLE_TYPE: binding = bindSimpleType((XSSimpleTypeDefinition)type); break; case XSTypeDefinition.COMPLEX_TYPE: binding = bindComplexType((XSComplexTypeDefinition)type); break; default: throw new JBossXBRuntimeException("Unexpected type category: " + type.getTypeCategory()); } return binding; } private TypeBinding bindSimpleType(XSSimpleTypeDefinition type) { QName typeName = type.getName() == null ? null : new QName(type.getNamespace(), type.getName()); TypeBinding binding = typeName == null ? null : schema.getType(typeName); if(binding != null) { return binding; } if(trace) { log.trace("binding simple type " + typeName); } XSTypeDefinition baseTypeDef = type.getBaseType(); TypeBinding baseType = baseTypeDef == null ? null : bindType(baseTypeDef); if(baseType == null) { binding = new TypeBinding(typeName); } else { binding = new TypeBinding(typeName, baseType); if(Constants.NS_XML_SCHEMA.equals(baseTypeDef.getNamespace())) binding.setCharactersHandler(DefaultHandlers.CHARACTERS_HANDLER_FACTORY.newCharactersHandler()); } StringList strList = type.getLexicalPattern(); if(strList != null && strList.getLength() > 0) { for(int i = 0; i < strList.getLength(); ++i) { binding.addLexicalPattern(strList.item(i)); } } strList = type.getLexicalEnumeration(); if(strList != null && strList.getLength() > 0) { for(int i = 0; i < strList.getLength(); ++i) { binding.addEnumValue(strList.item(i)); } } if(type.getItemType() != null) { TypeBinding itemType = bindSimpleType(type.getItemType()); binding.setItemType(itemType); } if(typeName != null) { schema.addType(binding); } if(trace) { String msg = typeName == null ? "bound simple anonymous type" : "bound simple type " + typeName; if(baseType != null) { msg += " inherited binding metadata from " + baseType.getQName(); } log.trace(msg); } // customize binding with annotations if(processAnnotations) { XSObjectList annotations = type.getAnnotations(); if(annotations != null) { if(trace) { log.trace(typeName + " annotations " + annotations.getLength()); } for(int i = 0; i < annotations.getLength(); ++i) { XSAnnotation an = (XSAnnotation)annotations.item(i); XsdAnnotation xsdAn = XsdAnnotation.unmarshal(an.getAnnotationString()); XsdAppInfo appInfo = xsdAn.getAppInfo(); if(appInfo != null) { ClassMetaData classMetaData = appInfo.getClassMetaData(); if(classMetaData != null) { if(trace) { log.trace("simple type " + type.getName() + ": impl=" + classMetaData.getImpl()); } binding.setClassMetaData(classMetaData); } ValueMetaData valueMetaData = appInfo.getValueMetaData(); if(valueMetaData != null) { if(trace) { log.trace("simple type " + type.getName() + ": unmarshalMethod=" + valueMetaData.getUnmarshalMethod() + ", marshalMethod=" + valueMetaData.getMarshalMethod()); } binding.setValueMetaData(valueMetaData); } } } } } binding.setSchemaBinding(schema); return binding; } private TypeBinding bindComplexType(XSComplexTypeDefinition type) { QName typeName = type.getName() == null ? null : new QName(type.getNamespace(), type.getName()); TypeBinding binding = typeName == null ? null : schema.getType(typeName); if(binding != null) { return binding; } XSTypeDefinition baseTypeDef = type.getBaseType(); // anyType is the parent of all the types, even the parent of itself according to xerces :) TypeBinding baseType = null; if(baseTypeDef != null && !Constants.QNAME_ANYTYPE.equals(typeName)) { baseType = bindType(baseTypeDef); // sometimes binding the base type can lead to another request // to bind the type being bound here if(typeName != null) { binding = schema.getType(typeName); if(binding != null) { return binding; } } } if (trace) log.trace("binding complex " + (typeName == null ? "anonymous type" : "type " + typeName)); binding = new TypeBinding(typeName); binding.setBaseType(baseType); binding.setSimple(false); if(type.getSimpleType() != null) { TypeBinding simpleType = bindSimpleType(type.getSimpleType()); binding.setSimpleType(simpleType); } else if(type.getContentType() == XSComplexTypeDefinition.CONTENTTYPE_MIXED) { TypeBinding stringType = schema.getType(Constants.QNAME_STRING); if(stringType == null) { throw new JBossXBRuntimeException("xsd:string has not been bound yet!"); } binding.setSimpleType(stringType); } if(typeName != null) { schema.addType(binding); } binding.setSchemaBinding(schema); XSObjectList attrs = type.getAttributeUses(); if (trace) log.trace(typeName + " attributes " + attrs.getLength()); AttributeBinding attrBinding = null; boolean hasOnlyIdAttrs = true; for(int i = 0; i < attrs.getLength(); ++i) { XSAttributeUse attr = (XSAttributeUse)attrs.item(i); attrBinding = bindAttribute(attr); binding.addAttribute(attrBinding); if(hasOnlyIdAttrs && !Constants.QNAME_ID.equals(attrBinding.getType().getQName())) { hasOnlyIdAttrs = false; } } // customize binding with xsd annotations if (processAnnotations) { XSObjectList annotations = type.getAnnotations(); if(annotations != null) { if (trace) log.trace(typeName + " annotations " + annotations.getLength()); for(int i = 0; i < annotations.getLength(); ++i) { XSAnnotation an = (XSAnnotation)annotations.item(i); XsdAnnotation xsdAn = XsdAnnotation.unmarshal(an.getAnnotationString()); XsdAppInfo appInfo = xsdAn.getAppInfo(); if(appInfo != null) { ClassMetaData classMetaData = appInfo.getClassMetaData(); if(classMetaData != null) { if (trace) { log.trace("complex type " + type.getName() + ": impl=" + classMetaData.getImpl() ); } binding.setClassMetaData(classMetaData); } CharactersMetaData charactersMetaData = appInfo.getCharactersMetaData(); if(charactersMetaData != null) { if (trace) { PropertyMetaData propertyMetaData = charactersMetaData.getProperty(); if(propertyMetaData != null) { log.trace("complex type " + type.getName() + ": characters bound to " + propertyMetaData.getName() ); } ValueMetaData valueMetaData = charactersMetaData.getValue(); if(valueMetaData != null) { log.trace("complex type " + type.getName() + ": characters unmarshalMethod=" + valueMetaData.getUnmarshalMethod() + ", marshalMethod=" + valueMetaData.getMarshalMethod() ); } boolean mapEntryKey = appInfo.isMapEntryKey(); if(mapEntryKey) { log.trace("complex type " + type.getName() + ": characters are bound as a key in a map entry" ); } boolean mapEntryValue = appInfo.isMapEntryValue(); if(mapEntryValue) { log.trace("complex type " + type.getName() + ": characters are bound as a value in a map entry" ); } } binding.setCharactersMetaData(charactersMetaData); } MapEntryMetaData mapEntryMetaData = appInfo.getMapEntryMetaData(); if(mapEntryMetaData != null) { if (trace) { log.trace("complex type " + type.getName() + " is bound to a map entry: impl=" + mapEntryMetaData.getImpl() + ", getKeyMethod=" + mapEntryMetaData.getGetKeyMethod() + ", setKeyMethod=" + mapEntryMetaData.getSetKeyMethod() + ", getValueMethod=" + mapEntryMetaData.getGetValueMethod() + ", setValueMethod=" + mapEntryMetaData.getSetValueMethod() + ", valueType=" + mapEntryMetaData.getValueType() + ", nonNullValue=" + mapEntryMetaData.isNonNullValue() ); } if(classMetaData != null) { throw new JBossXBRuntimeException("Illegal binding: both jbxb:class and jbxb:mapEntry are specified for complex type " + type.getName() ); } binding.setMapEntryMetaData(mapEntryMetaData); } boolean skip = appInfo.isSkip(); if(skip) { if (trace) { log.trace("complex type " + type.getName() + ": elements of this type will be skipped; their attrs, character content " + "and elements will be set the parent." ); } binding.setSkip(skip); } PropertyMetaData propertyMetaData = appInfo.getPropertyMetaData(); if(propertyMetaData != null) { if (trace) { log.trace("complex type " + type.getName() + ": the content of elements of this type is bound to property " + propertyMetaData.getName() ); } binding.setPropertyMetaData(propertyMetaData); } AddMethodMetaData addMethodMetaData = appInfo.getAddMethodMetaData(); if(addMethodMetaData != null) { if (trace) { log.trace("complex type " + type.getName() + ": elements of this type will be added to parent objects with addMethod=" + addMethodMetaData.getMethodName() + ", valueType=" + addMethodMetaData.getValueType() ); } binding.setAddMethodMetaData(addMethodMetaData); } } } } } XSParticle particle = type.getParticle(); if(particle != null) { pushType(binding); bindParticle(particle); popType(); } if(binding.getClassMetaData() == null && simpleContentWithIdAsSimpleType && particle == null && hasOnlyIdAttrs) { binding.setStartElementCreatesObject(false); } else { binding.setStartElementCreatesObject(true); } if(binding.hasOnlyXmlMimeAttributes()) { addXOPInclude(binding, schema); } if(trace) { log.trace(typeName == null ? "bound complex anonymous type" : "bound complex type " + typeName); } return binding; } private AttributeBinding bindAttribute(XSAttributeUse attrUse) { XSAttributeDeclaration attr = attrUse.getAttrDeclaration(); QName attrName = new QName(attr.getNamespace(), attr.getName()); XSSimpleTypeDefinition attrType = attr.getTypeDefinition(); TypeBinding typeBinding = bindSimpleType(attrType); if (trace) { log.trace("binding attribute " + attrName + ", required=" + attrUse.getRequired()); } AttributeBinding binding = new AttributeBinding(schema, attrName, typeBinding, DefaultHandlers.ATTRIBUTE_HANDLER); binding.setRequired(attrUse.getRequired()); if(attrUse.getConstraintType() == XSConstants.VC_DEFAULT) { // Associate the default value with the binding binding.setDefaultConstraint(attrUse.getConstraintValue()); } if (processAnnotations) { XSAnnotation an = attr.getAnnotation(); if(an != null) { if (trace) { log.trace(attrName + " attribute annotation"); } XsdAnnotation xsdAn = XsdAnnotation.unmarshal(an.getAnnotationString()); XsdAppInfo appInfo = xsdAn.getAppInfo(); if(appInfo != null) { PropertyMetaData propertyMetaData = appInfo.getPropertyMetaData(); if(propertyMetaData != null) { binding.setPropertyMetaData(propertyMetaData); } boolean mapEntryKey = appInfo.isMapEntryKey(); if(mapEntryKey) { binding.setMapEntryKey(mapEntryKey); } boolean mapEntryValue = appInfo.isMapEntryValue(); if(mapEntryValue) { binding.setMapEntryValue(mapEntryValue); } } } } if (trace) { String msg = "bound attribute " + attrName; if(binding.getPropertyMetaData() != null) { msg += " property=" + binding.getPropertyMetaData().getName() + ", collectionType=" + binding.getPropertyMetaData().getCollectionType(); } else if(binding.isMapEntryKey()) { msg += "bound as a key in a map entry"; } else if(binding.isMapEntryValue()) { msg += "bound as a value in a map entry"; } else { msg += " type=" + attrType.getName(); } if(binding.getDefaultConstraint() != null) { msg += ", default=" + binding.getDefaultConstraint(); } log.trace(msg); } return binding; } private void bindParticle(XSParticle particle) { ParticleBinding particleBinding = null; XSTerm term = particle.getTerm(); switch(term.getType()) { case XSConstants.MODEL_GROUP: XSModelGroup modelGroup = (XSModelGroup)term; // todo: investigate this if(modelGroup.getParticles().getLength() > 0) { ModelGroupBinding groupBinding = bindModelGroup(modelGroup); particleBinding = new ParticleBinding(groupBinding); particleBinding.setMaxOccursUnbounded(particle.getMaxOccursUnbounded()); particleBinding.setMinOccurs(particle.getMinOccurs()); particleBinding.setMaxOccurs(particle.getMaxOccurs()); Object o = peekTypeOrGroup(); if(o instanceof ModelGroupBinding) { ModelGroupBinding parentGroup = (ModelGroupBinding)o; parentGroup.addParticle(particleBinding); if (trace) { log.trace("added " + groupBinding + " to " + parentGroup); } } else if(o instanceof TypeBinding) { TypeBinding typeBinding = (TypeBinding)o; typeBinding.setParticle(particleBinding); if (trace) { log.trace("added " + groupBinding + " to type " + typeBinding.getQName()); } } if (groupBinding.getParticles().isEmpty()) { pushModelGroup(groupBinding); bindModelGroupParticles(modelGroup); popModelGroup(); } } break; case XSConstants.WILDCARD: particleBinding = bindWildcard(particle); break; case XSConstants.ELEMENT_DECLARATION: particleBinding = bindElement( (XSElementDeclaration)term, particle.getMinOccurs(), particle.getMaxOccurs(), particle.getMaxOccursUnbounded() ); break; default: throw new IllegalStateException("Unexpected term type: " + term.getType()); } if(particleBinding != null) particleBinding.getTerm().setRepeatableHandler(ValueListRepeatableParticleHandler.INSTANCE); } private ModelGroupBinding bindModelGroup(XSModelGroup modelGroup) { // Is this a global group? ModelGroupBinding groupBinding = sharedElements.getGlobalGroup(modelGroup); if (groupBinding != null) return groupBinding; switch(modelGroup.getCompositor()) { case XSModelGroup.COMPOSITOR_ALL: groupBinding = new AllBinding(schema); break; case XSModelGroup.COMPOSITOR_CHOICE: groupBinding = new ChoiceBinding(schema); break; case XSModelGroup.COMPOSITOR_SEQUENCE: groupBinding = new SequenceBinding(schema); break; default: throw new JBossXBRuntimeException("Unexpected model group: " + modelGroup.getCompositor()); } if (trace) log.trace("created model group " + groupBinding); if (processAnnotations) { XSAnnotation annotation = modelGroup.getAnnotation(); if (annotation != null) customizeTerm(annotation, groupBinding, trace); } return groupBinding; } private ParticleBinding bindWildcard(XSParticle particle) { WildcardBinding binding = new WildcardBinding(schema); ModelGroupBinding group = (ModelGroupBinding)peekTypeOrGroup(); ParticleBinding particleBinding = new ParticleBinding(binding); particleBinding.setMaxOccurs(particle.getMaxOccurs()); particleBinding.setMaxOccursUnbounded(particle.getMaxOccursUnbounded()); particleBinding.setMinOccurs(particle.getMinOccurs()); group.addParticle(particleBinding); XSWildcard wildcard = (XSWildcard)particle.getTerm(); if(wildcard.getName() != null) { binding.setQName(new QName(wildcard.getNamespace(), wildcard.getName())); } binding.setProcessContents(wildcard.getProcessContents()); if (processAnnotations) { XSAnnotation annotation = wildcard.getAnnotation(); if(annotation != null) { customizeTerm(annotation, binding, trace); } } return particleBinding; } private ParticleBinding bindElement(XSElementDeclaration elementDec, int minOccurs, int maxOccurs, boolean maxOccursUnbounded) { QName qName = new QName(elementDec.getNamespace(), elementDec.getName()); ModelGroupBinding parentGroup = (ModelGroupBinding)peekTypeOrGroup(); boolean global = elementDec.getScope() == XSConstants.SCOPE_GLOBAL; ElementBinding element = schema.getElement(qName); ParticleBinding particle; if(global && element != null) { particle = new ParticleBinding(element); if(parentGroup != null) { parentGroup.addParticle(particle); } particle.setMinOccurs(minOccurs); if(maxOccursUnbounded) { particle.setMaxOccursUnbounded(maxOccursUnbounded); } else { particle.setMaxOccurs(maxOccurs); } return particle; } TypeBinding type = null; boolean shared = sharedElements.isShared(elementDec); if(shared) { type = sharedElements.getTypeBinding(elementDec); } if(type == null) { type = bindType(elementDec.getTypeDefinition()); if(shared) { sharedElements.setTypeBinding(elementDec, type); } } element = new ElementBinding(schema, qName, type); element.setNillable(elementDec.getNillable()); particle = new ParticleBinding(element); particle.setMinOccurs(minOccurs); particle.setMaxOccurs(maxOccurs); particle.setMaxOccursUnbounded(maxOccursUnbounded); if(global) { schema.addElementParticle(particle); } if(parentGroup != null) { parentGroup.addParticle(particle); if (trace) { log.trace("Element " + element.getQName() + " added to " + parentGroup); } } if (trace) { TypeBinding parentType = peekType(); QName parentQName = null; if (parentType != null) parentQName = parentType.getQName(); log.trace("element: name=" + qName + ", type=" + type.getQName() + ", repeatable=" + particle.isRepeatable() + ", nillable=" + element.isNillable() + ", minOccurs=" + minOccurs + ", maxOccurs=" + (maxOccursUnbounded ? "unbounded" : "" + maxOccurs) + ", " + (global ? "global scope" : " owner type=" + parentQName) ); } // customize element with annotations if (processAnnotations) { XSAnnotation an = elementDec.getAnnotation(); if(an != null) { customizeTerm(an, element, trace); } } return particle; } private void bindModelGroupParticles(XSModelGroup modelGroup) { XSObjectList particles = modelGroup.getParticles(); for(int i = 0; i < particles.getLength(); ++i) { XSParticle particle = (XSParticle)particles.item(i); bindParticle(particle); } } // Private private static void addXOPInclude(TypeBinding binding, SchemaBinding schema) { binding.setHandler(DefaultHandlers.XOP_HANDLER); if(binding.getParticle() != null) { throw new JBossXBRuntimeException( "XOP optimizable type has a particle which is unexpected, please, open a JIRA issue!" ); } TypeBinding anyUriType = schema.getType(Constants.QNAME_ANYURI); if(anyUriType == null) { log.warn("Type " + Constants.QNAME_ANYURI + " not bound."); } TypeBinding xopIncludeType = new TypeBinding(new QName(Constants.NS_XOP_INCLUDE, "Include")); xopIncludeType.setSchemaBinding(schema); xopIncludeType.addAttribute(new QName("href"), anyUriType, DefaultHandlers.ATTRIBUTE_HANDLER); xopIncludeType.setHandler(new XOPIncludeHandler(binding)); ElementBinding xopInclude = new ElementBinding(schema, new QName(Constants.NS_XOP_INCLUDE, "Include"), xopIncludeType); ParticleBinding particleBinding = new ParticleBinding(xopInclude); particleBinding.setMinOccurs(0); binding.addParticle(particleBinding); } private static void customizeTerm(XSAnnotation an, TermBinding term, boolean trace) { XsdAnnotation xsdAn = XsdAnnotation.unmarshal(an.getAnnotationString()); XsdAppInfo appInfo = xsdAn.getAppInfo(); if(appInfo != null) { Boolean skip = null; ClassMetaData classMetaData = appInfo.getClassMetaData(); if(classMetaData != null) { if (trace) { String msg; if(term.isModelGroup()) { msg = term + " bound to "; } else if(term.isWildcard()) { msg = " wildcard bound to "; } else { msg = "element: name=" + ((ElementBinding)term).getQName() + ", class="; } msg += classMetaData.getImpl(); log.trace(msg); } term.setClassMetaData(classMetaData); skip = Boolean.FALSE; } PropertyMetaData propertyMetaData = appInfo.getPropertyMetaData(); if(propertyMetaData != null) { if (trace) { String msg = term.isWildcard() || term.isModelGroup() ? term + " " : "element: name=" + ((ElementBinding)term).getQName() + ", "; msg += " property=" + propertyMetaData.getName() + ", collectionType=" + propertyMetaData.getCollectionType(); log.trace(msg); } term.setPropertyMetaData(propertyMetaData); } MapEntryMetaData mapEntryMetaData = appInfo.getMapEntryMetaData(); if(mapEntryMetaData != null) { if(propertyMetaData != null) { String msg = "A term can be bound either as a property or as a map" + " entry but not both: " + (term.isModelGroup() ? term.toString() : ((ElementBinding)term).getQName().toString()); throw new JBossXBRuntimeException(msg); } if (trace) { String msg = term.isWildcard() || term.isModelGroup() ? term.toString() : "element name=" + ((ElementBinding)term).getQName(); msg += " is bound to a map entry: impl=" + mapEntryMetaData.getImpl() + ", getKeyMethod=" + mapEntryMetaData.getGetKeyMethod() + ", setKeyMethod=" + mapEntryMetaData.getSetKeyMethod() + ", getValueMethod=" + mapEntryMetaData.getGetValueMethod() + ", setValueMethod=" + mapEntryMetaData.getSetValueMethod() + ", valueType=" + mapEntryMetaData.getValueType() + ", nonNullValue=" + mapEntryMetaData.isNonNullValue(); log.trace(msg); } if(classMetaData != null) { String msg = "Invalid customization: both jbxb:class and jbxb:mapEntry are specified for term " + (term.isWildcard() || term.isModelGroup() ? term.toString() : ((ElementBinding)term).getQName().toString()); throw new JBossXBRuntimeException(msg); } term.setMapEntryMetaData(mapEntryMetaData); skip = Boolean.FALSE; } PutMethodMetaData putMethodMetaData = appInfo.getPutMethodMetaData(); if(putMethodMetaData != null) { if (trace) { String msg = term.isWildcard() || term.isModelGroup() ? term.toString() : "element: name=" + ((ElementBinding)term).getQName() + ","; msg += " putMethod=" + putMethodMetaData.getName() + ", keyType=" + putMethodMetaData.getKeyType() + ", valueType=" + putMethodMetaData.getValueType(); log.trace(msg); } term.setPutMethodMetaData(putMethodMetaData); } AddMethodMetaData addMethodMetaData = appInfo.getAddMethodMetaData(); if(addMethodMetaData != null) { if (trace) { String msg = term.isWildcard() || term.isModelGroup() ? term.toString() : "element: name=" + ((ElementBinding)term).getQName() + ","; msg += " addMethod=" + addMethodMetaData.getMethodName() + ", valueType=" + addMethodMetaData.getValueType() + ", isChildType=" + addMethodMetaData.isChildType(); log.trace(msg); } term.setAddMethodMetaData(addMethodMetaData); } ValueMetaData valueMetaData = appInfo.getValueMetaData(); if(valueMetaData != null) { if (trace) { String msg = term.isWildcard() || term.isModelGroup() ? term.toString() : "element " + ((ElementBinding)term).getQName(); msg += ": unmarshalMethod=" + valueMetaData.getUnmarshalMethod(); log.trace(msg); } term.setValueMetaData(valueMetaData); if(term.isElement()) { ElementBinding e = (ElementBinding)term; TypeBinding currentType = e.getType(); // that's not nice, i.e. creating another type with the same name but not adding it to SchemaBinding // but it would be wrong to do that in case of built-in types TypeBinding newType = new TypeBinding(currentType.getQName(), currentType); CharactersHandler ch = DefaultHandlers.CHARACTERS_HANDLER_FACTORY.newCharactersHandler(RtCharactersHandler.VALUE_METADATA_UNMARSHAL_HANDLER); newType.setCharactersHandler(ch); e.setType(newType); } } boolean mapEntryKey = appInfo.isMapEntryKey(); if(mapEntryKey) { if (trace) { String msg = term.isWildcard() || term.isModelGroup() ? term.toString() : "element name=" + ((ElementBinding)term).getQName(); msg += ": is bound to a key in a map entry"; log.trace(msg); } term.setMapEntryKey(mapEntryKey); skip = Boolean.FALSE; } boolean mapEntryValue = appInfo.isMapEntryValue(); if(mapEntryValue) { if (trace) { String msg = term.isWildcard() || term.isModelGroup() ? term.toString() : "element name=" + ((ElementBinding)term).getQName(); msg += ": is bound to a value in a map entry"; log.trace(msg); } term.setMapEntryValue(mapEntryValue); skip = Boolean.FALSE; } boolean skipAnnotation = appInfo.isSkip(); if(skip != null) { term.setSkip(skip); } else if(skipAnnotation) { if (trace) { String msg = term.isWildcard() || term.isModelGroup() ? term.toString() : "element name=" + ((ElementBinding)term).getQName(); msg += ": will be skipped, it's attributes, character content and children will be set on the parent"; log.trace(msg); } term.setSkip(skipAnnotation); } } } private void bindGlobalGroup(XSModelGroupDefinition groupDef) { QName groupName = new QName(groupDef.getNamespace(), groupDef.getName()); XSModelGroup group = groupDef.getModelGroup(); ModelGroupBinding groupBinding = bindModelGroup(group); groupBinding.setQName(groupName); sharedElements.addGlobalGroup(group, groupBinding); schema.addGroup(groupName, groupBinding); } private void bindGlobalGroupParticles(XSModelGroup group) { ModelGroupBinding groupBinding = sharedElements.getGlobalGroup(group); if (groupBinding.getParticles().isEmpty()) { pushModelGroup(groupBinding); bindModelGroupParticles(group); popModelGroup(); } } private void popType() { Object o = typeGroupStack.remove(typeGroupStack.size() - 1); if(!(o instanceof TypeBinding)) { throw new JBossXBRuntimeException("Should have poped type binding but got " + o); } } private void pushType(TypeBinding binding) { typeGroupStack.add(binding); } private void popModelGroup() { Object o = typeGroupStack.remove(typeGroupStack.size() - 1); if(!(o instanceof ModelGroupBinding)) { throw new JBossXBRuntimeException("Should have poped model group binding but got " + o); } } private void pushModelGroup(ModelGroupBinding binding) { typeGroupStack.add(binding); } private Object peekTypeOrGroup() { return typeGroupStack.isEmpty() ? null : typeGroupStack.get(typeGroupStack.size() - 1); } private TypeBinding peekType() { TypeBinding binding = null; for(ListIterator i = typeGroupStack.listIterator(typeGroupStack.size()); i.hasPrevious();) { Object o = i.previous(); if(o instanceof TypeBinding) { binding = (TypeBinding)o; break; } } return binding; } // Inner private static final class SharedElements { private Map elements = Collections.emptyMap(); private Map globalGroups = Collections.emptyMap(); public void add(XSElementDeclaration element) { switch(elements.size()) { case 0: elements = Collections.singletonMap(element, null); break; case 1: elements = new HashMap(elements); default: elements.put(element, null); } } public boolean isShared(XSElementDeclaration element) { return elements.containsKey(element); } public TypeBinding getTypeBinding(XSElementDeclaration element) { return (TypeBinding)elements.get(element); } public void setTypeBinding(XSElementDeclaration element, TypeBinding type) { switch(elements.size()) { case 0: elements = Collections.singletonMap(element, type); break; case 1: elements = new HashMap(elements); default: elements.put(element, type); } } public void addGlobalGroup(XSModelGroup group, ModelGroupBinding groupBinding) { switch(globalGroups.size()) { case 0: globalGroups = Collections.singletonMap(group, groupBinding); break; case 1: globalGroups = new HashMap(globalGroups); default: globalGroups.put(group, groupBinding); } } public ModelGroupBinding getGlobalGroup(XSModelGroup group) { return (ModelGroupBinding) globalGroups.get(group); } } } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/RepeatableParticleHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Repe0000644000175000017500000000324611274325076033222 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; /** * A RepeatableParticleHandler. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public interface RepeatableParticleHandler { Object startRepeatableParticle(Object parent, QName startName, ParticleBinding particle); void addTermValue(Object particleValue, Object termValue, QName elementName, ParticleBinding particle, ParticleBinding parentParticle, ParticleHandler handler); void endRepeatableParticle(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle); } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AttributeHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Attr0000644000175000017500000000512211134135334033223 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import org.jboss.util.StringPropertyReplacer; import org.jboss.xb.binding.metadata.ValueMetaData; /** * @author Alexey Loubyansky * @version $Revision: 2960 $ */ public abstract class AttributeHandler { public static AttributeHandler NOOP = new AttributeHandler() { public void attribute(QName elemName, QName attrName, AttributeBinding binding, Object owner, Object value) { } }; public Object unmarshal(QName elemName, QName attrName, AttributeBinding binding, NamespaceContext nsCtx, String value) { TypeBinding type = binding.getType(); if(value != null) { if(binding.isNormalizeSpace()) value = value.trim(); SchemaBinding schema = binding.getSchema(); if(schema.isReplacePropertyRefs()) value = StringPropertyReplacer.replaceProperties(value); } ValueMetaData valueMetaData = binding.getValueMetaData(); return type == null ? value : type.getCharactersHandler().unmarshal(attrName, type, nsCtx, valueMetaData, value); } public abstract void attribute(QName elemName, QName attrName, AttributeBinding binding, Object owner, Object value); } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AllBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AllB0000755000175000017500000000704411335111240033124 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.Map; import java.util.Collections; import java.util.HashMap; import java.util.Collection; import javax.xml.namespace.QName; import org.jboss.xb.binding.JBossXBRuntimeException; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 4033 $ */ public class AllBinding extends ModelGroupBinding { //private static final Logger log = Logger.getLogger(AllBinding.class); private Map elements = Collections.emptyMap(); public AllBinding(SchemaBinding schema) { super(schema); } public ElementBinding getArrayItem() { return null; } public void addParticle(ParticleBinding particle) { if(!particle.getTerm().isElement()) { throw new JBossXBRuntimeException("Model group all may contain only elements!"); } ElementBinding element = (ElementBinding)particle.getTerm(); switch(elements.size()) { case 0: elements = Collections.singletonMap(element.getQName(), particle); break; case 1: elements = new HashMap(elements); default: elements.put(element.getQName(), particle); } super.addParticle(particle); } public Collection getParticles() { return elements.values(); } public AbstractPosition newPosition(QName qName, Attributes attrs, ParticleBinding allParticle) { ParticleBinding particle = elements.get(qName); if(particle != null) { AbstractPosition next = particle.getTerm().newPosition(qName, attrs, particle); return new AllPosition(qName, allParticle, next); } return null; } @Override public String getGroupType() { return "all"; } private final class AllPosition extends NonElementPosition { private AllPosition(QName name, ParticleBinding particle, AbstractPosition next) { super(name, particle, next); } public AbstractPosition nextPosition(QName qName, Attributes atts) { ParticleBinding particle = elements.get(qName); if(particle != null) { next = particle.getTerm().newPosition(qName, atts, particle); next.previous = this; // TODO occurrence is not used here ++occurrence; return this; } nextNotFound(); return null; } } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ParticleBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Part0000755000175000017500000000556711311457352033243 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; /** * @author Alexey Loubyansky * @version $Revision: 3850 $ */ public class ParticleBinding { private TermBinding term; private int minOccurs = 1; private int maxOccurs = 1; private boolean maxOccursUnbounded; public ParticleBinding(TermBinding term, int minOccurs, int maxOccurs, boolean maxOccursUnbounded) { this.term = term; this.minOccurs = minOccurs; this.maxOccurs = maxOccurs; this.maxOccursUnbounded = maxOccursUnbounded; } public ParticleBinding(TermBinding term) { this.term = term; } public int getMinOccurs() { return minOccurs; } public int getMaxOccurs() { return maxOccurs; } public boolean getMaxOccursUnbounded() { return maxOccursUnbounded; } public void setMinOccurs(int minOccurs) { this.minOccurs = minOccurs; } public void setMaxOccurs(int maxOccurs) { this.maxOccurs = maxOccurs; } public void setMaxOccursUnbounded(boolean maxOccursUnbounded) { this.maxOccursUnbounded = maxOccursUnbounded; } public TermBinding getTerm() { return term; } public void setTerm(TermBinding term) { this.term = term; } public boolean isRepeatable() { return maxOccursUnbounded || maxOccurs > 1 || minOccurs > 1; } public boolean isRequired() { return minOccurs > 0 && (!term.isModelGroup() || ((ModelGroupBinding)term).hasRequiredParticle()); } public boolean isOccurrenceAllowed(int occurrence) { return maxOccursUnbounded || occurrence <= maxOccurs; } public String toString() { return "[" + term.toString() + ", minOccurs=" + minOccurs + ", maxOccurs=" + (maxOccursUnbounded ? "unbounded" : String.valueOf(maxOccurs)) + "]"; } } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/TermBeforeSetParentCallback.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Term0000644000175000017500000000247710515676064033246 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; /** * @author Alexey Loubyansky * @version $Revision: 2045 $ */ public interface TermBeforeSetParentCallback { Object beforeSetParent(Object o, UnmarshallingContext ctx); } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SchemaBindingInitializer.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Sche0000755000175000017500000000355610470642610033211 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; /** * An implementation of this interface is given an instance of SchemaBinding * that is returned from XsdBinder.bind() method during schema binding resolution * in SchemaBindingResolver.resolve(). In the init(SchemaBinding schema) method an * implementation of this interface can correct/adjust bindings programmatically * if pure XSD with annotations binding approach was not sufficient. * * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public interface SchemaBindingInitializer { /** * Adjust schema binding programatically if needed. * * @param schema just resolved schema binding returned from XsdBinder * @return SchemaBinding instance with complete binding metadata */ SchemaBinding init(SchemaBinding schema); } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/WildcardBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Wild0000755000175000017500000002413111453330564033222 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.ObjectLocalMarshaller; import org.jboss.xb.binding.Util; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 4858 $ */ public class WildcardBinding extends TermBinding { //private static final Logger log = Logger.getLogger(WildcardBinding.class); private static final short PC_LAX = 3; private static final short PC_SKIP = 2; private static final short PC_STRICT = 1; private SchemaBindingResolver schemaResolver; private short pc = PC_STRICT; private ParticleHandler unresolvedElementHandler; private CharactersHandler unresolvedCharactersHandler; private ObjectLocalMarshaller unresolvedMarshaller; public WildcardBinding(SchemaBinding schema) { super(schema); } public SchemaBindingResolver getSchemaResolver() { return schemaResolver; } public void setSchemaResolver(SchemaBindingResolver schemaResolver) { this.schemaResolver = schemaResolver; } public short getProcessContents() { return pc; } public void setProcessContents(short pc) { this.pc = pc; if(pc != PC_LAX && pc != PC_SKIP && pc != PC_STRICT) { throw new JBossXBRuntimeException("Unexpected value for process contents: " + pc); } } public boolean isProcessContentsLax() { return pc == PC_LAX; } public boolean isProcessContentsSkip() { return pc == PC_SKIP; } public boolean isProcessContentsStrict() { return pc == PC_STRICT; } /** * TermBinding.setHandler should be used instead */ @Deprecated public void setWildcardHandler(ParticleHandler wildcardHandler) { this.handler = wildcardHandler; } /** * TermBinding.getHandler should be used instead */ public ParticleHandler getWildcardHandler() { return handler; } public ParticleHandler getUnresolvedElementHandler() { return unresolvedElementHandler; } public void setUnresolvedElementHandler(ParticleHandler unresolvedElementHandler) { this.unresolvedElementHandler = unresolvedElementHandler; } public CharactersHandler getUnresolvedCharactersHandler() { return unresolvedCharactersHandler; } public void setUnresolvedCharactersHandler(CharactersHandler unresolvedCharactersHandler) { this.unresolvedCharactersHandler = unresolvedCharactersHandler; } public ObjectLocalMarshaller getUnresolvedMarshaller() { return unresolvedMarshaller; } public void setUnresolvedMarshaller(ObjectLocalMarshaller marshaller) { this.unresolvedMarshaller = marshaller; } public ElementBinding getElement(QName qName, Attributes attrs) { if(pc == PC_SKIP) { return getUnresolvedElement(qName, false); } ElementBinding element = null; // first, look into the own schema if(schema != null) { element = schema.getElement(qName); } if(element == null) { SchemaBindingResolver resolver = schemaResolver; if(resolver == null && schema != null) { resolver = schema.getSchemaResolver(); } if(resolver != null) { // this is wildcard handling String schemaLocation = attrs == null ? null : Util.getSchemaLocation(attrs, qName.getNamespaceURI()); SchemaBinding schema = resolver.resolve(qName.getNamespaceURI(), qName.getLocalPart(), schemaLocation); if(schema != null) { element = schema.getElement(qName); } } } if(element == null && pc == PC_LAX) { element = getUnresolvedElement(qName, false); } return element; } /** * todo: this method is called for each unresolved element TWICE currently * because getElement() is called TWICE. Look into fixing this! * * @param qName * @return */ private ElementBinding getUnresolvedElement(QName qName, boolean required) { /* if(log.isTraceEnabled()) { log.trace( "getUnresolvedElement for " + qName + ", required=" + required + ", unresolvedElementHandler=" + unresolvedElementHandler ); } */ if(unresolvedElementHandler == null) { if(required) { throw new JBossXBRuntimeException("Schema could not be resolved for wildcard content element " + qName + " and particle handler for unresolved wildcard content elements is not initialized." ); } else { // todo this stuff could be cached ParticleBinding particle = new ParticleBinding(this); SequenceBinding sequence = new SequenceBinding(schema); sequence.addParticle(particle); TypeBinding type = new TypeBinding(); type.setParticle(new ParticleBinding(sequence)); ElementBinding element = new ElementBinding(schema, qName, type); // this is unresolved element we don't care about element.setSkip(true); return element; } } // TODO this stuff could be cached // the 'this' wildcard could be reused // the reason it is overridden is to eliminate its wildcardHandler // which is not initialized in the new one WildcardBinding unresolvedWildcard = new WildcardBinding(schema); unresolvedWildcard.pc = PC_LAX; unresolvedWildcard.schemaResolver = schemaResolver; unresolvedWildcard.unresolvedCharactersHandler = unresolvedCharactersHandler; unresolvedWildcard.unresolvedElementHandler = unresolvedElementHandler; ParticleBinding particle = new ParticleBinding(unresolvedWildcard); SequenceBinding sequence = new SequenceBinding(schema); sequence.addParticle(particle); TypeBinding type = new TypeBinding(); type.setHandler(unresolvedElementHandler); type.setSimpleType(unresolvedCharactersHandler); type.setParticle(new ParticleBinding(sequence, 1, 0, true)); ElementBinding element = new ElementBinding(schema, qName, type); element.setRepeatableHandler(repeatableHandler); return element; } public AbstractPosition newPosition(QName qName, Attributes attrs, ParticleBinding wildcardParticle) { ElementBinding wildcardContent = getElement(qName, attrs); if(wildcardContent != null) { ParticleBinding particle = new ParticleBinding(wildcardContent); AbstractPosition next = wildcardContent.newPosition(qName, attrs, particle); return new WildcardPosition(qName, wildcardParticle, next); } return null; } public boolean isSkip() { return skip != Constants.FALSE; } public boolean isModelGroup() { return false; } public boolean isWildcard() { return true; } public boolean isElement() { return false; } public String toString() { String processContent; switch(pc) { case PC_LAX: processContent = "lax"; break; case PC_SKIP: processContent = "skip"; break; case PC_STRICT: processContent = "strict"; break; default: throw new IllegalStateException("Unexpected processContents value: " + pc); } return "wildcard processContents=" + processContent; } private final class WildcardPosition extends NonElementPosition { protected WildcardPosition(QName name, ParticleBinding particle, AbstractPosition next) { super(name, particle, next); } public AbstractPosition nextPosition(QName name, Attributes atts) { if (particle.isOccurrenceAllowed(occurrence + 1)) { ElementBinding wildcardContent = getElement(name, atts); if (wildcardContent != null) { ParticleBinding wildcardParticle = new ParticleBinding(wildcardContent); next = wildcardContent.newPosition(name, atts, wildcardParticle); next.previous = this; ++occurrence; if(!skip) { o = handler.endParticle(o, qName, particle); if (previous.o != null) setParent(previous, handler); //o = initValue(stack.parent().getValue(), atts); } return this; } } nextNotFound(); return null; } @Override protected AbstractPosition getLastNotSkipped() { return !skip || repeatableParticleValue != null || previous != notSkippedParent ? this : notSkippedParent; } @Override protected void initHandler() { handler = DefaultHandlers.NOOP_PARTICLE_HANDLER; } } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SequenceBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Sequ0000755000175000017500000001254511335111240033231 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Collection; import javax.xml.namespace.QName; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 4033 $ */ public class SequenceBinding extends ModelGroupBinding { private List sequence = Collections.emptyList(); private ElementBinding arrayItem; public SequenceBinding(SchemaBinding schema) { super(schema); } public ElementBinding getArrayItem() { return arrayItem; } public void addParticle(ParticleBinding particle) { switch(sequence.size()) { case 0: sequence = Collections.singletonList(particle); if(particle.isRepeatable() && particle.getTerm().isElement()) { ElementBinding element = (ElementBinding)particle.getTerm(); if(particle.isRepeatable()) { arrayItem = element; } } break; case 1: sequence = new ArrayList(sequence); arrayItem = null; default: sequence.add(particle); } super.addParticle(particle); } public Collection getParticles() { return sequence; } public AbstractPosition newPosition(QName qName, Attributes attrs, ParticleBinding seqParticle) { for(int i = 0; i < sequence.size(); ++i) { ParticleBinding particle = sequence.get(i); AbstractPosition next = particle.getTerm().newPosition(qName, attrs, particle); if(next != null) return new SequencePosition(qName, seqParticle, i, next); if(particle.isRequired()) return null; } return null; } @Override public String getGroupType() { return "sequence"; } private final class SequencePosition extends NonElementPosition { private int pos = -1; protected SequencePosition(QName qName, ParticleBinding particle, int pos, AbstractPosition next) { super(qName, particle, next); this.pos = pos; } public AbstractPosition nextPosition(QName qName, Attributes atts) { if(trace) { StringBuffer sb = new StringBuffer(); sb.append("startElement ").append(qName).append(" in ").append(SequenceBinding.this.toString()); log.trace(sb.toString()); } for(++pos; pos < sequence.size(); ++pos) { ParticleBinding particle = sequence.get(pos); next = particle.getTerm().newPosition(qName, atts, particle); if (next != null) { next.previous = this; return this; } if (particle.isRequired()) { nextNotFound(); return null; } } if(particle.isOccurrenceAllowed(occurrence + 1)) { for(pos = 0; pos < sequence.size(); ++pos) { ParticleBinding item = sequence.get(pos); TermBinding term = item.getTerm(); next = term.newPosition(qName, atts, item); if(next != null) { next.previous = this; ++occurrence; if(!skip) { o = handler.endParticle(o, qName, particle); if (previous.o != null) setParent(previous, handler); initValue(atts); } if(trace) log.trace("found " + qName + " in " + SequenceBinding.this); return this; } if (particle.isRequired()) { nextNotFound(); return null; } } } if(trace) log.trace(qName + " not found in " + SequenceBinding.this); nextNotFound(); return null; } @Override protected void nextNotFound() { super.nextNotFound(); pos = -1; } } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ElementInterceptor.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Elem0000644000175000017500000000334110470642610033176 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public interface ElementInterceptor { Object startElement(Object parent, QName elementName, TypeBinding type); void attributes(Object o, QName elementName, TypeBinding type, Attributes attrs, NamespaceContext nsCtx); void characters(Object o, QName elementName, TypeBinding type, NamespaceContext nsCtx, String text); Object endElement(Object o, QName elementName, TypeBinding type); void add(Object o, Object child, QName qName); } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/TypeBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Type0000644000175000017500000004731511336746232033255 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.xb.binding.metadata.AddMethodMetaData; import org.jboss.xb.binding.metadata.CharactersMetaData; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.MapEntryMetaData; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.Util; import org.jboss.xb.binding.sunday.marshalling.TermBeforeMarshallingCallback; import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller; import org.jboss.xb.binding.sunday.xop.XOPMarshaller; import org.xml.sax.Attributes; import org.xml.sax.helpers.AttributesImpl; /** * @author Alexey Loubyansky * @version $Revision: 4038 $ */ public class TypeBinding { private static final List EMPTY_ICEPTOR_LIST = Collections.emptyList(); protected QName qName; /** Map */ private Map attrs; private AnyAttributeBinding anyAttribute; private ParticleHandler handler;//todo default handler is now in SundayContentHandler. private CharactersHandler charactersHandler; private ClassMetaData classMetaData; private ValueMetaData valueMetaData; private PropertyMetaData propertyMetaData; private MapEntryMetaData mapEntryMetaData; private SchemaBinding schemaBinding; // todo it's optional for now... private TypeBinding baseType; private boolean skip; private CharactersMetaData charMetaData; private AddMethodMetaData addMethodMetaData; private ValueAdapter valueAdapter = ValueAdapter.NOOP; private TermBeforeMarshallingCallback beforeMarshallingCallback; private TermBeforeSetParentCallback beforeSetParentCallback; private int startElementCreatesObject; private int simple; private int ignoreEmptyString; private WildcardBinding wildcard; private ParticleBinding particle; private List patternValues; private List enumValues; private TypeBinding itemType; // the type is a list type with this item type private TypeBinding simpleType; private XOPUnmarshaller xopUnmarshaller; private XOPMarshaller xopMarshaller; /** Map> * these are local element interceptors that are "added" to the interceptor stack * defined in the element binding */ private Map> interceptors; public TypeBinding() { this.qName = null; } public TypeBinding(QName qName) { //this(qName, (CharactersHandler)null); this(qName, DefaultHandlers.CHARACTERS_HANDLER_FACTORY.newCharactersHandler()); } public TypeBinding(CharactersHandler charactersHandler) { this(null, charactersHandler); } public TypeBinding(QName qName, CharactersHandler charactersHandler) { this.qName = qName; this.charactersHandler = charactersHandler; } public TypeBinding(QName qName, TypeBinding baseType) { this(qName, baseType.charactersHandler); if(baseType.particle != null) { // todo this.particle = baseType.particle; } this.attrs = baseType.attrs == null ? null : new HashMap(baseType.attrs); this.classMetaData = baseType.classMetaData; this.valueMetaData = baseType.valueMetaData; this.propertyMetaData = baseType.propertyMetaData; this.mapEntryMetaData = baseType.mapEntryMetaData; this.schemaBinding = baseType.schemaBinding; this.baseType = baseType; if(!baseType.isStartElementCreatesObject()) { this.handler = baseType.handler; } } public QName getQName() { return qName; } public ElementBinding getElement(QName name) { return getElement(name, true); } private ElementBinding getElement(QName name, boolean ignoreWildcards) { ElementBinding element = null; if(particle != null) { ModelGroupBinding modelGroup = (ModelGroupBinding)particle.getTerm(); element = modelGroup.getElement(name, null, ignoreWildcards); } if(element == null && !ignoreWildcards && wildcard != null) { element = wildcard.getElement(name, null); } return element; } public void addParticle(ParticleBinding particle) { ModelGroupBinding modelGroup; if(this.particle == null) { modelGroup = new AllBinding(schemaBinding); this.particle = new ParticleBinding(modelGroup); } else { modelGroup = (ModelGroupBinding)this.particle.getTerm(); } modelGroup.addParticle(particle); } public void addElement(ElementBinding element) { addElement(element, 1, false); } public void addElement(ElementBinding element, int minOccurs, boolean unbounded) { ParticleBinding particle = new ParticleBinding(element); particle.setMinOccurs(minOccurs); particle.setMaxOccursUnbounded(unbounded); addParticle(particle); } public ElementBinding addElement(QName name, TypeBinding type) { return addElement(name, type, 1, false); } public ElementBinding addElement(QName name, TypeBinding type, int minOccurs, boolean unbounded) { ElementBinding el = new ElementBinding(schemaBinding, name, type); addElement(el, minOccurs, unbounded); return el; } public void addGroup(Map group) { for(Iterator> i = group.entrySet().iterator(); i.hasNext();) { Map.Entry entry = i.next(); QName name = entry.getKey(); TypeBinding type = entry.getValue(); addElement(name, type); } } public AttributeBinding getAttribute(QName qName) { return attrs == null ? null : attrs.get(qName); } /** * Go through the type attributes to see if there are any with defaults * that do not appears in the attrs list. * * @param attrs - the attributes seen in the document * @return a possibly augmented list that includes unspecified attributes * with default values. */ public Attributes expandWithDefaultAttributes(Attributes attrs) { if(this.attrs == null) return attrs; // Map HashMap attrsNotSeen = new HashMap(this.attrs); for(int n = 0; n < attrs.getLength(); n ++) { QName name = new QName(attrs.getURI(n), attrs.getLocalName(n)); attrsNotSeen.remove(name); } Attributes expandedAttrs = attrs; if( attrsNotSeen.size() > 0 ) { AttributesImpl tmp = new AttributesImpl(attrs); Iterator> iter = attrsNotSeen.entrySet().iterator(); while( iter.hasNext() ) { Map.Entry entry = (Map.Entry) iter.next(); QName name = entry.getKey(); AttributeBinding binding = entry.getValue(); String constraint = binding.getDefaultConstraint(); if( constraint != null ) { // the Javadoc for Attributes.getType(i) says: // "The attribute type is one of the strings // "CDATA", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", // or "NOTATION" (always in upper case)." tmp.addAttribute(name.getNamespaceURI(), name.getLocalPart(), name.toString(), "CDATA", constraint); } } expandedAttrs = tmp; } return expandedAttrs; } public AttributeBinding addAttribute(QName name, TypeBinding type, AttributeHandler handler) { AttributeBinding attr = new AttributeBinding(schemaBinding, name, type, handler); addAttribute(attr); return attr; } public void addAttribute(AttributeBinding attr) { if(attrs == null) { attrs = Collections.singletonMap(attr.getQName(), attr); return; } if(attrs.size() == 1) attrs = new HashMap(attrs); attrs.put(attr.getQName(), attr); } public Collection getAttributes() { return attrs == null ? Collections.emptyList() : attrs.values(); } public CharactersHandler getCharactersHandler() { return charactersHandler; } public void setCharactersHandler(CharactersHandler charactersHandler) { this.charactersHandler = charactersHandler; } /** * This method will create a new simple type binding with the passed in characters handler * and set this simple type as the simple type of the complex type the method was invoked on. * @param charactersHandler */ public void setSimpleType(CharactersHandler charactersHandler) { setSimpleType(new TypeBinding(charactersHandler)); } public TypeBinding getSimpleType() { return simpleType; } public void setSimpleType(TypeBinding simpleType) { this.simpleType = simpleType; } public void setHandler(ParticleHandler handler) { this.handler = handler; } public ParticleHandler getHandler() { return handler; } /** * Pushes a new interceptor for the specified element. * If the element has a global scope in the schema, * this interceptor will invoked only when the element is found to be a child * of this type. This is the difference between the local interceptors * added with this method and the interceptors added directly to the * element binding. * When element is started, local interceptors are invoked before the interceptors * from the element binding. In the endElement the order is reversed. * * @param qName * @param interceptor */ public void pushInterceptor(QName qName, ElementInterceptor interceptor) { ElementBinding el = getElement(qName); if(el == null) el = addElement(qName, new TypeBinding()); if(interceptors == null) { interceptors = Collections.singletonMap(qName, Collections.singletonList(interceptor)); return; } List intList = (List) interceptors.get(qName); if(intList == null) { intList = Collections.singletonList(interceptor); if(interceptors.size() == 1) interceptors = new HashMap>(interceptors); interceptors.put(qName, intList); } else { if(intList.size() == 1) { intList = new ArrayList(intList); interceptors.put(qName, intList); } intList.add(interceptor); } } /** * Returns a list of local interceptors for the element. * If there are no local interceptors for the element then * an empty list is returned. * * @param qName * @return */ public List getInterceptors(QName qName) { if(interceptors == null) return EMPTY_ICEPTOR_LIST; List list = interceptors.get(qName); return list == null ? EMPTY_ICEPTOR_LIST : list; } public TypeBinding getBaseType() { return baseType; } public void setBaseType(TypeBinding baseType) { this.baseType = baseType; } public boolean isSimple() { // actually, a type can be complex when the particle is null and // there are no attributes. But the XsdBinder will set the value of simple // to false. This check is for schema bindings created programmatically return simple == Constants.NOT_SET ? particle == null && attrs == null : simple == Constants.TRUE; } public void setSimple(boolean simple) { this.simple = simple ? Constants.TRUE : Constants.FALSE; } public boolean isTextContentAllowed() { return simpleType != null || isSimple(); } public ClassMetaData getClassMetaData() { return classMetaData; } public void setClassMetaData(ClassMetaData classMetaData) { this.classMetaData = classMetaData; } public SchemaBinding getSchemaBinding() { return schemaBinding; } public void setSchemaBinding(SchemaBinding schemaBinding) { this.schemaBinding = schemaBinding; } public void setValueMetaData(ValueMetaData valueMetaData) { this.valueMetaData = valueMetaData; } public ValueMetaData getValueMetaData() { return valueMetaData; } public PropertyMetaData getPropertyMetaData() { return propertyMetaData; } public void setPropertyMetaData(PropertyMetaData propertyMetaData) { this.propertyMetaData = propertyMetaData; } public MapEntryMetaData getMapEntryMetaData() { return mapEntryMetaData; } public void setMapEntryMetaData(MapEntryMetaData mapEntryMetaData) { this.mapEntryMetaData = mapEntryMetaData; } public void setSkip(boolean skip) { this.skip = skip; } public boolean isSkip() { return skip; } public CharactersMetaData getCharactersMetaData() { return charMetaData; } public void setCharactersMetaData(CharactersMetaData charMetaData) { this.charMetaData = charMetaData; } public void setAddMethodMetaData(AddMethodMetaData addMethodMetaData) { this.addMethodMetaData = addMethodMetaData; } public AddMethodMetaData getAddMethodMetaData() { return addMethodMetaData; } public ValueAdapter getValueAdapter() { return valueAdapter; } public void setValueAdapter(ValueAdapter valueAdapter) { this.valueAdapter = valueAdapter; } /** * Whether the ParticleHandler should return a non-null object from its * startParticle method. * This should be true for any type that has child elements and/or attributes, * i.e. complex types. If the type is simple or it's a complex type that should * be treated as a simple type then this value should be false. * * @return */ public boolean isStartElementCreatesObject() { return startElementCreatesObject == Constants.NOT_SET ? particle != null || attrs != null : startElementCreatesObject == Constants.TRUE; } /** * Whether the ParticleHandler should return a non-null object from its * startParticle method. * This should be true for any type that has child elements and/or attributes, * i.e. complex types. If the type is simple or it's a complex type that should * be treated as a simple type then this value should be false. * * @param startElementCreatesObject */ public void setStartElementCreatesObject(boolean startElementCreatesObject) { this.startElementCreatesObject = startElementCreatesObject ? Constants.TRUE : Constants.FALSE; } private boolean initializedWildcard; public WildcardBinding getWildcard() { if(initializedWildcard) return wildcard; if(particle != null) { wildcard = Util.getWildcard(particle.getTerm()); initializedWildcard = true; } return wildcard; } public ParticleBinding getParticle() { return particle; } public void setParticle(ParticleBinding particle) { this.particle = particle; } public List getLexicalPattern() { return patternValues; } public void addLexicalPattern(String patternValue) { if(patternValues == null) { patternValues = Collections.singletonList(patternValue); } else { if(patternValues.size() == 1) { patternValues = new ArrayList(patternValues); } patternValues.add(patternValue); } } public List getLexicalEnumeration() { return enumValues; } public void addEnumValue(String value) { if(enumValues == null) { enumValues = Collections.singletonList(value); } else { if(enumValues.size() == 1) { enumValues = new ArrayList(enumValues); } enumValues.add(value); } } public void setItemType(TypeBinding itemType) { this.itemType = itemType; } public TypeBinding getItemType() { return itemType; } public XOPUnmarshaller getXopUnmarshaller() { return xopUnmarshaller == null ? (schemaBinding == null ? null : schemaBinding.getXopUnmarshaller()) : xopUnmarshaller; } public void setXopUnmarshaller(XOPUnmarshaller xopUnmarshaller) { this.xopUnmarshaller = xopUnmarshaller; } public XOPMarshaller getXopMarshaller() { return xopMarshaller == null ? (schemaBinding == null ? null : schemaBinding.getXopMarshaller()) : xopMarshaller; } public void setXopMarshaller(XOPMarshaller xopMarshaller) { this.xopMarshaller = xopMarshaller; } public boolean hasOnlyXmlMimeAttributes() { if(attrs == null) return false; Iterator iter = attrs.keySet().iterator(); while(iter.hasNext()) { QName qName = iter.next(); if(!Constants.NS_XML_MIME.equals(qName.getNamespaceURI())) return false; } return true; } public void setBeforeMarshallingCallback(TermBeforeMarshallingCallback marshallingHandler) { this.beforeMarshallingCallback = marshallingHandler; } public TermBeforeMarshallingCallback getBeforeMarshallingCallback() { return beforeMarshallingCallback; } public void setBeforeSetParentCallback(TermBeforeSetParentCallback beforeSetParent) { this.beforeSetParentCallback = beforeSetParent; } public TermBeforeSetParentCallback getBeforeSetParentCallback() { return beforeSetParentCallback; } public boolean isIgnoreEmptyString() { return ignoreEmptyString == Constants.NOT_SET ? !isSimple() : ignoreEmptyString == Constants.TRUE; } public void setIgnoreEmptyString(boolean value) { this.ignoreEmptyString = value ? Constants.TRUE : Constants.FALSE; } public AnyAttributeBinding getAnyAttribute() { return anyAttribute; } public void setAnyAttribute(AnyAttributeBinding anyAttribute) { this.anyAttribute = anyAttribute; } public String toString() { return super.toString() + "[" + qName + "]"; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/PositionStack.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Posi0000644000175000017500000000273611312663424033237 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import org.jboss.xb.binding.NamespaceRegistry; import org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.UnmarshallingContextImpl; /** * @author Alexey Loubyansky * @version $Revision: 3823 $ */ public interface PositionStack { NamespaceRegistry getNamespaceRegistry(); UnmarshallingContextImpl getContext(); }././@LongLink0000000000000000000000000000020200000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/XsdBinderLoggingErrorHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/XsdB0000644000175000017500000000333210470642610033154 0ustar twernertwerner/** * */ package org.jboss.xb.binding.sunday.unmarshalling; import org.w3c.dom.DOMError; import org.w3c.dom.DOMErrorHandler; import org.w3c.dom.DOMLocator; public class XsdBinderLoggingErrorHandler implements DOMErrorHandler { private static XsdBinderLoggingErrorHandler errorHandler; // Hide constructor private XsdBinderLoggingErrorHandler() { } public static XsdBinderLoggingErrorHandler newInstance() { if (errorHandler == null) { errorHandler = new XsdBinderLoggingErrorHandler(); } return errorHandler; } public boolean handleError(DOMError error) { // todo: i do throw exceptions here instead of returning false to stop parsing immediately // since returning false seems to be no different from true (a bug in the parser?) // Although, throwing an exception reports the same error twice but the second time with // location -1:-1 switch (error.getSeverity()) { case DOMError.SEVERITY_ERROR: XsdBinder.log.error(formatMessage(error)); case DOMError.SEVERITY_FATAL_ERROR: XsdBinder.log.fatal(formatMessage(error)); case DOMError.SEVERITY_WARNING: XsdBinder.log.warn(formatMessage(error)); break; } return false; } String formatMessage(DOMError error) { StringBuffer buf = new StringBuffer(); DOMLocator location = error.getLocation(); if (location != null) { buf.append(location.getLineNumber()).append(':').append(location.getColumnNumber()); } else { buf.append("[location unavailable]"); } buf.append(' ').append(error.getMessage()); return buf.toString(); } }././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ElementHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Elem0000644000175000017500000000347010470642610033201 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public interface ElementHandler { Object startElement(Object parent, QName elementName, ElementBinding element); void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx); Object endElement(Object o, QName elementName, ElementBinding element); /** * WARN: currently, this method is called only if there are no interceptors in the element binding. */ void setParent(Object parent, Object o, QName qName, ElementBinding element, ElementBinding parentElement); } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/DefaultHandlers.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Defa0000644000175000017500000001113011330537706033153 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler.UnmarshalCharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtAttributeHandler; import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtCharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler; import org.jboss.xb.binding.sunday.xop.XOPElementHandler; import org.xml.sax.Attributes; /** * The DefaultHandlers. * * @FIXME This just exposes the default handlers because * they are hardwired to the RtHandlers without being * overridable. * @author Adrian Brock * @version $Revision: 3960 $ */ public class DefaultHandlers { public static ParticleHandler ELEMENT_HANDLER = RtElementHandler.INSTANCE; public static ParticleHandler MODEL_GROUP_HANDLER = RtElementHandler.INSTANCE; public static ParticleHandler SIMPLE_HANDLER = new RtElementHandler() { @Override public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { return null; } }; public static AttributeHandler ATTRIBUTE_HANDLER = RtAttributeHandler.INSTANCE; public static CharactersHandlerFactory CHARACTERS_HANDLER_FACTORY = new CharactersHandlerFactory() { public CharactersHandler newCharactersHandler() { return RtCharactersHandler.INSTANCE; } public CharactersHandler newCharactersHandler(UnmarshalCharactersHandler unmarshalHandler) { return new RtCharactersHandler(unmarshalHandler); } }; public static ParticleHandler XOP_HANDLER = new XOPElementHandler(); public static ParticleHandler UOE_PARTICLE_HANDLER = new ParticleHandler() { public Object endParticle(Object o, QName elementName, ParticleBinding particle) { throw new UnsupportedOperationException(); } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { throw new UnsupportedOperationException(); } public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { throw new UnsupportedOperationException(); } }; public static ParticleHandler NOOP_PARTICLE_HANDLER = new ParticleHandler() { public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return o; } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { } public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { return parent; } }; public static RepeatableParticleHandler REPEATABLE_HANDLER = new RepeatableParticleHandler() { public Object startRepeatableParticle(Object parent, QName startName, ParticleBinding particle) { return null; } public void endRepeatableParticle(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { } public void addTermValue(Object particleValue, Object termValue, QName elementName, ParticleBinding particle, ParticleBinding parentParticle, ParticleHandler handler) { } }; } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SchemaResolverConfig.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Sche0000644000175000017500000002051711502160776033207 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.Iterator; import java.util.Map; import java.util.Properties; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.xb.binding.resolver.MutableSchemaResolverWithQNameMapping; /** * SchemaResolverConfig. * * @author Adrian Brock * @author Scott.Stark@jboss.org * @version $Revision: 4882 $ */ public class SchemaResolverConfig implements SchemaResolverConfigMBean { /** The log */ private static final Logger log = Logger.getLogger(SchemaResolverConfig.class); /** The singleton schema resolver */ protected static MutableSchemaResolverWithQNameMapping resolver = (MutableSchemaResolverWithQNameMapping) SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver(); /** The initializers by namespace */ protected Properties schemaInitializers; /** The initializer instances by namespace */ protected Map schemaInitializerInstances; /** The locations by namespace */ protected Properties schemaLocations; /** The parse annotations by namespace */ protected Properties parseAnnotations; /** The binding classes by namespace */ protected Properties bindingClasses; /** The binding classes by schemaLocation */ protected Properties bindingClassesByLocation; public boolean getCacheResolvedSchemas() { return resolver.isCacheResolvedSchemas(); } public void setCacheResolvedSchemas(boolean flag) { resolver.setCacheResolvedSchemas(flag); } public Properties getSchemaInitializers() { return schemaInitializers; } public void setSchemaInitializers(Properties schemaInitializers) { this.schemaInitializers = schemaInitializers; if (schemaInitializers != null && schemaInitializers.size() != 0) { for (Iterator i = schemaInitializers.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); String namespace = (String) entry.getKey(); String initializer = (String) entry.getValue(); try { resolver.mapSchemaInitializer(namespace, initializer); } catch (Exception ignored) { log.debug("Ignored: ", ignored); } } } } public Map getSchemaInitializerInstances() { return this.schemaInitializerInstances; } public void setSchemaInitializerInstances(Map schemaInitializers) { this.schemaInitializerInstances = schemaInitializers; if (schemaInitializers != null && schemaInitializers.size() != 0) { for (Iterator> i = schemaInitializers.entrySet().iterator(); i.hasNext();) { Map.Entry entry = i.next(); String namespace = entry.getKey(); SchemaBindingInitializer initializer = entry.getValue(); try { resolver.mapSchemaInitializer(namespace, initializer); } catch (Exception ignored) { log.debug("Ignored: ", ignored); } } } } public Properties getSchemaLocations() { return schemaLocations; } public void setSchemaLocations(Properties schemaLocations) { this.schemaLocations = schemaLocations; if (schemaLocations != null && schemaLocations.size() != 0) { for (Iterator i = schemaLocations.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); String namespace = (String) entry.getKey(); String location = (String) entry.getValue(); resolver.mapSchemaLocation(namespace, location); } } } public Properties getParseAnnotations() { return parseAnnotations; } public void setParseAnnotations(Properties parseAnnotations) { this.parseAnnotations = parseAnnotations; if (parseAnnotations != null && parseAnnotations.size() != 0) { for (Iterator i = parseAnnotations.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); String namespace = (String) entry.getKey(); String value = (String) entry.getValue(); Boolean booleanValue = Boolean.valueOf(value); if(booleanValue != null) resolver.setParseXSDAnnotations(namespace, booleanValue); } } } public Properties getBindingClassesByLocations() { return bindingClassesByLocation; } public void setBindingClassesByLocations(Properties bindingClassesByLocation) { this.bindingClassesByLocation = bindingClassesByLocation; if (bindingClassesByLocation != null && bindingClassesByLocation.size() != 0) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); for (Iterator i = bindingClassesByLocation.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); String schemaLocation = (String) entry.getKey(); String value = (String) entry.getValue(); try { Class clazz = loader.loadClass(value); resolver.mapLocationToClass(schemaLocation, clazz); } catch(ClassNotFoundException e) { log.warn("Failed to load class: "+value, e); } } } } public Properties getBindingClasses() { return bindingClasses; } public void setBindingClasses(Properties bindingClasses) { this.bindingClasses = bindingClasses; if (bindingClasses != null && bindingClasses.size() != 0) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); for (Iterator i = bindingClasses.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry) i.next(); String namespace = (String) entry.getKey(); String value = (String) entry.getValue(); try { Class clazz = loader.loadClass(value); resolver.mapURIToClass(namespace, clazz); } catch(ClassNotFoundException e) { log.warn("Failed to load class: "+value, e); } } } } public void setBindingClassesByElementNames(Map bindingClassesByElementName) { if (bindingClassesByElementName != null && bindingClassesByElementName.size() != 0) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); for (Iterator> i = bindingClassesByElementName.entrySet().iterator(); i.hasNext();) { Map.Entry entry = i.next(); try { Class clazz = loader.loadClass(entry.getValue()); resolver.mapQNameToClasses(entry.getKey(), clazz); } catch(ClassNotFoundException e) { log.warn("Failed to load class: " + entry.getValue(), e); } } } } } ././@LongLink0000000000000000000000000000021100000000000011557 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/CollectionRepeatableParticleHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Coll0000644000175000017500000000651311336746232033220 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.Collection; import javax.xml.namespace.QName; import org.jboss.reflect.spi.ClassInfo; import org.jboss.reflect.spi.TypeInfo; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.builder.runtime.AbstractPropertyHandler; import org.jboss.xb.util.CollectionFactory; /** * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class CollectionRepeatableParticleHandler implements RepeatableParticleHandler { private AbstractPropertyHandler propertyHandler; private CollectionFactory colFactory; private ValueAdapter valueAdapter; private TypeInfo componentType; public CollectionRepeatableParticleHandler(AbstractPropertyHandler propertyHandler, ClassInfo collectionType, ValueAdapter valueAdapter) { if(propertyHandler == null) throw new IllegalArgumentException("Null property handler."); colFactory = CollectionFactory.getFactory(collectionType); componentType = ((ClassInfo) collectionType).getComponentType(); this.valueAdapter = valueAdapter; this.propertyHandler = propertyHandler; } public Object startRepeatableParticle(Object parent, QName startName, ParticleBinding particle) { try { return colFactory.createCollection(); } catch (Throwable e) { throw new JBossXBRuntimeException("Failed to create collection for " + startName, e); } } public void endRepeatableParticle(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { if(o == null) return; if(valueAdapter != null) o = valueAdapter.cast(o, null); propertyHandler.doHandle(parent, o, elementName); } public void addTermValue(Object particleValue, Object termValue, QName elementName, ParticleBinding particle, ParticleBinding parentParticle, ParticleHandler handler) { if (componentType != null && termValue != null) { if(!componentType.isInstance(termValue)) throw new IllegalArgumentException("Child is not an instance of " + componentType + ", child: " + termValue); } ((Collection)particleValue).add(termValue); } }././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AnyAttributeBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AnyA0000755000175000017500000000607211075435045033157 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.sunday.marshalling.AttributeMarshaller; import org.jboss.xb.binding.sunday.marshalling.DefaultAttributeMarshaller; /** * A AnyAttributeBinding. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class AnyAttributeBinding { private final SchemaBinding schema; private AnyAttributeHandler handler; private AttributeMarshaller marshaller = DefaultAttributeMarshaller.INSTANCE; private PropertyMetaData propertyMetaData; private ValueAdapter valueAdapter; protected Boolean normalizeSpace; public AnyAttributeBinding(SchemaBinding schema, AnyAttributeHandler handler) { super(); this.schema = schema; this.handler = handler; } public AnyAttributeHandler getHandler() { return handler; } public void setHandler(AnyAttributeHandler handler) { this.handler = handler; } public AttributeMarshaller getMarshaller() { return marshaller; } public void setMarshaller(AttributeMarshaller marshaller) { this.marshaller = marshaller; } public PropertyMetaData getPropertyMetaData() { return propertyMetaData; } public void setPropertyMetaData(PropertyMetaData propertyMetaData) { this.propertyMetaData = propertyMetaData; } public ValueAdapter getValueAdapter() { return valueAdapter; } public void setValueAdapter(ValueAdapter valueAdapter) { this.valueAdapter = valueAdapter; } public boolean isNormalizeSpace() { if(normalizeSpace != null) return normalizeSpace.booleanValue(); return schema == null ? true : schema.isNormalizeSpace(); } public void setNormalizeSpace(Boolean normalizeSpace) { this.normalizeSpace = normalizeSpace; } public SchemaBinding getSchema() { return schema; } } ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/NonElementPosition.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/NonE0000644000175000017500000000730711335111240033150 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; import org.jboss.xb.binding.JBossXBRuntimeException; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public abstract class NonElementPosition extends AbstractPosition { protected NonElementPosition(QName name, ParticleBinding particle, AbstractPosition next) { super(name, particle); this.next = next; next.previous = this; } public boolean isElement() { return false; } public void characters(char[] ch, int start, int length) { } public void endParticle() { if(ended) throw new JBossXBRuntimeException("The position has already been ended!"); if(!skip) { o = handler.endParticle(o, qName, particle); ended = true; if (previous.o != null) setParent(previous, handler); } if(repeatableParticleValue != null) endRepeatableParticle(); } public void repeatForChild(Attributes atts) { if(ended) throw new JBossXBRuntimeException("The position has already been ended!"); if (!skip) { o = handler.endParticle(o, qName, particle); // model group should always have parent particle AbstractPosition parentPosition = notSkippedParent; if (parentPosition.o != null) setParent(parentPosition, handler); } // if it is repeatable then this is the repeatable parent if(!particle.isRepeatable()) previous.repeatForChild(atts); initValue(atts); } public ElementPosition startParticle(QName startName, Attributes atts) { if (nextPosition(startName, atts) == null) return null; // push all except the last one AbstractPosition nextPosition = next; while (nextPosition.next != null) { nextPosition.notSkippedParent = nextPosition.previous.getLastNotSkipped(); if (nextPosition.repeatableHandler != null) nextPosition.startRepeatableParticle(); nextPosition.stack = stack; nextPosition.initValue(atts); nextPosition.parentType = parentType; nextPosition = nextPosition.next; } nextPosition.stack = stack; nextPosition.parentType = parentType; nextPosition.notSkippedParent = nextPosition.previous.getLastNotSkipped(); return (ElementPosition) nextPosition; } protected void nextNotFound() { endParticle(); next = null; occurrence = 0; } }././@LongLink0000000000000000000000000000017400000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/DefaultWildcardHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Defa0000644000175000017500000000532111303766341033157 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.xb.binding.group.ValueList; import org.xml.sax.Attributes; /** * DefaultWildcardHandler. * * @author Adrian Brock * @version $Revision: 3807 $ */ public class DefaultWildcardHandler implements ParticleHandler { /** The log */ private static final Logger log = Logger.getLogger(DefaultWildcardHandler.class); public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { return parent; } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return o; } public void setParent(Object parent, Object o, QName elementName, ElementBinding element, ElementBinding parentElement) { if (log.isTraceEnabled()) log.trace("Not setting " + o + " on " + parent + " for " + elementName); } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { if(parent instanceof ValueList) { ValueList valueList = (ValueList)parent; valueList.getInitializer().addTermValue(elementName, particle, this, valueList, o, parentParticle); return; } ElementBinding element = particle.getTerm().isElement() ? (ElementBinding) particle.getTerm() : null; ElementBinding parentElement = parentParticle.getTerm().isElement() ? (ElementBinding) parentParticle.getTerm() : null; setParent(parent, o, elementName, element, parentElement); } } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/UnorderedSequenceBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Unor0000644000175000017500000001413011335111240033224 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.xb.binding.JBossXBRuntimeException; import org.xml.sax.Attributes; /** * A UnorderedSequenceBinding. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class UnorderedSequenceBinding extends ModelGroupBinding { private Map elementParticles = Collections.emptyMap(); private List groupParticles = Collections.emptyList(); private List wildcardParticles = Collections.emptyList(); private ElementBinding arrayItem; private List allParticles = null; public UnorderedSequenceBinding(SchemaBinding schema) { super(schema); } @Override public ElementBinding getArrayItem() { return arrayItem; } @Override public void addParticle(ParticleBinding particle) { TermBinding term = particle.getTerm(); if(term.isElement()) { if(elementParticles.isEmpty()) elementParticles = new HashMap(); elementParticles.put(((ElementBinding)term).getQName(), particle); } else if(term.isModelGroup()) { if(groupParticles.isEmpty()) groupParticles = new ArrayList(); groupParticles.add(particle); } else if(term.isWildcard()) { if(wildcardParticles.isEmpty()) wildcardParticles = new ArrayList(); wildcardParticles.add(particle); } else throw new JBossXBRuntimeException("Unexpected term type: " + term); super.addParticle(particle); allParticles = null; } @Override public Collection getParticles() { if(allParticles == null) { allParticles = new ArrayList(elementParticles.size() + groupParticles.size() + wildcardParticles.size()); allParticles.addAll(elementParticles.values()); allParticles.addAll(groupParticles); allParticles.addAll(wildcardParticles); } return allParticles; } public AbstractPosition newPosition(QName qName, Attributes attrs, ParticleBinding seqParticle) { ParticleBinding currentParticle = elementParticles.get(qName); if (currentParticle != null) return new UnorderedSequencePosition(qName, seqParticle, currentParticle.getTerm().newPosition(qName, attrs, currentParticle)); for (ParticleBinding particle : groupParticles) { AbstractPosition next = particle.getTerm().newPosition(qName, attrs, particle); if (next != null) return new UnorderedSequencePosition(qName, seqParticle, next); } for (ParticleBinding particle : wildcardParticles) { AbstractPosition next = particle.getTerm().newPosition(qName, attrs, particle); if (next != null) return new UnorderedSequencePosition(qName, seqParticle, next); } return null; } @Override public String getGroupType() { return "unordered_sequence"; } private final class UnorderedSequencePosition extends NonElementPosition { private UnorderedSequencePosition(QName name, ParticleBinding particle, AbstractPosition next) { super(name, particle, next); } public AbstractPosition nextPosition(QName qName, Attributes atts) { if(trace) { StringBuffer sb = new StringBuffer(); sb.append("startElement ").append(qName).append(" in ").append(UnorderedSequenceBinding.this.toString()); log.trace(sb.toString()); } ParticleBinding element = elementParticles.get(qName); if (element != null) { next = element.getTerm().newPosition(qName, atts, element); next.previous = this; // TODO occurrence here is not used ++occurrence; if (trace) log.trace("found " + qName + " in " + UnorderedSequenceBinding.this); return this; } for (ParticleBinding particle : groupParticles) { next = particle.getTerm().newPosition(qName, atts, particle); if (next != null) { //++occurrence; next.previous = this; return this; } } for (ParticleBinding particle : wildcardParticles) { next = particle.getTerm().newPosition(qName, atts, particle); if (next != null) { //++occurrence; next.previous = this; return this; } } nextNotFound(); return null; } } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ValueAdapter.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Valu0000755000175000017500000000316011061473704033230 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; /** * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public interface ValueAdapter { ValueAdapter NOOP = new ValueAdapter() { public Object cast(Object o, Class c) { return o; } }; /** * An implementation should make sure that an object past in as the first parameter * can be set as a value of a field that is of a type passed in as the second parameter * * @param o * @param c * @return */ Object cast(Object o, Class c); } ././@LongLink0000000000000000000000000000020400000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SingletonSchemaResolverFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Sing0000644000175000017500000001610211154172516033216 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import org.jboss.logging.Logger; import org.jboss.xb.binding.resolver.MultiClassSchemaResolver; import org.jboss.xb.binding.resolver.MutableSchemaResolver; /** * SingletonSchemaResolverFactory. * * @author Ales Justin * @author Adrian Brock * @version $Revision: 3021 $ */ public class SingletonSchemaResolverFactory implements SchemaResolverFactory { /** The log */ private static final Logger log = Logger.getLogger(SingletonSchemaResolverFactory.class); /** The factory instance */ private static final SingletonSchemaResolverFactory singleton = new SingletonSchemaResolverFactory(); /** The resolver */ private final MutableSchemaResolver resolver = new MultiClassSchemaResolver(); /** * Get the factory instance * * @return the instance */ public static SingletonSchemaResolverFactory getInstance() { return singleton; } /** * Create a new SingletonSchemaResolverFactory. */ private SingletonSchemaResolverFactory() { // old initializer //addSchema("urn:jboss:aop-beans:1.0", "org.jboss.aop.microcontainer.beans.xml.AOPBeansSchemaInitializer", Boolean.FALSE); addSchema("urn:jboss:spring-beans:2.0", "org.jboss.spring.deployment.xml.SpringSchemaInitializer", Boolean.FALSE); addSchema("urn:jboss:osgi-beans:1.0", "org.jboss.osgi.deployment.xml.OSGiSchemaInitializer", Boolean.FALSE); addSchema("urn:jboss:seam-components:1.0", "org.jboss.seam.ioc.microcontainer.xml.SeamSchemaInitializer", Boolean.FALSE); // new jaxb addJaxbSchema("urn:jboss:aop-beans:1.0", "org.jboss.aop.microcontainer.beans.metadata.AOPDeployment"); addJaxbSchema("urn:jboss:bean-deployer", "org.jboss.kernel.plugins.deployment.AbstractKernelDeployment10"); addJaxbSchema("urn:jboss:bean-deployer:2.0", "org.jboss.kernel.plugins.deployment.AbstractKernelDeployment"); addJaxbSchema("urn:jboss:javabean:1.0", "org.jboss.javabean.plugins.jaxb.JavaBean10"); addJaxbSchema("urn:jboss:javabean:2.0", "org.jboss.javabean.plugins.jaxb.JavaBean20"); addJaxbSchema("urn:jboss:policy:1.0", "org.jboss.beans.metadata.plugins.policy.AbstractPolicyMetaData"); addJaxbSchema("urn:jboss:classloading:1.0", "org.jboss.classloading.spi.metadata.ClassLoadingMetaData10"); addJaxbSchema("urn:jboss:classloader:1.0", "org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory10"); addJaxbSchema("urn:jboss:deployers:2.0", "org.jboss.deployers.vfs.plugins.xb.SchemaResolverDeployerMetaData"); } public MutableSchemaResolver getSchemaBindingResolver() { return resolver; } /** * Add a schema * * @param namespace the namespace * @param initializer the initializer * @return true when added */ protected boolean addSchema(String namespace, String initializer) { try { resolver.mapSchemaInitializer(namespace, initializer); if (log.isTraceEnabled()) log.trace("Mapped initializer '" + namespace + "' to '" + initializer + "'"); return true; } catch (Exception ignored) { if (log.isTraceEnabled()) log.trace("Ignored: ", ignored); return false; } } /** * Add a schema * * @param namespace the namespace * @param initializer the initializer * @param parseAnnotations whether to parse annotations * @return true when added */ protected boolean addSchema(String namespace, String initializer, Boolean parseAnnotations) { if (addSchema(namespace, initializer) == false) return false; setParseAnnotations(namespace, parseAnnotations); return true; } /** * Add a schema * * @param namespace the namespace * @param initializer the initializer * @param location the location * @return true when added */ protected boolean addSchema(String namespace, String initializer, String location) { if (addSchema(namespace, initializer) == false) return false; try { resolver.mapSchemaLocation(namespace, location); if (log.isTraceEnabled()) log.trace("Mapped location '" + namespace + "' to '" + location + "'"); return true; } catch (Exception ignored) { if (log.isTraceEnabled()) log.trace("Ignored: ", ignored); return false; } } /** * Add a schema * * @param namespace the namespace * @param initializer the initializer * @param location the location * @param parseAnnotations whether to parse annotations * @return true when added */ protected boolean addSchema(String namespace, String initializer, String location, Boolean parseAnnotations) { if (addSchema(namespace, initializer, location) == false) return false; setParseAnnotations(namespace, parseAnnotations); return true; } /** * Set the parse annotations for a schema * * @param namespace the namespace * @param parseAnnotations whether to parse annotations */ protected void setParseAnnotations(String namespace, Boolean parseAnnotations) { if(parseAnnotations != null) resolver.setParseXSDAnnotations(namespace, parseAnnotations); else resolver.unsetParseXSDAnnotations(namespace); if (log.isTraceEnabled()) log.trace("Parse annotations '" + namespace + "' set to '" + parseAnnotations + "'"); } /** * Add a schema. * * @param namespace the namespace * @param reference the schema reference class * @return true when added */ public boolean addJaxbSchema(String namespace, String reference) { try { resolver.mapURIToClass(namespace, reference); if (log.isTraceEnabled()) log.trace("Mapped '" + namespace + "' to '" + reference + "'"); return true; } catch (Exception ignored) { if (log.isTraceEnabled()) log.trace("Ignored: ", ignored); return false; } } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SimpleTypeBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Simp0000644000175000017500000000567611326305334033241 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; import org.jboss.xb.binding.JBossXBRuntimeException; /** * @author Alexey Loubyansky * @version $Revision: 3947 $ */ public class SimpleTypeBinding extends TypeBinding { public SimpleTypeBinding() { setDefaultHandler(); } public SimpleTypeBinding(QName qName) { super(qName, DefaultHandlers.CHARACTERS_HANDLER_FACTORY.newCharactersHandler()); setDefaultHandler(); } public SimpleTypeBinding(QName qName, ValueAdapter valueAdapter) { this(qName, DefaultHandlers.CHARACTERS_HANDLER_FACTORY.newCharactersHandler(), valueAdapter); } public SimpleTypeBinding(QName qName, CharactersHandler handler, ValueAdapter valueAdapter) { super(qName, handler); setDefaultHandler(); setValueAdapter(valueAdapter); } public SimpleTypeBinding(QName qName, CharactersHandler.UnmarshalCharactersHandler unmarshalHandler, ValueAdapter valueAdapter) { this(qName, DefaultHandlers.CHARACTERS_HANDLER_FACTORY.newCharactersHandler(unmarshalHandler), valueAdapter); } public SimpleTypeBinding(QName qName, CharactersHandler simple) { super(qName, simple); setDefaultHandler(); } public SimpleTypeBinding(QName qName, CharactersHandler.UnmarshalCharactersHandler unmarshalHandler) { this(qName, DefaultHandlers.CHARACTERS_HANDLER_FACTORY.newCharactersHandler(unmarshalHandler)); } private void setDefaultHandler() { setHandler(DefaultHandlers.SIMPLE_HANDLER); } public AttributeBinding addAttribute(QName name, TypeBinding type, AttributeHandler handler) { throw new JBossXBRuntimeException("Simple types can't have attributes."); } public void addElement(QName qName, ElementBinding binding) { throw new JBossXBRuntimeException("Simple types can't have child elements."); } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/DefaultSchemaResolver.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Defa0000644000175000017500000002027111477442270033164 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.util.xml.JBossEntityResolver; import org.jboss.xb.binding.resolver.AbstractMutableSchemaResolver; /** * A default SchemaBindingResolver that uses a JBossEntityResolver to locate * the schema xsd. * * @author Scott.Stark@jboss.org * @version $Revision: 4875 $ */ public class DefaultSchemaResolver extends AbstractMutableSchemaResolver { private static Logger log = Logger.getLogger(DefaultSchemaResolver.class); /** Namespace to JBossXBBuilder binding class */ private Map> uriToClass = new HashMap>(); /** SchemaLocation to JBossXBBuilder binding class */ private Map> schemaLocationToClass = new HashMap>(); /** element name to class mapping */ private Map> qNameToClass; public DefaultSchemaResolver() { super(log); } public DefaultSchemaResolver(JBossEntityResolver resolver) { super(log, resolver); } /** * Registers a location for the namespace URI.

    * This method delegates to mapSchemaLocation(nsUri, location). * * This location is looked using the JBossEntityResolver, i.e. it is a classpath location * * @param nsUri the namespace location * @param location the classpath location */ public void addSchemaLocation(String nsUri, String location) { super.mapSchemaLocation(nsUri, location); } /** * Whether to parse annotations for this namespace. * This method delegates to parseXSDAnnotations(nsUri, value). * * @param nsUri the namespace * @param value the value of the option */ public void addSchemaParseAnnotations(String nsUri, Boolean value) { super.setParseXSDAnnotations(nsUri, value); } /** * Removes the parse annotation configuration for this namespace. * This method delegates to unsetParseXSDAnnotations(nsURI). * * @param nsUri the namespace * @return the previous value */ public Boolean removeSchemaParseAnnotations(String nsUri) { return super.unsetParseXSDAnnotations(nsUri); } /** * Registers a SchemaBindingInitializer for the namespace URI. * When the schema binding that corresponds to the namespace URI * is resolved, the init(SchemaBinding schema) method will be invoked on the * instance of SchemaBindingInitializer with the SchemaBinding returned from the * XsdBinder.bind() method. * * This method delegates to mapSchemaInitializer(nsUri, sbiClassName). * * @param nsUri the namespace URI to register the schema initializer for * @param sbiClassName the class name SchemaBindingInitializer * @throws Exception for any error */ public void addSchemaInitializer(String nsUri, String sbiClassName) throws Exception { super.mapSchemaInitializer(nsUri, sbiClassName); } /** * Registers an instance of SchemaBindingInitializer for the namespace URI. * When the schema binding that corresponds to the namespace URI * is resolved, the init(SchemaBinding schema) method will be invoked on the * instance of SchemaBindingInitializer with the SchemaBinding returned from the * XsdBinder.bind() method. * * This method delegates to mapSchemaInitializer(nsUri, sbi). * * @param nsUri the namespace URI to register the schema initializer for * @param sbi an instance of SchemaBindingInitializer */ public void addSchemaInitializer(String nsUri, SchemaBindingInitializer sbi) { super.mapSchemaInitializer(nsUri, sbi); } /** * Add an in-memory schema. * * @param nsUri schema namespace * @param reference the schema reference class name * @throws Exception for any error */ public void addClassBinding(String nsUri, String reference) throws ClassNotFoundException { super.mapURIToClass(nsUri, reference); } public void addClassBinding(String nsUri, Class clazz) { uriToClass.put(nsUri, clazz); } public Class removeClassBinding(String nsUri) { return uriToClass.remove(nsUri); } public void addClassBindingForLocation(String schemaLocation, Class clazz) { schemaLocationToClass.put(schemaLocation, clazz); } public Class removeClassBindingForLocation(String schemaLocation) { return schemaLocationToClass.remove(schemaLocation); } @Override protected Class[] getClassesForSchemaLocation(String uri) { Class c = schemaLocationToClass.get(uri); return c == null ? null : new Class[]{c}; } @Override protected Class[] getClassesForURI(String uri) { Class c = uriToClass.get(uri); return c == null ? null : new Class[]{c}; } public void mapLocationToClass(String schemaLocation, Class clazz) { this.addClassBindingForLocation(schemaLocation, clazz); } public void mapLocationToClasses(String schemaLocation, Class... classes) { throw new UnsupportedOperationException("This implementation supports schema location mapping to a single class only."); } public void mapURIToClass(String nsUri, Class clazz) { this.addClassBinding(nsUri, clazz); } public void mapURIToClasses(String nsUri, String... reference) throws ClassNotFoundException { throw new UnsupportedOperationException("This implementation supports URI mapping to a single class only."); } public void mapURIToClasses(String nsUri, Class... clazz) { throw new UnsupportedOperationException("This implementation supports URI mapping to a single class only."); } public Class[] removeLocationToClassMapping(String schemaLocation) { Class c = removeClassBindingForLocation(schemaLocation); return c == null ? null : new Class[]{c}; } public Class[] removeURIToClassMapping(String nsUri) { Class c = this.removeClassBinding(nsUri); return c == null ? null : new Class[]{c}; } @Override protected Class[] getClassesForQName(QName elementName) { if(qNameToClass == null) return null; Class c = qNameToClass.get(elementName); return c == null ? null : new Class[]{c}; } public void mapQNameToClasses(QName elementName, Class... classes) { if(elementName == null) throw new IllegalArgumentException("QName can't be null"); if(classes.length != 1) throw new IllegalArgumentException("Attempt to map " + classes.length + " classes to " + elementName + ". This implementation supports only single class mappings."); Class c = classes[0]; if(c == null) throw new IllegalArgumentException("Class argument can't be null"); if(qNameToClass == null) qNameToClass = new HashMap>(); qNameToClass.put(elementName, c); } public Class[] removeQNameToClassMapping(QName elementName) { if(qNameToClass == null) return null; Class c = qNameToClass.remove(elementName); return c == null ? null : new Class[]{c}; } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/DefaultElementHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Defa0000644000175000017500000000744510470642610033164 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import org.jboss.logging.Logger; import org.xml.sax.Attributes; /** * This handler can only be used if model group binding is not used. * * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class DefaultElementHandler implements ElementHandler, ParticleHandler { /** The log */ private static final Logger log = Logger.getLogger(DefaultElementHandler.class); public static final DefaultElementHandler INSTANCE = new DefaultElementHandler(); private AttributesHandler attrsHandler; public DefaultElementHandler() { this(AttributesHandler.INSTANCE); } public DefaultElementHandler(AttributesHandler attrsHandler) { this.attrsHandler = attrsHandler; } public Object startElement(Object parent, QName qName, ElementBinding element) { return parent; } public void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { if(attrsHandler != null) { attrsHandler.attributes(o, elementName, element.getType(), attrs, nsCtx); } } public Object endElement(Object o, QName qName, ElementBinding element) { return o; } public void setParent(Object parent, Object o, QName qName, ElementBinding element, ElementBinding parentElement) { if (log.isTraceEnabled()) log.trace("Not setting " + o + " on " + parent + " for " + qName); } // ParticleHandler impl public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { ElementBinding element = (ElementBinding)particle.getTerm(); Object o = startElement(parent, elementName, element); if(o != null) { attrs = element.getType().expandWithDefaultAttributes(attrs); attributes(o, elementName, element, attrs, nsCtx); } return o; } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { return endElement(o, elementName, (ElementBinding)particle.getTerm()); } public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle) { ElementBinding element = (ElementBinding)particle.getTerm(); ElementBinding parentElement = (ElementBinding)parentParticle.getTerm(); setParent(parent, o, elementName, element, parentElement); } } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ModelGroupBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Mode0000755000175000017500000001033011334317667033212 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.Collection; import javax.xml.namespace.QName; import org.jboss.xb.binding.Constants; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 4018 $ */ public abstract class ModelGroupBinding extends TermBinding { protected boolean requiredParticle; protected ModelGroupBinding(SchemaBinding schema) { super(schema); handler = DefaultHandlers.MODEL_GROUP_HANDLER; } public abstract ElementBinding getArrayItem(); /** * Model group that is passed in as an argument to this method must be fully populated with * element, wildcard and child model group bindings. * * @param particle the particle */ public void addParticle(ParticleBinding particle) { if(particle.isRequired()) requiredParticle = true; } public abstract Collection getParticles(); public boolean hasRequiredParticle() { return requiredParticle; } public ElementBinding getElement(QName qName, Attributes attrs, boolean ignoreWildcards) { ElementBinding element = null; for (ParticleBinding nextParticle : getParticles()) { TermBinding item = nextParticle.getTerm(); if (item.isElement()) { ElementBinding choice = (ElementBinding)item; if (qName.equals(choice.getQName())) element = choice; } else if (item.isModelGroup()) { ModelGroupBinding modelGroup = (ModelGroupBinding) item; element = modelGroup.getElement(qName, attrs, ignoreWildcards); } else if (!ignoreWildcards) { WildcardBinding wildcard = (WildcardBinding)item; element = wildcard.getElement(qName, attrs); } if (element != null) break; } return element; } public boolean isSkip() { return skip != Constants.FALSE; } public boolean isModelGroup() { return true; } public boolean isWildcard() { return false; } public boolean isElement() { return false; } public String toString() { StringBuffer sb = new StringBuffer(); sb.append(getGroupType()); if(qName != null) sb.append(' ').append(qName); sb.append(':'); for(ParticleBinding p : getParticles()) { TermBinding t = p.getTerm(); sb.append(' '); if(t.isElement()) sb.append(((ElementBinding)t).getQName()); else if(t.isModelGroup()) { sb.append('{').append(((ModelGroupBinding)t).getGroupType()); ModelGroupBinding group = (ModelGroupBinding) t; if(group.getQName() != null) sb.append(' ').append(group.getQName()); sb.append('}'); } else sb.append("{wildcard}"); if(p.getMaxOccursUnbounded()) sb.append(p.getMinOccurs() == 0 ? '*' : '!'); else if(p.getMinOccurs() == 0) sb.append('?'); } return sb.toString(); } public abstract String getGroupType(); } ././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/CharactersHandlerFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Char0000644000175000017500000000257311326305334033177 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; /** * A HandlersFactory. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public interface CharactersHandlerFactory { CharactersHandler newCharactersHandler(); CharactersHandler newCharactersHandler(CharactersHandler.UnmarshalCharactersHandler unmarshalHandler); } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/DefaultElementInterceptor.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Defa0000644000175000017500000000370410470642610033156 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class DefaultElementInterceptor implements ElementInterceptor { public static final ElementInterceptor INSTANCE = new DefaultElementInterceptor(); public Object startElement(Object parent, QName qName, TypeBinding type) { return parent; } public void attributes(Object o, QName elementName, TypeBinding type, Attributes attrs, NamespaceContext nsCtx) { } public void characters(Object o, QName qName, TypeBinding type, NamespaceContext nsCtx, String text) { } public Object endElement(Object o, QName qName, TypeBinding type) { return o; } public void add(Object parent, Object child, QName qName) { } } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ParticleHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Part0000755000175000017500000000346210470642610033231 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public interface ParticleHandler { Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx); Object endParticle(Object o, QName elementName, ParticleBinding particle); void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle); } ././@LongLink0000000000000000000000000000017700000000000011572 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SchemaResolverConfigMBean.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Sche0000644000175000017500000000670511502160776033212 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.Map; import java.util.Properties; /** * SchemaResolverConfigMBean. * * @author Adrian Brock * @version $Revision: 4882 $ */ public interface SchemaResolverConfigMBean { /** * Get whether schemas are cached by namespaceURI * @return true if schemas are cached */ public boolean getCacheResolvedSchemas(); /** * Set whether schemas are cached by namespaceURI * @param flag - true if schemas are cached */ public void setCacheResolvedSchemas(boolean flag); /** * Get the schemaInitializers. * * @return the schemaInitializers. */ Properties getSchemaInitializers(); /** * Set the schemaInitializers. * * @param schemaInitializers the schemaInitializers. */ void setSchemaInitializers(Properties schemaInitializers); /** * Get the schemaInitializers. * * @return the schemaInitializers. */ Map getSchemaInitializerInstances(); /** * Set the schemaInitializers. * * @param schemaInitializers the schemaInitializers. */ void setSchemaInitializerInstances(Map schemaInitializers); /** * Get the schemaLocations. * * @return the schemaLocations. */ Properties getSchemaLocations(); /** * Set the schemaLocations. * * @param schemaLocations the schemaLocations. */ void setSchemaLocations(Properties schemaLocations); /** * Get the parseAnnotations. * * @return the parseAnnotations. */ Properties getParseAnnotations(); /** * Set the parseAnnotations. * * @param parseAnnotations the parseAnnotations. */ void setParseAnnotations(Properties parseAnnotations); /** * Get the JBossXBBuilder namespace to Class mappings. * * @return bindingClasses */ public Properties getBindingClasses(); /** * Set the JBossXBBuilder namespace to Class mappings. * * @param bindingClasses */ public void setBindingClasses(Properties bindingClasses); /** * Get the JBossXBBuilder schema location to Class mappings. * * @return bindingClasses */ public Properties getBindingClassesByLocations(); /** * Set the JBossXBBuilder schema location to Class mappings. * * @param bindingClasses */ public void setBindingClassesByLocations(Properties bindingClasses); } ././@LongLink0000000000000000000000000000020100000000000011556 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/RegisteredAttributesHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Regi0000644000175000017500000001044711301007461033200 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.Collections; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.xml.sax.Attributes; /** * A RegisteredAttributesHandler. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class RegisteredAttributesHandler extends AttributesHandler { private Map registered; private AnyAttributeBinding any; private Map defaultAttrs; public void attributes(Object o, QName elementName, TypeBinding type, Attributes attrs, NamespaceContext nsCtx) { if(registered == null) return; Map notSetDefaultAttrs = null; // note: this is never used in the builder impl // but there is a test for this in SchemaDefaultAttributeValueUnitTestCase if(defaultAttrs != null) notSetDefaultAttrs = new HashMap(defaultAttrs); for(int i = 0; i < attrs.getLength(); ++i) { QName qName = new QName(attrs.getURI(i), attrs.getLocalName(i)); AttributeBinding binding = registered.get(qName); if(binding != null) { AttributeHandler handler = binding.getHandler(); Object value = handler.unmarshal(elementName, qName, binding, nsCtx, attrs.getValue(i)); handler.attribute(elementName, qName, binding, o, value); if(notSetDefaultAttrs != null && binding.getDefaultConstraint() != null) notSetDefaultAttrs.remove(qName); } else if (any != null) { AnyAttributeHandler handler = any.getHandler(); Object value = handler.unmarshal(elementName, qName, any, nsCtx, attrs.getValue(i)); handler.attribute(elementName, qName, any, o, value); } } if(notSetDefaultAttrs != null && !notSetDefaultAttrs.isEmpty()) { for(AttributeBinding binding : notSetDefaultAttrs.values()) { AttributeHandler handler = binding.getHandler(); Object value = handler.unmarshal(elementName, binding.getQName(), binding, nsCtx, binding.getDefaultConstraint()); handler.attribute(elementName, binding.getQName(), binding, o, value); } } } public void addAttribute(AttributeBinding attr) { if(registered == null) registered = Collections.singletonMap(attr.getQName(), attr); else { if(registered.size() == 1) registered = new HashMap(registered); registered.put(attr.getQName(), attr); } if(attr.getDefaultConstraint() != null) { if(defaultAttrs == null) defaultAttrs = Collections.singletonMap(attr.getQName(), attr); else { if(defaultAttrs.size() == 1) defaultAttrs = new HashMap(defaultAttrs); defaultAttrs.put(attr.getQName(), attr); } } } public void setAnyAttribute(AnyAttributeBinding any) { this.any = any; } } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SchemaBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Sche0000644000175000017500000010376311334317667033222 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.math.BigDecimal; import java.math.BigInteger; import java.net.URISyntaxException; import java.util.Map; import java.util.HashMap; import java.util.Collections; import java.util.Iterator; import java.util.Set; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.JBossXBValueFormatException; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller; import org.jboss.xb.binding.sunday.xop.XOPMarshaller; import org.jboss.xb.binding.metadata.PackageMetaData; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.util.DomCharactersHandler; import org.jboss.xb.util.DomLocalMarshaller; import org.jboss.xb.util.DomParticleHandler; /** * A SchemaBinding is a collection of binding objects (TypeBinding, * ChoiceBinding, ElementBinding, ModelGroupBinding, SequenceBinding, WildcardBinding) * for a single namespace keyed by the QNames of the schema components. * @author Alexey Loubyansky * @version $Revision: 4018 $ */ public class SchemaBinding { private static final ValueAdapter DATE_ADAPTER = new ValueAdapter() { public Object cast(Object o, Class c) { if (c != null && o != null && java.util.Date.class.isAssignableFrom(c)) { o = ((java.util.Calendar) o).getTime(); } return o; } }; /** The namespaces Set */ private Set namespaces = Collections.emptySet(); /** namespace to prefix map, used in xb builder during binding */ private Map nsByPrefix = Collections.emptyMap(); /** Map for simple/complex types */ private Map types = new HashMap(); /** Map for */ private Map elements = new HashMap(); /** Map for */ private Map groups = new HashMap(); /** The default package information */ private PackageMetaData packageMetaData; /** Schema resolver to use for foreign namespaces */ private SchemaBindingResolver schemaResolver; /** Must all content have a valid binding */ private boolean strictSchema = true; /** Should child elements be ignored if they don't map to a parent field */ private boolean ignoreUnresolvedFieldOrClass = true; /** Should '_' be considered as a word separator or part of Java identifier */ private boolean ignoreLowLine = true; /** Should ${x} references be replaced with x system property */ private boolean replacePropertyRefs = true; /** Should list xml types be unmarshalled as arrays */ private boolean unmarshalListsToArrays; /** Should the default no-arg ctor be used to create the java instance */ private boolean useNoArgCtorIfFound; /** The default property name to use for simple content bindings */ private String simpleContentProperty = "value"; /** if all the characters in the mixed content are whitespaces * should they be considered indentation and ignored? * the default is true for the backwards compatibility */ private boolean ignoreWhitespacesInMixedContent = true; /** whether to trim string values */ private boolean normalizeSpace; /** default XOP unmarshaller */ private XOPUnmarshaller xopUnmarshaller; /** default XOP marshaller */ private XOPMarshaller xopMarshaller; public SchemaBinding() { addType(new SimpleTypeBinding(Constants.QNAME_ANYSIMPLETYPE, CharactersHandler.NOOP_UNMARSHAL_HANDLER)); addType(new SimpleTypeBinding(Constants.QNAME_STRING, CharactersHandler.NOOP_UNMARSHAL_HANDLER)); addType(new SimpleTypeBinding(Constants.QNAME_BOOLEAN, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); if(value.length() == 1) { char c = value.charAt(0); if(c == '1') return Boolean.TRUE; if(c == '0') return Boolean.FALSE; throw new JBossXBValueFormatException("An instance of a datatype that is defined as ?boolean? can have the following legal literals" + " {true, false, 1, 0}. But got: " + value); } else return Boolean.valueOf(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_DECIMAL, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return new BigDecimal(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_FLOAT, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); if("INF".equals(value)) return new Float(Float.POSITIVE_INFINITY); else if("-INF".equals(value)) return new Float(Float.NEGATIVE_INFINITY); else return Float.valueOf(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_DOUBLE, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); if("INF".equals(value)) return new Double(Double.POSITIVE_INFINITY); else if("-INF".equals(value)) return new Double(Double.NEGATIVE_INFINITY); else return Double.valueOf(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_DURATION, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { // todo XS_DURATION throw new IllegalStateException("Recognized but not supported xsdType: " + Constants.QNAME_DURATION); } })); addType(new SimpleTypeBinding(Constants.QNAME_DATETIME, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalDateTime(value); } }, DATE_ADAPTER)); addType(new SimpleTypeBinding(Constants.QNAME_TIME, new CharactersHandler.UnmarshalCharactersHandler(){ public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalTime(value); } }, DATE_ADAPTER)); addType(new SimpleTypeBinding(Constants.QNAME_DATE, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalDate(value); } }, DATE_ADAPTER)); addType(new SimpleTypeBinding(Constants.QNAME_GYEARMONTH, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalGYearMonth(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_GYEAR, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalGYear(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_GMONTHDAY, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalGMonthDay(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_GDAY, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalGDay(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_GMONTH, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalGMonth(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_HEXBINARY, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalHexBinary(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_BASE64BINARY, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalBase64(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_ANYURI, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); // anyUri is by default bound to java.net.URI for now. The following is the warning from JAXB2.0: // // Design Note � xs:anyURI is not bound to java.net.URI by default since not all // possible values of xs:anyURI can be passed to the java.net.URI constructor. Using // a global JAXB customization described in Section 7.9, � // Declaration", a JAXB user can override the default mapping to map xs:anyURI to // java.net.URI. // try { return new java.net.URI(value); } catch(URISyntaxException e) { throw new JBossXBValueFormatException("Failed to unmarshal anyURI value " + value, e); } } })); addType(new SimpleTypeBinding(Constants.QNAME_QNAME, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalQName(value, nsCtx); } })); addType(new SimpleTypeBinding(Constants.QNAME_NOTATION, CharactersHandler.NOOP)); addType(new SimpleTypeBinding(Constants.QNAME_NORMALIZEDSTRING, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); if(SimpleTypeBindings.isNormalizedString(value)) return value; else throw new JBossXBValueFormatException("Invalid normalizedString value: " + value); } })); addType(new SimpleTypeBinding(Constants.QNAME_TOKEN, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); if(SimpleTypeBindings.isValidToken(value)) return value; else throw new JBossXBValueFormatException("Invalid token value: " + value); } })); addType(new SimpleTypeBinding(Constants.QNAME_LANGUAGE, CharactersHandler.NOOP)); addType(new SimpleTypeBinding(Constants.QNAME_NMTOKEN, CharactersHandler.NOOP)); addType(new SimpleTypeBinding(Constants.QNAME_NMTOKENS, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalNMTokens(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_NAME, CharactersHandler.NOOP)); addType(new SimpleTypeBinding(Constants.QNAME_NCNAME, CharactersHandler.NOOP)); addType(new SimpleTypeBinding(Constants.QNAME_ID, CharactersHandler.NOOP)); addType(new SimpleTypeBinding(Constants.QNAME_IDREF, CharactersHandler.NOOP)); addType(new SimpleTypeBinding(Constants.QNAME_IDREFS, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalIdRefs(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_ENTITY, CharactersHandler.NOOP)); addType(new SimpleTypeBinding(Constants.QNAME_ENTITIES, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return SimpleTypeBindings.unmarshalIdRefs(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_INTEGER, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return new BigInteger(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_NONPOSITIVEINTEGER, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); BigInteger result = new BigInteger(value); if(BigInteger.ZERO.compareTo(result) < 0) throw new JBossXBValueFormatException("Invalid nonPositiveInteger value: " + value); return result; } })); addType(new SimpleTypeBinding(Constants.QNAME_NEGATIVEINTEGER, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); BigInteger result = new BigInteger(value); if(BigInteger.ZERO.compareTo(result) <= 0) throw new JBossXBValueFormatException("Invalid negativeInteger value: " + value); return result; } })); addType(new SimpleTypeBinding(Constants.QNAME_LONG, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return Long.valueOf(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_INT, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return Integer.valueOf(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_SHORT, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return Short.valueOf(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_BYTE, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); return Byte.valueOf(value); } })); addType(new SimpleTypeBinding(Constants.QNAME_NONNEGATIVEINTEGER, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); BigInteger result = new BigInteger(value); if(BigInteger.ZERO.compareTo(result) > 0) throw new JBossXBValueFormatException("Invalid nonNegativeInteger value: " + value); return result; } })); addType(new SimpleTypeBinding(Constants.QNAME_UNSIGNEDLONG, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); BigInteger d = new BigInteger(value); if(d.doubleValue() < 0 || d.doubleValue() > 18446744073709551615D) throw new JBossXBValueFormatException("Invalid unsignedLong value: " + value); return d; } })); addType(new SimpleTypeBinding(Constants.QNAME_UNSIGNEDINT, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); long l = Long.parseLong(value); if(l < 0 || l > 4294967295L) throw new JBossXBValueFormatException("Invalid unsignedInt value: " + value); return new Long(l); } })); addType(new SimpleTypeBinding(Constants.QNAME_UNSIGNEDSHORT, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); int i = Integer.parseInt(value); if(i < 0 || i > 65535) throw new JBossXBValueFormatException("Invalid unsignedShort value: " + value); return new Integer(i); } })); addType(new SimpleTypeBinding(Constants.QNAME_UNSIGNEDBYTE, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); short s = Short.parseShort(value); if(s < 0 || s > 255) throw new JBossXBValueFormatException("Invalid unsignedByte value: " + value); return new Short(s); } })); addType(new SimpleTypeBinding(Constants.QNAME_POSITIVEINTEGER, new CharactersHandler.UnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if (value == null) throw new IllegalArgumentException("Value string cannot be null"); BigInteger result = new BigInteger(value); if(BigInteger.ZERO.compareTo((BigInteger)result) >= 0) throw new JBossXBValueFormatException("Invalid positiveInteger value: " + value); return result; } })); } public void addPrefixMapping(String prefix, String ns) { if(nsByPrefix.isEmpty()) { nsByPrefix = Collections.singletonMap(prefix, ns); } else { if(nsByPrefix.size() == 1) { nsByPrefix = new HashMap(nsByPrefix); } nsByPrefix.put(prefix, ns); } } public String getNamespace(String prefix) { return nsByPrefix.get(prefix); } /** * Get the namespaces. * * @return the namespaces. */ public Set getNamespaces() { return namespaces; } /** * Set the namespaces. * * @param namespaces the namespaces. * @throws IllegalArgumentException for null spaces */ public void setNamespaces(Set namespaces) { if (namespaces == null) throw new IllegalArgumentException("Null namespaces"); this.namespaces = namespaces; } public TypeBinding getType(QName qName) { return types.get(qName); } public void addType(TypeBinding type) { QName qName = type.getQName(); if(qName == null) { throw new JBossXBRuntimeException("Global type must have a name."); } types.put(qName, type); } public ElementBinding getElement(QName name) { ParticleBinding particle = elements.get(name); ElementBinding element = (ElementBinding)(particle == null ? null : particle.getTerm()); return element; } public ParticleBinding getElementParticle(QName name) { return elements.get(name); } public void addElement(ElementBinding element) { ParticleBinding particle = new ParticleBinding(element); elements.put(element.getQName(), particle); } public ElementBinding addElement(QName name, TypeBinding type) { ElementBinding element = new ElementBinding(this, name, type); addElement(element); return element; } public Iterator getElements() { return new Iterator() { private Iterator particleIterator = elements.values().iterator(); public boolean hasNext() { return particleIterator.hasNext(); } public ElementBinding next() { ParticleBinding particle = particleIterator.next(); return (ElementBinding) particle.getTerm(); } public void remove() { throw new UnsupportedOperationException("remove is not implemented."); } }; } public Iterator getElementParticles() { return elements.values().iterator(); } public Iterator getTypes() { return Collections.unmodifiableCollection(types.values()).iterator(); } public ModelGroupBinding getGroup(QName name) { return groups.get(name); } public void addGroup(QName name, ModelGroupBinding group) { groups.put(name, group); } public Iterator getGroups() { return groups.values().iterator(); } public PackageMetaData getPackageMetaData() { return packageMetaData; } public void setPackageMetaData(PackageMetaData packageMetaData) { this.packageMetaData = packageMetaData; } public SchemaBindingResolver getSchemaResolver() { return schemaResolver; } public void setSchemaResolver(SchemaBindingResolver schemaResolver) { this.schemaResolver = schemaResolver; } public boolean isStrictSchema() { return strictSchema; } /** * If strict-schema is true then all the elements and attributes in XML content being parsed must be bound * in this instance of SchemaBinding (except attributes from xmlns and xsi namespaces), * otherwise a runtime exception is thrown. The default value for this property is true. */ public void setStrictSchema(boolean strictSchema) { this.strictSchema = strictSchema; } public boolean isIgnoreUnresolvedFieldOrClass() { return ignoreUnresolvedFieldOrClass; } /** * If a field is not found in the parent class to set child value on or * a class an element is bound to * an exception will be thrown if this property is false. Otherwise, * the process will just go on (the default for now). */ public void setIgnoreUnresolvedFieldOrClass(boolean ignoreUnresolvedFieldOrClass) { this.ignoreUnresolvedFieldOrClass = ignoreUnresolvedFieldOrClass; } public boolean isReplacePropertyRefs() { return replacePropertyRefs; } /** * * @param flag */ public void setReplacePropertyRefs(boolean flag) { this.replacePropertyRefs = flag; } public boolean isIgnoreLowLine() { return ignoreLowLine; } /** * Where '_' should be considered as a word separator or a part of the Java identifier * when mapping XML names to Java identifiers. */ public void setIgnoreLowLine(boolean ignoreLowLine) { this.ignoreLowLine = ignoreLowLine; } public boolean isUnmarshalListsToArrays() { return unmarshalListsToArrays; } /** * Should list xml types be unmarshalled as arrays * @param unmarshalListsToArrays */ public void setUnmarshalListsToArrays(boolean unmarshalListsToArrays) { this.unmarshalListsToArrays = unmarshalListsToArrays; } public boolean isUseNoArgCtorIfFound() { return useNoArgCtorIfFound; } /** * Should the default no-arg ctor be used to create the java instance * @param useNoArgCtorIfFound */ public void setUseNoArgCtorIfFound(boolean useNoArgCtorIfFound) { this.useNoArgCtorIfFound = useNoArgCtorIfFound; } public String getSimpleContentProperty() { return simpleContentProperty; } /** * Set the default property name to use for simple content bindings * @param simpleContentProperty */ public void setSimpleContentProperty(String simpleContentProperty) { this.simpleContentProperty = simpleContentProperty; } /** * @return schema default XOP unmarshaller */ public XOPUnmarshaller getXopUnmarshaller() { return xopUnmarshaller; } /** * @param xopUnmarshaller schema default XOP unmarshaller */ public void setXopUnmarshaller(XOPUnmarshaller xopUnmarshaller) { this.xopUnmarshaller = xopUnmarshaller; } /** * @return schema default XOP marshaller */ public XOPMarshaller getXopMarshaller() { return xopMarshaller; } /** * @param xopMarshaller schema default XOP marshaller */ public void setXopMarshaller(XOPMarshaller xopMarshaller) { this.xopMarshaller = xopMarshaller; } public void setUnresolvedContentBoundToDOM(boolean toDom) { TypeBinding type = getType(Constants.QNAME_ANYTYPE); if(type == null) { // ignore, there is no use of the anyType in the schema return; //throw new JBossXBRuntimeException("anyType is not bound."); } WildcardBinding wildcard = type.getWildcard(); if(toDom) { wildcard.setUnresolvedCharactersHandler(DomCharactersHandler.INSTANCE); wildcard.setUnresolvedElementHandler(DomParticleHandler.INSTANCE); wildcard.setUnresolvedMarshaller(DomLocalMarshaller.INSTANCE); } else { wildcard.setUnresolvedCharactersHandler(null); wildcard.setUnresolvedElementHandler(null); wildcard.setUnresolvedMarshaller(null); } } public boolean isUnresolvedContentBoundToDOM() { TypeBinding type = getType(Constants.QNAME_ANYTYPE); if(type == null) { // there is no use of the anyType in the schema return false; //throw new JBossXBRuntimeException("anyType is not bound."); } WildcardBinding wildcard = type.getWildcard(); return wildcard.getUnresolvedCharactersHandler() instanceof DomCharactersHandler && wildcard.getUnresolvedElementHandler() instanceof DomParticleHandler && wildcard.getUnresolvedMarshaller() instanceof DomLocalMarshaller; } public boolean isIgnoreWhitespacesInMixedContent() { return ignoreWhitespacesInMixedContent; } public void setIgnoreWhitespacesInMixedContent(boolean value) { this.ignoreWhitespacesInMixedContent = value; } public boolean isNormalizeSpace() { return normalizeSpace; } public void setNormalizeSpace(boolean value) { this.normalizeSpace = value; } void addElementParticle(ParticleBinding particle) { ElementBinding element = (ElementBinding)particle.getTerm(); elements.put(element.getQName(), particle); } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AbstractPosition.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Abst0000644000175000017500000001471611357571642033230 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.UnmarshallingContextImpl; import org.xml.sax.Attributes; /** * A AbstractPosition. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public abstract class AbstractPosition { protected static Logger log = Logger.getLogger(AbstractPosition.class); protected static boolean trace; public static void resetTrace() { trace = log.isTraceEnabled(); } protected PositionStack stack; protected final QName qName; protected ParticleBinding particle; protected TermBinding term; protected ParticleHandler handler; protected TypeBinding parentType; protected Object o; protected Object repeatableParticleValue; protected RepeatableParticleHandler repeatableHandler; protected boolean ended; protected int occurrence; protected AbstractPosition previous; protected AbstractPosition next; protected AbstractPosition notSkippedParent; protected boolean skip; protected AbstractPosition(QName qName, ParticleBinding particle) { if (particle == null) throw new IllegalArgumentException("Null particle"); if(qName == null) throw new IllegalArgumentException("Null qName"); this.qName = qName; this.particle = particle; this.occurrence = 1; this.term = particle.getTerm(); this.skip = term.isSkip(); if(particle.isRepeatable()) repeatableHandler = term.getRepeatableHandler(); // if(skip) // handler = DefaultHandlers.UOE_PARTICLE_HANDLER; // else initHandler(); } public void setStack(PositionStack stack) { this.stack = stack; } public ParticleBinding getParticle() { return particle; } public AbstractPosition getPrevious() { return previous; } public Object getRepeatableParticleValue() { return repeatableParticleValue; } public Object getValue() { return o; } public boolean isEnded() { return ended; } public boolean isElement() { return false; } public void endRepeatableParticle() { if (trace) log.trace(" end repeatable " + term); repeatableHandler.endRepeatableParticle(previous.o, repeatableParticleValue, qName, particle, previous.particle); repeatableParticleValue = null; } public abstract void endParticle(); public abstract void characters(char[] ch, int start, int length); public abstract ElementPosition startParticle(QName startName, Attributes atts); protected void initValue(Attributes atts) { // attributes and characters of skipped elements should be set on the parent // if(skip) // { // o = previous == null ? null : previous.o; // return; // } Object parent = previous == null ? null : previous.o; o = handler.startParticle(parent, qName, particle, atts, stack.getNamespaceRegistry()); } protected void startRepeatableParticle() { if(trace) log.trace(" start repeatable " + term); RepeatableParticleHandler repeatableHandler = term.getRepeatableHandler(); // the way it is now it's never null Object repeatableContainer = repeatableHandler.startRepeatableParticle(previous.o, qName, particle); if(repeatableContainer != null) { if(this.repeatableParticleValue != null) throw new IllegalStateException("Previous repeatable particle hasn't been ended yet!"); this.repeatableParticleValue = repeatableContainer; } } protected AbstractPosition getLastNotSkipped() { return !skip || repeatableParticleValue != null ? this : notSkippedParent; } protected void setParent(AbstractPosition parentPosition, ParticleHandler handler) { if(skip) return; if(repeatableParticleValue != null) { repeatableHandler.addTermValue(repeatableParticleValue, o, qName, particle, parentPosition.particle, handler); } else if(parentPosition.repeatableParticleValue == null || !parentPosition.skip) { TermBeforeSetParentCallback beforeSetParent = term.getBeforeSetParentCallback(); if (beforeSetParent != null) { UnmarshallingContextImpl ctx = stack.getContext(); ctx.parent = parentPosition.o; ctx.particle = particle; ctx.parentParticle = notSkippedParent.particle; o = beforeSetParent.beforeSetParent(o, ctx); ctx.clear(); } handler.setParent(parentPosition.o, o, qName, particle, parentPosition.particle); } else { parentPosition.repeatableHandler.addTermValue( parentPosition.repeatableParticleValue, o, qName, particle, parentPosition.particle, handler); } } protected void initHandler() { handler = term.getHandler(); if(handler == null) handler = DefaultHandlers.ELEMENT_HANDLER; } protected abstract void repeatForChild(Attributes atts); protected abstract AbstractPosition nextPosition(QName startName, Attributes atts); } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/XsdBinderTerminatingErrorHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/XsdB0000644000175000017500000000353210470642610033156 0ustar twernertwerner/** * */ package org.jboss.xb.binding.sunday.unmarshalling; import org.jboss.xb.binding.JBossXBRuntimeException; import org.w3c.dom.DOMError; import org.w3c.dom.DOMErrorHandler; import org.w3c.dom.DOMLocator; public class XsdBinderTerminatingErrorHandler implements DOMErrorHandler { private static XsdBinderTerminatingErrorHandler errorHandler; // Hide constructor private XsdBinderTerminatingErrorHandler() { } public static XsdBinderTerminatingErrorHandler newInstance() { if (errorHandler == null) { errorHandler = new XsdBinderTerminatingErrorHandler(); } return errorHandler; } public boolean handleError(DOMError error) { // todo: i do throw exceptions here instead of returning false to stop parsing immediately // since returning false seems to be no different from true (a bug in the parser?) // Although, throwing an exception reports the same error twice but the second time with // location -1:-1 switch(error.getSeverity()) { case DOMError.SEVERITY_ERROR: throw new JBossXBRuntimeException(formatMessage(error)); case DOMError.SEVERITY_FATAL_ERROR: throw new JBossXBRuntimeException(formatMessage(error)); case DOMError.SEVERITY_WARNING: XsdBinder.log.warn(formatMessage(error)); break; } return false; } String formatMessage(DOMError error) { StringBuffer buf = new StringBuffer(); DOMLocator location = error.getLocation(); if(location != null) { buf.append(location.getLineNumber()) .append(':') .append(location.getColumnNumber()); } else { buf.append("[location unavailable]"); } buf.append(' ').append(error.getMessage()); return buf.toString(); } }././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AttributesHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Attr0000644000175000017500000000637611075435045033245 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import org.xml.sax.Attributes; import org.jboss.logging.Logger; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.JBossXBRuntimeException; /** * @author Alexey Loubyansky * @version $Revision: 2926 $ */ public class AttributesHandler { private static final Logger log = Logger.getLogger(AttributesHandler.class); public static final AttributesHandler INSTANCE = new AttributesHandler(); public void attributes(Object o, QName elementName, TypeBinding type, Attributes attrs, NamespaceContext nsCtx) { for(int i = 0; i < attrs.getLength(); ++i) { QName qName = new QName(attrs.getURI(i), attrs.getLocalName(i)); AttributeBinding binding = type.getAttribute(qName); if(binding != null) { AttributeHandler handler = binding.getHandler(); Object value = handler.unmarshal(elementName, qName, binding, nsCtx, attrs.getValue(i)); handler.attribute(elementName, qName, binding, o, value); } else { AnyAttributeBinding anyAttribute = type.getAnyAttribute(); if(anyAttribute != null) { AnyAttributeHandler handler = anyAttribute.getHandler(); Object value = handler.unmarshal(elementName, qName, anyAttribute, nsCtx, attrs.getValue(i)); handler.attribute(elementName, qName, anyAttribute, o, value); } else if(!Constants.NS_XML_SCHEMA_INSTANCE.equals(qName.getNamespaceURI())) { SchemaBinding schemaBinding = type.getSchemaBinding(); if(schemaBinding != null && schemaBinding.isStrictSchema()) { throw new JBossXBRuntimeException( "Attribute is not bound: element owner " + elementName + ", attribute " + qName ); } else if(log.isTraceEnabled()) { log.trace("Attribute is not bound: element owner " + elementName + ", attribute " + qName); } } } } } } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/LSInputAdaptor.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/LSIn0000644000175000017500000000720611207772035033131 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.io.InputStream; import java.io.Reader; import org.w3c.dom.ls.LSInput; import org.xml.sax.InputSource; /** * A simple implementation of the dom3 LSInput * * @author Scott.Stark@jboss.org * @version $Revision: 3205 $ */ public class LSInputAdaptor implements LSInput { private String baseURI; private String publicId; private String systemId; private String encoding; private InputStream byteStream; private Reader characterStream; private String stringData; private boolean certifiedText; public LSInputAdaptor(String publicId, String systemId, String baseURI) { this.publicId = publicId; this.systemId = systemId; this.baseURI = baseURI; } public LSInputAdaptor(InputStream is, String encoding) { setByteStream(is); setEncoding(encoding); } public LSInputAdaptor(Reader charStream, String encoding) { this.setCharacterStream(charStream); setEncoding(encoding); } public LSInputAdaptor(String data, String encoding) { this.setStringData(data); setEncoding(encoding); } public LSInputAdaptor(InputSource is) { setByteStream(is.getByteStream()); setCharacterStream(is.getCharacterStream()); setPublicId(is.getPublicId()); setSystemId(is.getSystemId()); setEncoding(is.getEncoding()); } public String getBaseURI() { return baseURI; } public void setBaseURI(String baseURI) { this.baseURI = baseURI; } public String getPublicId() { return publicId; } public void setPublicId(String publicId) { this.publicId = publicId; } public String getSystemId() { return systemId; } public void setSystemId(String systemId) { this.systemId = systemId; } public InputStream getByteStream() { return byteStream; } public void setByteStream(InputStream is) { this.byteStream = is; } public Reader getCharacterStream() { return characterStream; } public void setCharacterStream(Reader reader) { this.characterStream = reader; } public String getStringData() { return stringData; } public void setStringData(String stringData) { this.stringData = stringData; } public String getEncoding() { return encoding; } public void setEncoding(String encoding) { this.encoding = encoding; } public boolean getCertifiedText() { return certifiedText; } public void setCertifiedText(boolean flag) { this.certifiedText = flag; } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/UnmarshallingContext.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Unma0000644000175000017500000000267111061473704033224 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; /** * @author Alexey Loubyansky * @version $Revision: 2096 $ */ public interface UnmarshallingContext { Object getParentValue(); ParticleBinding getParticle(); ParticleBinding getParentParticle(); String resolvePropertyName(); Class resolvePropertyType(); } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ElementBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Elem0000644000175000017500000001476511334317667033225 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.List; import java.util.Collections; import java.util.ArrayList; import javax.xml.namespace.QName; import org.jboss.xb.binding.metadata.AddMethodMetaData; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.MapEntryMetaData; import org.jboss.xb.binding.metadata.PutMethodMetaData; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.sunday.marshalling.TermBeforeMarshallingCallback; import org.jboss.xb.binding.sunday.xop.XOPUnmarshaller; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 4018 $ */ public class ElementBinding extends TermBinding { protected List interceptors = Collections.emptyList(); protected TypeBinding typeBinding; protected boolean nillable; protected int normalizeSpace; protected XOPUnmarshaller xopUnmarshaller; private ParticleHandler handler; public ElementBinding(SchemaBinding schema, QName qName, TypeBinding typeBinding) { super(schema); this.typeBinding = typeBinding; setQName(qName); } protected ElementBinding() { } public void setQName(QName qName) { if(qName == null) throw new JBossXBRuntimeException("Each element must have a non-null QName!"); this.qName = qName; } public List getInterceptors() { return interceptors; } public TypeBinding getType() { return typeBinding; } public void setType(TypeBinding type) { if(type == null) throw new IllegalArgumentException("The type cannot be null: " + qName); this.typeBinding = type; } @Override public ParticleHandler getHandler() { return handler == null ? typeBinding.getHandler() : handler; } @Override public void setHandler(ParticleHandler handler) { this.handler = handler; } public void pushInterceptor(ElementInterceptor interceptor) { switch(interceptors.size()) { case 0: interceptors = Collections.singletonList(interceptor); break; case 1: interceptors = new ArrayList(interceptors); default: { if( interceptors.contains(interceptor) == false ) interceptors.add(interceptor); } } } public ClassMetaData getClassMetaData() { ClassMetaData result = classMetaData; if(result == null && mapEntryMetaData == null) { result = typeBinding.getClassMetaData(); } return result; } public MapEntryMetaData getMapEntryMetaData() { MapEntryMetaData result = mapEntryMetaData; if(result == null && classMetaData == null) { result = typeBinding.getMapEntryMetaData(); } return result; } public ValueMetaData getValueMetaData() { return valueMetaData != null ? valueMetaData : typeBinding.getValueMetaData(); } public PutMethodMetaData getPutMethodMetaData() { // todo should types be allowed to have putMethod metadata return putMethodMetaData; } public AddMethodMetaData getAddMethodMetaData() { AddMethodMetaData result = addMethodMetaData; if(result == null && putMethodMetaData == null && propertyMetaData == null) { result = typeBinding.getAddMethodMetaData(); } return result; } public boolean isSkip() { return skip == Constants.NOT_SET ? typeBinding.isSkip() : skip == Constants.TRUE; } public ValueAdapter getValueAdapter() { return valueAdapter == null ? typeBinding.getValueAdapter() : valueAdapter; } public TermBeforeMarshallingCallback getBeforeMarshallingCallback() { return beforeMarshallingCallback == null ? typeBinding.getBeforeMarshallingCallback() : beforeMarshallingCallback; } public TermBeforeSetParentCallback getBeforeSetParentCallback() { return beforeSetParentCallback == null ? typeBinding.getBeforeSetParentCallback() : beforeSetParentCallback; } public boolean isNillable() { return nillable; } public void setNillable(boolean nillable) { this.nillable = nillable; } public boolean isModelGroup() { return false; } public boolean isWildcard() { return false; } public boolean isElement() { return true; } public XOPUnmarshaller getXopUnmarshaller() { return xopUnmarshaller == null ? typeBinding.getXopUnmarshaller() : xopUnmarshaller; } public void setXopUnmarshaller(XOPUnmarshaller xopUnmarshaller) { this.xopUnmarshaller = xopUnmarshaller; } public void setNormalizeSpace(boolean value) { this.normalizeSpace = value ? Constants.TRUE : Constants.FALSE; } public boolean isNormalizeSpace() { if(normalizeSpace == Constants.NOT_SET) return schema == null ? true : schema.isNormalizeSpace(); return normalizeSpace == Constants.TRUE; } public String toString() { return "element(" + qName + ", type=" + typeBinding.getQName() + ")"; } public ElementPosition newPosition(QName name, Attributes attrs, ParticleBinding particle) { if(!qName.equals(name)) return null; return new ElementPosition(name, particle); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl/libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl0000755000175000017500000000000011620316765033261 5ustar twernertwerner././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl/runtime/libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl0000755000175000017500000000000011620316766033262 5ustar twernertwerner././@LongLink0000000000000000000000000000020300000000000011560 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl/runtime/RtElementHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl0000644000175000017500000013601711350171524033263 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling.impl.runtime; import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Collection; import java.util.Map; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.util.Classes; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.GenericValueContainer; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.Util; import org.jboss.xb.binding.introspection.FieldInfo; import org.jboss.xb.binding.group.ValueList; import org.jboss.xb.binding.group.ValueListHandler; import org.jboss.xb.binding.group.ValueListInitializer; import org.jboss.xb.binding.metadata.AddMethodMetaData; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.MapEntryMetaData; import org.jboss.xb.binding.metadata.PackageMetaData; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.metadata.PutMethodMetaData; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.AttributeHandler; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 4183 $ */ public class RtElementHandler implements ParticleHandler { private static final Logger log = Logger.getLogger(RtElementHandler.class); public static final RtElementHandler INSTANCE = new RtElementHandler(); // ParticleHandler impl /** * TODO: it seems like for correct type resolution in startParticle * I should take into account the way the object is going to be added * to the parent in setParent (and, hence, do some steps that are done in setParticle). * In setParent then I should reuse the results of what has been done in startParticle. */ public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx) { TermBinding term = particle.getTerm(); Object o = startElement(parent, elementName, particle); if(!term.isModelGroup()) { ElementBinding element = (ElementBinding)term; if(o != null) { attrs = element.getType().expandWithDefaultAttributes(attrs); attributes(o, elementName, element, attrs, nsCtx); } } return o; } public void setParent(Object parent, Object o, QName qName, ParticleBinding particle, ParticleBinding parentParticle) { TermBinding term = particle.getTerm(); if(term.isSkip()) { return; } boolean trace = log.isTraceEnabled(); if(trace) { log.trace("setParent " + qName + " parent=" + parent + " object=" + o + " term=" + term); } final TermBinding parentTerm = parentParticle.getTerm(); if(term.isMapEntryKey()) { if(trace) { log.trace("setParent " + qName + " mapKey"); } if(parent instanceof MapEntry) { MapEntry mapEntry = (MapEntry)parent; mapEntry.setKey(o); } else if(parentTerm != null) { MapEntryMetaData mapEntryMetaData = getMapEntryMetaData(parentTerm, qName); String getKeyMethodName = mapEntryMetaData.getGetKeyMethod(); if(getKeyMethodName == null) { getKeyMethodName = "getKey"; } String setKeyMethodName = mapEntryMetaData.getSetKeyMethod(); if(setKeyMethodName == null) { setKeyMethodName = "setKey"; } Class parentCls = parent.getClass(); Method setKeyMethod = getSetMethod(parentCls, getKeyMethodName, setKeyMethodName); invokeSetter(setKeyMethod, parent, o, setKeyMethodName); } else { throw new JBossXBRuntimeException( "Element " + qName + " bound as map entry key but parent element is not recognized as map entry and its metadata is not available." ); } } else if(term.isMapEntryValue()) { if(trace) { log.trace("setParent " + qName + " mapValue"); } if(parent instanceof MapEntry) { MapEntry mapEntry = (MapEntry)parent; mapEntry.setValue(o); } else if(parentTerm != null) { MapEntryMetaData mapEntryMetaData = getMapEntryMetaData(parentTerm, qName); setMapEntryValue(mapEntryMetaData, parent, o); } else { throw new JBossXBRuntimeException( "Element " + qName + " bound as map entry key but parent element is not recognized as map entry and its metadata is not available." ); } } else { Object owner = parent; if(parent instanceof MapEntry) { if(trace) { log.trace("setParent " + qName + " mapEntry"); } MapEntry mapEntry = (MapEntry)parent; owner = mapEntry.getValue(); if(owner == null) { if(parentTerm == null) { throw new JBossXBRuntimeException("Binding metadata needed for lazy map entry value instantiation is not available " + "for parent element of element " + qName ); } MapEntryMetaData mapEntryMetaData = getMapEntryMetaData(parentTerm, qName); String valueType = mapEntryMetaData.getValueType(); if(valueType == null) { throw new JBossXBRuntimeException("Element " + qName + " is supposed to be bound as map entry value with lazy value instantiation " + "but value type is not specified in its map entry metadata." ); } Class valueCls; try { valueCls = Thread.currentThread().getContextClassLoader().loadClass(valueType); } catch(ClassNotFoundException e) { throw new JBossXBRuntimeException( "Failed to load value type specified in the map entry metadata: " + valueType ); } try { owner = valueCls.newInstance(); } catch(Exception e) { throw new JBossXBRuntimeException( "Failed to create an instance of value type " + valueType + ": " + e.getMessage() ); } setMapEntryValue(mapEntryMetaData, parent, owner); } } // the wildcard this element is a content of WildcardBinding wildcard = parentTerm.isWildcard() ? (WildcardBinding) parentTerm : null; if(owner instanceof ValueList) { ValueList valueList = (ValueList)owner; valueList.getInitializer().addTermValue(qName, particle, this, valueList, o, parentParticle); } else if(tryPut(owner, o, qName, term, trace)) { } else if(tryAdd(owner, o, qName, term, wildcard, trace)) { } else if (owner instanceof GenericValueContainer) { if (trace) { log.trace("setParent " + qName + " addChild"); } ((GenericValueContainer) owner).addChild(qName, o); } else if (owner instanceof Collection) { if (trace) { log.trace("setParent " + qName + " collection.add()"); } ((Collection) owner).add(o); } else { PropertyMetaData propertyMetaData = wildcard == null ? null : wildcard.getPropertyMetaData(); if (propertyMetaData == null) { propertyMetaData = term.getPropertyMetaData(); } String propName = null; String colType = null; if (propertyMetaData != null) { propName = propertyMetaData.getName(); colType = propertyMetaData.getCollectionType(); } if (propName == null) { propName = Util.xmlNameToFieldName(qName.getLocalPart(), term.getSchema().isIgnoreLowLine()); } if (trace) log.trace("setParent " + qName + " metadata set " + propName); boolean repeatable = particle.isRepeatable() || wildcard != null && parentParticle.isRepeatable(); // TODO with RepeatableParticleHandler.NOOP check for Collection should be commented out if(repeatable && !(o instanceof Collection)) { RtUtil.add(owner, o, propName, colType, term.getSchema().isIgnoreUnresolvedFieldOrClass(), term.getValueAdapter() ); } else { RtUtil.set(owner, o, propName, colType, term.getSchema().isIgnoreUnresolvedFieldOrClass(), term.getValueAdapter()); } } } } public Object endParticle(Object o, QName elementName, ParticleBinding particle) { TermBinding term = particle.getTerm(); if(term.isSkip()) { return o; } boolean trace = log.isTraceEnabled(); if(o instanceof ValueList) { if(trace) log.trace("endParticle " + particle.getTerm() + " valueList"); ValueList valueList = (ValueList)o; o = valueList.getHandler().newInstance(particle, valueList); } else if(o instanceof GenericValueContainer) { try { if(trace) log.trace("endParticle " + elementName + " instantiate()"); o = ((GenericValueContainer)o).instantiate(); } catch(JBossXBRuntimeException e) { throw e; } catch(RuntimeException e) { throw new JBossXBRuntimeException("Container failed to create an instance for " + elementName + ": " + e.getMessage(), e ); } } else if(trace) { log.trace("endParticle " + elementName + " object=" + o + " term=" + term); } ValueAdapter valueAdapter = term.getValueAdapter(); if(valueAdapter != null) o = valueAdapter.cast(o, null); return o; } // Private private Object startElement(Object parent, QName elementName, ParticleBinding particle) { TermBinding term = particle.getTerm(); if(term.isSkip()) { return parent; } boolean trace = log.isTraceEnabled(); if(trace) { log.trace("startElement " + elementName + " parent=" + parent + " term=" + term); } ClassMetaData classMetaData = term.getClassMetaData(); MapEntryMetaData mapEntryMetaData = term.getMapEntryMetaData(); if(term.isElement()) { TypeBinding type = ((ElementBinding)term).getType(); if(type.isSimple() || classMetaData == null && mapEntryMetaData == null && (!type.isStartElementCreatesObject() || Constants.QNAME_ANYTYPE.equals(type.getQName()))) { if(trace) { log.trace("startElement " + elementName + " does not create an object"); } return null; } } // if addMethod is specified, it's probably some collection field // but should not be set as a property. Instead, items are added to it using the addMethod ElementBinding arrayItem = null; if(term.isElement()) { TypeBinding type = ((ElementBinding)term).getType(); if(type.getAttributes().isEmpty()) { ParticleBinding typeParticle = type.getParticle(); ModelGroupBinding modelGroup = (ModelGroupBinding)(typeParticle == null ? null : typeParticle.getTerm()); arrayItem = modelGroup == null ? null : modelGroup.getArrayItem(); // todo refactor later (move it to modelGroup.getArrayItem()?) if(arrayItem != null && (arrayItem.isSkip() || arrayItem.getMapEntryMetaData() != null || arrayItem.getPutMethodMetaData() != null || arrayItem.getAddMethodMetaData() != null )) { arrayItem = null; } } } if(arrayItem != null) { Class wrapperType = null; if(classMetaData != null) { wrapperType = loadClassForTerm(classMetaData.getImpl(), term.getSchema().isIgnoreUnresolvedFieldOrClass(), elementName ); if(GenericValueContainer.class.isAssignableFrom(wrapperType) || Collection.class.isAssignableFrom(wrapperType) || Map.class.isAssignableFrom(wrapperType)) { return newInstance(wrapperType, elementName, term.getSchema().isUseNoArgCtorIfFound()); } } if(wrapperType == null && parent == null) { Class itemType = classForElement(arrayItem, null); if(itemType != null) { if(trace) { log.trace("startElement " + elementName + " new array " + itemType.getName()); } return GenericValueContainer.FACTORY.array(itemType); } } else { PropertyMetaData propertyMetaData = wrapperType == null ? term.getPropertyMetaData() : arrayItem.getPropertyMetaData(); String propName; if(propertyMetaData == null) { propName = Util.xmlNameToFieldName( wrapperType == null ? elementName.getLocalPart() : arrayItem.getQName().getLocalPart(), term.getSchema().isIgnoreLowLine() ); } else { propName = propertyMetaData.getName(); } if(trace) { log.trace("startElement " + elementName + " property=" + propName + " wrapper=" + wrapperType); } Class parentClass = wrapperType; if(wrapperType == null) { if(parent instanceof GenericValueContainer) { parentClass = ((GenericValueContainer)parent).getTargetClass(); } else if(parent instanceof ValueList) { parentClass = ((ValueList)parent).getTargetClass(); } else { parentClass = parent.getClass(); } } Class fieldType = null; if(parentClass.isArray()) { fieldType = parentClass.getComponentType(); } else { //fieldType = FieldInfo.getFieldInfo(parentClass, propName, true).getType(); // this was changed to false because allow overriding of handler.setParent() // with an interceptor.add(). See CollectionOverridePropertyUnitTestCase // In other words, don't treat it as an array wrapper. FieldInfo fieldInfo = FieldInfo.getFieldInfo(parentClass, propName, false); if(fieldInfo != null) { fieldType = fieldInfo.getType(); if (particle.isRepeatable() && fieldType.isArray()) { fieldType = fieldType.getComponentType(); } } else if(((ElementBinding)term).getType().getInterceptors(arrayItem.getQName()).isEmpty() && arrayItem.getInterceptors().isEmpty()) { QName typeName = ((ElementBinding)term).getType().getQName(); throw new JBossXBRuntimeException( "Couldn't apply 'array wrapper' pattern for element " + elementName + " of type " + (typeName == null ? "anonymous" : typeName.toString()) + ": failed to resolve property " + propName + " and no interceptors applied to override handler.setParent(...)"); } } if(fieldType != null) { // TODO: review the logic for cases when wrapperType == null if (fieldType.isArray()) { return GenericValueContainer.FACTORY.array(wrapperType, propName, fieldType.getComponentType()); } else if (Collection.class.isAssignableFrom(fieldType)) { if (wrapperType == null) { return new ValueListInitializer().newValueList(ValueListHandler.FACTORY.child(), Collection.class); //o = new ArrayList(); } } else { return GenericValueContainer.FACTORY.array(wrapperType, propName, fieldType); } } } } Object o = null; if (mapEntryMetaData != null) { if (mapEntryMetaData.getImpl() != null) { Class cls = loadClassForTerm(mapEntryMetaData.getImpl(), term.getSchema().isIgnoreUnresolvedFieldOrClass(), elementName); if (trace) { log.trace("startElement " + elementName + " new map entry " + cls.getName()); } o = newInstance(cls, elementName, term.getSchema().isUseNoArgCtorIfFound()); } else { o = new MapEntry(); if (trace) { log.trace("startElement " + elementName + " new map entry"); } } if (mapEntryMetaData.isNonNullValue() && mapEntryMetaData.getValueType() != null) { Class mapValueType; try { mapValueType = Thread.currentThread().getContextClassLoader().loadClass(mapEntryMetaData.getValueType()); } catch (ClassNotFoundException e) { throw new JBossXBRuntimeException("startElement failed for " + elementName + ": failed to load class " + mapEntryMetaData.getValueType() + " for map entry value."); } Object value; try { if (trace) { log.trace("startElement " + elementName + " map value type " + mapEntryMetaData.getValueType()); } value = mapValueType.newInstance(); } catch (Exception e) { throw new JBossXBRuntimeException("startElement failed for " + elementName + ": failed to create an instance of " + mapValueType + " for map entry value."); } if (o instanceof MapEntry) { ((MapEntry) o).setValue(value); } else { String getValueMethodName = mapEntryMetaData.getGetValueMethod(); if (getValueMethodName == null) { getValueMethodName = "getValue"; } String setValueMethodName = mapEntryMetaData.getSetValueMethod(); if (setValueMethodName == null) { setValueMethodName = "setValue"; } Method getValueMethod; try { getValueMethod = o.getClass().getMethod(getValueMethodName, null); } catch (NoSuchMethodException e) { throw new JBossXBRuntimeException("getValueMethod=" + getValueMethodName + " is not found in map entry " + o.getClass()); } Method setValueMethod; try { setValueMethod = o.getClass().getMethod(setValueMethodName, new Class[]{getValueMethod.getReturnType()}); } catch (NoSuchMethodException e) { throw new JBossXBRuntimeException("setValueMethod=" + setValueMethodName + "(" + getValueMethod.getReturnType().getName() + " value) is not found in map entry " + o.getClass()); } try { setValueMethod.invoke(o, new Object[] {value}); } catch (Exception e) { throw new JBossXBRuntimeException("setValueMethod=" + setValueMethodName + " failed: owner=" + o + ", value=" + value + ", msg=" + e.getMessage(), e); } } } } else { // todo: for now we require metadata for model groups to be bound // todo 2: parent.getClass() is not going to work for containers Class parentClass = null; if (parent != null) { if (parent instanceof GenericValueContainer) { parentClass = ((GenericValueContainer) parent).getTargetClass(); } else if (parent instanceof ValueList) { parentClass = ((ValueList) parent).getTargetClass(); } else { parentClass = parent.getClass(); } } Class cls; if (!term.isElement()) { if (classMetaData == null) throw new JBossXBRuntimeException("Model groups should be annotated with 'class' annotation to be bound."); cls = loadClassForTerm(classMetaData.getImpl(), term.getSchema().isIgnoreUnresolvedFieldOrClass(), elementName); } else { ElementBinding element = (ElementBinding) term; cls = classForNonArrayItem(element, parentClass); if (cls != null) { // todo: before that, the type should be checked for required attributes and elements TypeBinding simpleType = element.getType().getSimpleType(); if (simpleType != null) { Class simpleCls = classForSimpleType(simpleType, element.isNillable()); if (cls.equals(simpleCls) || cls.isPrimitive() && Classes.getPrimitiveWrapper(cls) == simpleCls || simpleCls.isPrimitive() && Classes.getPrimitiveWrapper(simpleCls) == cls) { cls = null; } } } } if (cls != null) { boolean noArgCtor; if (classMetaData == null) { noArgCtor = term.getSchema().isUseNoArgCtorIfFound(); } else { Boolean termUsesNoArgCtor = classMetaData.isUseNoArgCtor(); noArgCtor = termUsesNoArgCtor == null ? term.getSchema().isUseNoArgCtorIfFound() : termUsesNoArgCtor.booleanValue(); } if (trace) { log.trace("startElement " + elementName + " new " + cls.getName() + ", noArgCtor=" + noArgCtor); } o = newInstance(cls, elementName, noArgCtor); } } return o; } private void attributes(Object o, QName elementName, ElementBinding element, Attributes attrs, NamespaceContext nsCtx) { TypeBinding type = element.getType(); for(int i = 0; i < attrs.getLength(); ++i) { QName attrName = new QName(attrs.getURI(i), attrs.getLocalName(i)); AttributeBinding binding = type.getAttribute(attrName); if(binding != null) { AttributeHandler handler = binding.getHandler(); if(handler != null) { Object value = handler.unmarshal(elementName, attrName, binding, nsCtx, attrs.getValue(i)); handler.attribute(elementName, attrName, binding, o, value); } else { throw new JBossXBRuntimeException( "Attribute binding present but has no handler: element=" + elementName + ", attrinute=" + attrName ); } } else { if(!Constants.NS_XML_SCHEMA_INSTANCE.equals(attrs.getURI(i))) { CharactersHandler simpleType = type.getCharactersHandler(); Object value; if(simpleType == null) { value = attrs.getValue(i); RtUtil.set(o, attrName, value, element.getSchema().isIgnoreLowLine()); } } } } } private boolean tryAdd(Object owner, Object o, QName qName, TermBinding term, WildcardBinding wildcard, boolean trace) { AddMethodMetaData addMetaData = wildcard == null ? null : wildcard.getAddMethodMetaData(); if(addMetaData == null) { addMetaData = term.getAddMethodMetaData(); } if(addMetaData == null) { return false; } if(trace) { log.trace("setParent " + qName + " add"); } invokeAdd(qName, addMetaData, owner, o); return true; } private boolean tryPut(Object owner, Object o, QName qName, TermBinding term, boolean trace) { if(term.getPutMethodMetaData() != null || term.getMapEntryMetaData() != null && owner instanceof Map) { if(trace) { log.trace("setParent " + qName + " mapPut"); } invokePut(qName, term, owner, o); return true; } return false; } private Class classForElement(ElementBinding element, Class parentClass) { Class cls; TypeBinding type = element.getType(); QName typeQName = type.getQName(); if(typeQName != null && Constants.NS_XML_SCHEMA.equals(typeQName.getNamespaceURI())) { cls = SimpleTypeBindings.classForType(type.getQName().getLocalPart(), element.isNillable()); } else { ElementBinding arrayItem = null; if(!type.isSimple() && type.getAttributes().isEmpty()) { ParticleBinding typeParticle = type.getParticle(); ModelGroupBinding modelGroup = (ModelGroupBinding)(typeParticle == null ? null : typeParticle.getTerm()); arrayItem = modelGroup == null ? null : modelGroup.getArrayItem(); } if(arrayItem != null) { cls = classForElement(arrayItem, parentClass); // todo: what's the best way to get an array class having the item class cls = Array.newInstance(cls, 0).getClass(); } else { cls = classForNonArrayItem(element, parentClass); } } return cls; } private static void setMapEntryValue(MapEntryMetaData mapEntryMetaData, Object parent, Object o) { String getValueMethodName = mapEntryMetaData.getGetValueMethod(); if(getValueMethodName == null) { getValueMethodName = "getValue"; } String setValueMethodName = mapEntryMetaData.getSetValueMethod(); if(setValueMethodName == null) { setValueMethodName = "setValue"; } Class parentCls = parent.getClass(); Method setValueMethod = getSetMethod(parentCls, getValueMethodName, setValueMethodName); invokeSetter(setValueMethod, parent, o, setValueMethodName); } private static void invokeSetter(Method setValueMethod, Object parent, Object o, String setValueMethodName) { try { setValueMethod.invoke(parent, new Object[]{o}); } catch(Exception e) { throw new JBossXBRuntimeException("Failed to invoke " + setValueMethodName + " on " + parent + " with parameter " + o + ": " + e.getMessage() ); } } private static Method getSetMethod(Class cls, String getMethodName, String setMethodName) { Method getKeyMethod; try { getKeyMethod = cls.getMethod(getMethodName, null); } catch(NoSuchMethodException e) { throw new JBossXBRuntimeException("Method " + getMethodName + " not found in " + cls); } Method setKeyMethod; try { setKeyMethod = cls.getMethod(setMethodName, new Class[]{getKeyMethod.getReturnType()}); } catch(NoSuchMethodException e) { throw new JBossXBRuntimeException("Method " + setMethodName + "(" + getKeyMethod.getReturnType().getName() + " p) not found in " + cls ); } return setKeyMethod; } private static MapEntryMetaData getMapEntryMetaData(TermBinding term, QName qName) { MapEntryMetaData mapEntryMetaData = term.getMapEntryMetaData(); if(mapEntryMetaData == null) { String msg; if(term.isModelGroup()) { msg = "Term " + qName + " bound as map entry key or value but map entry metadata is not available for its parent term."; } else { ElementBinding element = (ElementBinding)term; msg = "Element " + qName + " bound as map entry key or value but map entry metadata is not available for its parent element nor its " + (element.getType().getQName() == null ? "annonymous" : element.getType().getQName().toString() ) + " type."; } throw new JBossXBRuntimeException(msg); } return mapEntryMetaData; } private static Object newInstance(Class cls, QName elementName, boolean useNoArgCtorIfFound) { Object o; if(cls.isArray()) { o = GenericValueContainer.FACTORY.array(cls.getComponentType()); } else { Constructor[] ctors = cls.getConstructors(); if(ctors.length == 0) { throw new JBossXBRuntimeException( "Class " + cls.getName() + " has no public constructors or the class reflects a primitive type or void" ); } if(useNoArgCtorIfFound) { try { Constructor ctor = cls.getConstructor(null); o = ctor.newInstance(null); } catch(NoSuchMethodException e) { o = new ValueListInitializer().newValueList(ValueListHandler.NON_DEFAULT_CTOR, cls); } catch(Exception e) { throw new JBossXBRuntimeException("Failed to create an instance of " + cls + " using default constructor for element " + elementName + ": " + e.getMessage(), e ); } } else if(ctors.length > 1 || ctors[0].getParameterTypes().length > 0) { o = new ValueListInitializer().newValueList(ValueListHandler.NON_DEFAULT_CTOR, cls); } else { try { o = ctors[0].newInstance(null); } catch(Exception e) { throw new JBossXBRuntimeException("Failed to create an instance of " + cls + " using default constructor for element " + elementName + ": " + e.getMessage(), e ); } } } return o; } private static Class loadClassForTerm(String className, boolean ignoreCNFE, QName elementName) { if(className == null) { throw new JBossXBRuntimeException("No class for " + elementName); } Class cls = null; try { cls = Thread.currentThread().getContextClassLoader().loadClass(className); } catch(ClassNotFoundException e) { if(ignoreCNFE) { if(log.isTraceEnabled()) { log.trace("Failed to resolve class for element " + elementName + ": " + className ); } } else { throw new JBossXBRuntimeException("Failed to resolve class name for " + elementName + ": " + e.getMessage() ); } } return cls; } private void invokeAdd(QName qName, AddMethodMetaData addMethodMetaData, Object owner, Object o) { Class valueType = Object.class; if(addMethodMetaData.getValueType() != null) { try { valueType = Thread.currentThread().getContextClassLoader(). loadClass(addMethodMetaData.getValueType()); } catch(ClassNotFoundException e) { throw new JBossXBRuntimeException("Failed to load value type for addMethod.name=" + addMethodMetaData.getMethodName() + ", valueType=" + addMethodMetaData.getValueType() + ": " + e.getMessage(), e ); } } else if(addMethodMetaData.isChildType()) { if(o == null) { throw new JBossXBRuntimeException("addMethod=" + addMethodMetaData.getMethodName() + " for element " + qName + " is configured with valueType='child'. The valueType cannot be determined because" + " the child is null" ); } valueType = o.getClass(); } Class ownerClass = owner.getClass(); Method addMethod; try { addMethod = ownerClass.getMethod(addMethodMetaData.getMethodName(), new Class[]{valueType}); } catch(NoSuchMethodException e) { throw new JBossXBRuntimeException("Failed to find addMethod.name=" + addMethodMetaData.getMethodName() + ", addMethod.valueType=" + valueType.getName() + " in class " + ownerClass.getName() + ": " + e.getMessage(), e ); } try { addMethod.invoke(owner, new Object[]{o}); } catch(Exception e) { throw new JBossXBRuntimeException("setParent failed for " + qName + "=" + o + ": addMethod=" + addMethodMetaData.getMethodName() + " threw an exception for owner=" + owner + ", value=" + o + ": " + e.getMessage(), e ); } } private void invokePut(QName qName, TermBinding term, Object owner, Object o) { PutMethodMetaData putMethodMetaData = term.getPutMethodMetaData(); MapEntryMetaData mapEntryMetaData = term.getMapEntryMetaData(); if(mapEntryMetaData == null) { throw new JBossXBRuntimeException((putMethodMetaData == null ? "Parent object is an instance of java.util.Map" : "putMethod is specified for element " + qName ) + " but mapEntry is specified for neither element " + qName + " nor it's type." ); } Class oClass = o.getClass(); String getKeyMethodName = mapEntryMetaData.getGetKeyMethod(); if(getKeyMethodName == null) { getKeyMethodName = "getKey"; } Method keyMethod; try { keyMethod = oClass.getMethod(getKeyMethodName, null); } catch(NoSuchMethodException e) { throw new JBossXBRuntimeException("setParent failed for " + qName + "=" + o + ": getKeyMethod=" + getKeyMethodName + " not found in " + oClass ); } Object key; try { key = keyMethod.invoke(o, null); } catch(Exception e) { throw new JBossXBRuntimeException("setParent failed for " + qName + "=" + o + ": getKeyMethod=" + getKeyMethodName + " threw an exception: " + e.getMessage(), e ); } Class keyType = Object.class; Class valueType = Object.class; String putMethodName = "put"; Class ownerClass = owner.getClass(); if(putMethodMetaData != null) { if(putMethodMetaData.getKeyType() != null) { try { keyType = Thread.currentThread().getContextClassLoader().loadClass(putMethodMetaData.getKeyType()); } catch(ClassNotFoundException e) { throw new JBossXBRuntimeException("setParent failed for " + qName + ": " + e.getMessage(), e); } } if(putMethodMetaData.getValueType() != null) { try { valueType = Thread.currentThread().getContextClassLoader().loadClass(putMethodMetaData.getValueType()); } catch(ClassNotFoundException e) { throw new JBossXBRuntimeException("setParent failed for " + qName + ": " + e.getMessage(), e); } } String name = putMethodMetaData.getName(); if(name != null) { putMethodName = name; } } Method putMethod; try { putMethod = ownerClass.getMethod(putMethodName, new Class[]{keyType, valueType}); } catch(NoSuchMethodException e) { throw new JBossXBRuntimeException("setParent failed for " + qName + "=" + o + ": putMethod=" + putMethodName + "(" + keyType.getName() + " key, " + valueType.getName() + " value) not found in " + ownerClass ); } Object value = o; String valueMethodName = mapEntryMetaData.getGetValueMethod(); if(valueMethodName != null) { Method valueMethod; try { valueMethod = oClass.getMethod(valueMethodName, null); } catch(NoSuchMethodException e) { throw new JBossXBRuntimeException("setParent failed for " + qName + "=" + o + ": getValueMethod=" + mapEntryMetaData.getGetValueMethod() + " not found in " + oClass ); } try { value = valueMethod.invoke(o, null); } catch(Exception e) { throw new JBossXBRuntimeException("setParent failed for " + qName + "=" + o + ": getValueMethod=" + mapEntryMetaData.getGetValueMethod() + " threw an exception: " + e.getMessage(), e ); } } else if(o instanceof MapEntry) { value = ((MapEntry)o).getValue(); } try { putMethod.invoke(owner, new Object[]{key, value}); } catch(Exception e) { throw new JBossXBRuntimeException("setParent failed for " + qName + "=" + o + ": putMethod=" + putMethodName + " threw an exception for owner=" + owner + ", key=" + key + ", value=" + value + ": " + e.getMessage(), e ); } } private Class classForNonArrayItem(ElementBinding element, Class parentClass) { String clsName; // first, class metadata and map entry metadata ClassMetaData clsMetaData = element.getClassMetaData(); clsName = clsMetaData == null ? null : clsMetaData.getImpl(); if(clsName == null) { MapEntryMetaData mapEntryMetaData = element.getMapEntryMetaData(); if(mapEntryMetaData != null) { clsName = mapEntryMetaData.getImpl(); if(clsName == null) { clsName = MapEntry.class.getName(); } } } // second, property metadata and property type if(clsName == null) { if(parentClass == null) { clsName = classFromQName(element); } else { PropertyMetaData propertyMetaData = element.getPropertyMetaData(); String propName = propertyMetaData == null ? null : propertyMetaData.getName(); if(propName == null) { // if there is add or put method metadata then fallback to XML-name-to-class-name algorithm if(element.getAddMethodMetaData() == null && element.getPutMethodMetaData() == null) { propName = Util.xmlNameToFieldName(element.getQName().getLocalPart(), element.getSchema().isIgnoreLowLine()); } } if(propName != null) { FieldInfo fieldInfo = FieldInfo.getFieldInfo(parentClass, propName, false); Class fieldType = fieldInfo == null ? null : fieldInfo.getType(); if(fieldType == null || Modifier.isAbstract(fieldType.getModifiers()) || Modifier.isInterface(fieldType.getModifiers()) || fieldType.isArray() || Collection.class.isAssignableFrom(fieldType)) { clsName = classFromQName(element); } else { return fieldType; } } } } return loadClassForTerm(clsName, element.getSchema().isIgnoreUnresolvedFieldOrClass(), element.getQName()); } private String classFromQName(ElementBinding element) { String clsName; QName typeBase = element.getType().getQName(); if(typeBase == null) { typeBase = element.getQName(); } SchemaBinding schema = element.getSchema(); PackageMetaData pkgMetaData = schema.getPackageMetaData(); if(pkgMetaData == null) { clsName = Util.xmlNameToClassName(typeBase.getNamespaceURI(), typeBase.getLocalPart(), schema.isIgnoreLowLine() ); } else { String pkg = pkgMetaData.getName(); clsName = pkg == null || pkg.length() == 0 ? Util.xmlNameToClassName(typeBase.getLocalPart(), schema.isIgnoreLowLine()) : pkg + "." + Util.xmlNameToClassName(typeBase.getLocalPart(), schema.isIgnoreLowLine()); } return clsName; } private static Class classForSimpleType(TypeBinding type, boolean nillable) { ValueMetaData valueMetaData = type.getValueMetaData(); if(valueMetaData != null && valueMetaData.getUnmarshalMethod() != null) { return RtUtil.getUnmarshalMethod(type.getQName(), valueMetaData).getReturnType(); } else if(type.getClassMetaData() != null && type.getClassMetaData().getImpl() != null) { return RtUtil.loadClass(type.getClassMetaData().getImpl(), true); } TypeBinding itemType = type.getItemType(); if(itemType != null) { if(type.getSchemaBinding().isUnmarshalListsToArrays()) { // todo: nillable not always should be propagated to the item Class itemClass = classForSimpleType(itemType, nillable); return Array.newInstance(itemClass, 0).getClass(); } else { return java.util.List.class; } } else { QName qName = type.getQName(); if(qName != null && Constants.NS_XML_SCHEMA.equals(qName.getNamespaceURI())) { return SimpleTypeBindings.classForType(qName.getLocalPart(), nillable); } else { TypeBinding baseType = type.getBaseType(); if(baseType == null) { throw new JBossXBRuntimeException("Expected a base type here."); } return classForSimpleType(baseType, nillable); } } } } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl/runtime/MapEntry.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl0000644000175000017500000000531510470642610033260 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling.impl.runtime; import org.jboss.xb.binding.JBossXBRuntimeException; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class MapEntry { private Object key; private Object value; public Object getKey() { return key; } public void setKey(Object key) { if(this.key != null) { throw new JBossXBRuntimeException( "The key is already set: current value=" + this.key + ", overriding value=" + key ); } this.key = key; } public Object getValue() { return value; } public void setValue(Object value) { if(this.value != null) { throw new JBossXBRuntimeException( "The value is already set: current value=" + this.value + ", overriding value=" + value ); } this.value = value; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof MapEntry)) { return false; } final MapEntry mapEntry = (MapEntry)o; if(key != null ? !key.equals(mapEntry.key) : mapEntry.key != null) { return false; } if(value != null ? !value.equals(mapEntry.value) : mapEntry.value != null) { return false; } return true; } public int hashCode() { int result; result = (key != null ? key.hashCode() : 0); result = 29 * result + (value != null ? value.hashCode() : 0); return result; } public String toString() { return "[map-entry key=" + key + ", value=" + value + "]"; } } ././@LongLink0000000000000000000000000000020600000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl/runtime/RtCharactersHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl0000644000175000017500000002320011326305334033251 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling.impl.runtime; import java.lang.reflect.Method; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.Util; import org.jboss.xb.binding.group.ValueList; import org.jboss.xb.binding.metadata.CharactersMetaData; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.sunday.unmarshalling.CharactersHandler; import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding; import org.jboss.util.Classes; /** * @author Alexey Loubyansky * @version $Revision: 3947 $ */ public class RtCharactersHandler extends CharactersHandler { public static final UnmarshalCharactersHandler VALUE_METADATA_UNMARSHAL_HANDLER = new UnmarshalCharactersHandler() { public Object unmarshal(QName name, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { if(valueMetaData == null) throw new JBossXBRuntimeException("The handler expects non-null valueMetaData: element=" + name + ", type=" + typeBinding.getQName() + ", value=" + value); Method unmarshalMethod = RtUtil.getUnmarshalMethod(name, valueMetaData); Object args[] = unmarshalMethod.getParameterTypes().length == 1 ? new Object[]{value} : new Object[]{value, nsCtx}; return RtUtil.invokeUnmarshalMethod(unmarshalMethod, args, name); } }; public static final UnmarshalCharactersHandler RT_UNMARSHAL_HANDLER = new DefaultUnmarshalCharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { Object unmarshalled = null; if (valueMetaData != null) { Method unmarshalMethod = RtUtil.getUnmarshalMethod(qName, valueMetaData); Object args[] = unmarshalMethod.getParameterTypes().length == 1 ? new Object[] {value} : new Object[] {value, nsCtx}; unmarshalled = RtUtil.invokeUnmarshalMethod(unmarshalMethod, args, qName); } else { unmarshalled = super.unmarshal(qName, typeBinding, nsCtx, valueMetaData, value); if (typeBinding.isSimple()) { String clsName = null; boolean failIfNotFound = false; if (typeBinding.getClassMetaData() != null) { clsName = typeBinding.getClassMetaData().getImpl(); failIfNotFound = true; } else { QName typeName = typeBinding.getQName(); if (typeName != null && !Constants.NS_XML_SCHEMA.equals(typeName.getNamespaceURI())) { boolean ignoreLowLine = typeBinding.getSchemaBinding() != null ? typeBinding.getSchemaBinding() .isIgnoreLowLine() : true; clsName = Util.xmlNameToClassName(typeName.getNamespaceURI(), typeName.getLocalPart(), ignoreLowLine); } } Class cls = clsName == null ? null : RtUtil.loadClass(clsName, failIfNotFound); if (cls != null && !cls.isPrimitive()) { // I assume if it doesn't have ctors, there should be static fromValue // method like it is defined for enum types in JAXB2.0 // for java5 cls.isEnum() should be used instead if (cls.getConstructors().length == 0) { Class valueType = unmarshalled.getClass(); // todo: this should be used in combination element.isNillable... if (Classes.isPrimitiveWrapper(valueType)) { valueType = Classes.getPrimitive(valueType); } // it should probably invoke fromValue even if unmarshalled is null unmarshalled = unmarshalled == null ? null : RtUtil.invokeUnmarshalMethod(cls, "fromValue", unmarshalled, valueType, nsCtx, qName); } else { throw new JBossXBRuntimeException("This case is not yet supported (create a feature request): " + "simple type (" + typeBinding.getQName() + ") is bound to a class (" + cls + ") with optional property metadata with " + "default value for the property name 'value'."); } } } } return unmarshalled; } }; public static final RtCharactersHandler INSTANCE = new RtCharactersHandler(); public RtCharactersHandler() { super(RT_UNMARSHAL_HANDLER); } public RtCharactersHandler(UnmarshalCharactersHandler unmarshalHandler) { super(unmarshalHandler); } public void setValue(QName qName, ElementBinding element, Object owner, Object value) { //TODO: assert if type is not null it must simple... if(owner == null) // TODO: owner should never be null { return; } if(owner instanceof ValueList) { ValueList valueList = (ValueList)owner; TypeBinding type = element.getType(); if(type.isSimple()) { valueList.getInitializer().addTermValue(qName, new ParticleBinding(element), // TODO this, valueList, value, null ); } else { valueList.getInitializer().addTextValue(qName, new ParticleBinding(element), this, valueList, value ); } } else if (owner instanceof MapEntry) { TypeBinding type = element.getType(); CharactersMetaData characters = type.getCharactersMetaData(); if (characters != null) { if (characters.isMapEntryKey()) { ((MapEntry) owner).setKey(value); } else if (characters.isMapEntryValue()) { ((MapEntry) owner).setValue(value); } else { throw new JBossXBRuntimeException("Parent object is a map entry but characters of element " + qName + " of type " + type.getQName() + " were bound to niether key nor value in a map entry."); } } else { throw new JBossXBRuntimeException("Parent object is a map entry but characters of element " + qName + " of type " + type.getQName() + " were bound to niether key nor value in a map entry."); } } else { String propName = null; String colType = null; TypeBinding type = element.getType(); if (type != null && !type.isSimple()/* && type.hasSimpleContent()*/) { PropertyMetaData propertyMetaData = type.getPropertyMetaData(); if (propertyMetaData == null) { CharactersMetaData charactersMetaData = type.getCharactersMetaData(); propertyMetaData = charactersMetaData == null ? null : charactersMetaData.getProperty(); } if (propertyMetaData != null) { propName = propertyMetaData.getName(); colType = propertyMetaData.getCollectionType(); } if (propName == null) { propName = type.getSchemaBinding().getSimpleContentProperty(); } } else { PropertyMetaData PropertyMetaData = element.getPropertyMetaData(); if (PropertyMetaData != null) { propName = PropertyMetaData.getName(); colType = PropertyMetaData.getCollectionType(); } if (propName == null) { propName = Util.xmlNameToFieldName(qName.getLocalPart(), element.getSchema().isIgnoreLowLine()); } } RtUtil.set(owner, value, propName, colType, element.getSchema().isIgnoreUnresolvedFieldOrClass(), element .getValueAdapter()); } } } ././@LongLink0000000000000000000000000000020500000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl/runtime/RtAttributeHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl0000644000175000017500000000646110470642610033263 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling.impl.runtime; import javax.xml.namespace.QName; import org.jboss.xb.binding.GenericValueContainer; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.Util; import org.jboss.xb.binding.group.ValueList; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding; import org.jboss.xb.binding.sunday.unmarshalling.AttributeHandler; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class RtAttributeHandler extends AttributeHandler { public static final RtAttributeHandler INSTANCE = new RtAttributeHandler(); public void attribute(QName elemName, QName attrName, AttributeBinding binding, Object owner, Object value) { if(owner instanceof MapEntry) { if(binding.isMapEntryKey()) { ((MapEntry)owner).setKey(value); } else if(binding.isMapEntryValue()) { ((MapEntry)owner).setValue(value); } else { throw new JBossXBRuntimeException( "Parent object is a map entry but attribute " + attrName + " in element " + elemName + " bound to neither key nor value in a map entry." ); } } else if(owner instanceof GenericValueContainer) { ((GenericValueContainer)owner).addChild(attrName, value); } else if(owner instanceof ValueList) { ValueList valueList = (ValueList)owner; valueList.getInitializer().addAttributeValue(attrName, binding, valueList, value); } else { String property = null; PropertyMetaData propertyMetaData = binding.getPropertyMetaData(); if(propertyMetaData != null) { property = propertyMetaData.getName(); } if(property == null) { property = Util.xmlNameToFieldName(attrName.getLocalPart(), binding.getSchema().isIgnoreLowLine()); } RtUtil.set(owner, value, property, null, binding.getSchema().isIgnoreUnresolvedFieldOrClass(), binding.getValueAdapter()); } } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl/runtime/RtUtil.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/impl0000644000175000017500000002745611061473704033275 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling.impl.runtime; import java.lang.reflect.Array; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.jboss.util.Classes; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.Util; import org.jboss.xb.binding.introspection.FieldInfo; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; /** * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class RtUtil { private RtUtil() { } public static void add(Object o, Object value, String prop, String colType, boolean ignoreNotFoundField, ValueAdapter valueAdapter) { FieldInfo fieldInfo = FieldInfo.getFieldInfo(o.getClass(), prop, !ignoreNotFoundField); if(fieldInfo == null) { return; } Class fieldType = fieldInfo.getType(); boolean arrType; if(fieldType.isArray()) { arrType = true; } else if(Collection.class.isAssignableFrom(fieldType)) { arrType = false; } else { throw new JBossXBRuntimeException( "Expected type for " + prop + " in " + o.getClass() + " is an array or java.util.Collection but was " + fieldType ); } if(valueAdapter != null) { value = valueAdapter.cast(value, fieldType); } if(!arrType || colType != null) { Collection col = (Collection)fieldInfo.getValue(o); if(col == null) { if(colType == null) { col = new ArrayList(); } else { Class colCls; try { colCls = Thread.currentThread().getContextClassLoader().loadClass(colType); } catch(ClassNotFoundException e) { throw new JBossXBRuntimeException("Failed to load collection type: " + colType); } try { col = (Collection)colCls.newInstance(); } catch(Exception e) { throw new JBossXBRuntimeException("Failed to create an instance of " + colCls); } } fieldInfo.setValue(o, col); } col.add(value); } else { Object arr = fieldInfo.getValue(o); int length = 0; if(arr == null) { arr = Array.newInstance(fieldType.getComponentType(), 1); } else { Object tmp = arr; length = Array.getLength(arr); arr = Array.newInstance(fieldType.getComponentType(), length + 1); System.arraycopy(tmp, 0, arr, 0, length); //System.out.println("copied array (1)"); } Array.set(arr, length, value); fieldInfo.setValue(o, arr); } } public static void set(Object o, Object value, String prop, String colType, boolean ignoreNotFoundField, ValueAdapter valueAdapter) { FieldInfo fieldInfo = FieldInfo.getFieldInfo(o.getClass(), prop, !ignoreNotFoundField); if(fieldInfo == null) { return; } Class fieldType = fieldInfo.getType(); if(valueAdapter != null) { value = valueAdapter.cast(value, fieldType); } if(Collection.class.isAssignableFrom(fieldType) && !Collection.class.isAssignableFrom(value.getClass())) { Collection col = (Collection)fieldInfo.getValue(o); if(col == null) { if(colType == null) { col = new ArrayList(); } else { Class colCls; try { colCls = Thread.currentThread().getContextClassLoader().loadClass(colType); } catch(ClassNotFoundException e) { throw new JBossXBRuntimeException("Failed to load collection type: " + colType); } try { col = (Collection)colCls.newInstance(); } catch(Exception e) { throw new JBossXBRuntimeException("Failed to create an instance of " + colCls); } } fieldInfo.setValue(o, col); } //System.out.println("col.add(value): " + prop + "=" + value); col.add(value); } /* else if(fieldType.isArray() && value != null && (fieldType.getComponentType().isAssignableFrom(value.getClass()) || fieldType.getComponentType().isPrimitive() && Classes.getPrimitiveWrapper(fieldType.getComponentType()) == value.getClass() )) { Object arr = fieldInfo.getValue(o); int length = 0; if(arr == null) { arr = Array.newInstance(fieldType.getComponentType(), 1); } else { Object tmp = arr; length = Array.getLength(arr); arr = Array.newInstance(fieldType.getComponentType(), length + 1); System.arraycopy(tmp, 0, arr, 0, length); throw new JBossXBRuntimeException("copied array (2)"); } Array.set(arr, length, value); fieldInfo.setValue(o, arr); } */ else { // todo: unmarshalling should produce the right type instead Class valueClass = value == null ? null : value.getClass(); if (valueClass != null && fieldType.isArray() && Collection.class.isAssignableFrom(valueClass)) { Collection col = (Collection) value; Class compType = fieldType.getComponentType(); value = Array.newInstance(compType, col.size()); if (compType.isPrimitive()) { int i = 0; for (Iterator iter = col.iterator(); iter.hasNext();) { Array.set(value, i++, iter.next()); } } else { value = col.toArray((Object[]) value); } } fieldInfo.setValue(o, value); } } public static void set(Object o, QName elementName, Object value, boolean ignoreLowLine) { if(o instanceof Collection) { ((Collection)o).add(value); } else { String fieldName = Util.xmlNameToFieldName(elementName.getLocalPart(), ignoreLowLine); FieldInfo fieldInfo = FieldInfo.getFieldInfo(o.getClass(), fieldName, true); fieldInfo.setValue(o, value); } } public static Class loadClass(String clsName, boolean failIfNotFound) { Class cls = null; try { cls = Classes.loadClass(clsName); } catch(ClassNotFoundException e) { if(failIfNotFound) { throw new JBossXBRuntimeException("Failed to load class " + clsName); } } return cls; } public static Method getUnmarshalMethod(QName qName, ValueMetaData valueMetaData) { String unmarshalMethod = valueMetaData.getUnmarshalMethod(); if(unmarshalMethod == null) { throw new JBossXBRuntimeException( "javaType annotation is specified for " + qName + " but does not contain parseMethod attribute" ); } int lastDot = unmarshalMethod.lastIndexOf('.'); String clsName = unmarshalMethod.substring(0, lastDot); String methodName = unmarshalMethod.substring(lastDot + 1); Class cls = RtUtil.loadClass(clsName, true); try { return cls.getMethod(methodName, new Class[]{String.class}); } catch(NoSuchMethodException e) { try { return cls.getMethod(methodName, new Class[]{String.class, NamespaceContext.class}); } catch(NoSuchMethodException e1) { throw new JBossXBRuntimeException("Neither " + methodName + "(" + String.class.getName() + " p) nor " + methodName + "(" + String.class.getName() + " p1, " + NamespaceContext.class.getName() + " p2) were found in " + cls ); } } } public static Object invokeUnmarshalMethod(Class cls, String methodName, Object value, Class valueType, NamespaceContext nsCtx, QName qName) { Method method; Object[] args; try { method = cls.getMethod(methodName, new Class[]{valueType}); args = new Object[]{value}; } catch(NoSuchMethodException e) { try { method = cls.getMethod(methodName, new Class[]{valueType, NamespaceContext.class}); args = new Object[]{value, nsCtx}; } catch(NoSuchMethodException e1) { throw new JBossXBRuntimeException("Neither " + methodName + "(" + valueType.getName() + " p) nor " + methodName + "(" + valueType.getName() + " p1, " + NamespaceContext.class.getName() + " p2) were found in " + cls ); } } return invokeUnmarshalMethod(method, args, qName); } public static Object invokeUnmarshalMethod(Method method, Object[] args, QName qName) { Object unmarshalled; try { unmarshalled = method.invoke(null, args); } catch(Exception e) { throw new JBossXBRuntimeException("Failed to invoke unmarshalMethod " + method.getDeclaringClass().getName() + "." + method.getName() + " for element " + qName + " and value " + args[0] + ": " + e.getMessage(), e ); } return unmarshalled; } } ././@LongLink0000000000000000000000000000017200000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SundayContentHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Sund0000644000175000017500000002747511453330564033247 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.lang.reflect.Method; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.xb.binding.AttributesImpl; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.NamespaceRegistry; import org.jboss.xb.binding.Util; import org.jboss.xb.binding.introspection.FieldInfo; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.parser.JBossXBParser; import org.jboss.xb.binding.resolver.MutableSchemaResolver; import org.xml.sax.Attributes; /** * Default ContentHandler * * @author Alexey Loubyansky * @version $Revision: 4858 $ */ public class SundayContentHandler implements JBossXBParser.DtdAwareContentHandler, PositionStack { private static Logger log; public final static Object NIL = new Object(); private final SchemaBindingResolver schemaResolver; private final SchemaBinding schema; private AbstractPosition head; // DTD information frm startDTD private String dtdRootName; private String dtdPublicId; private String dtdSystemId; private boolean sawDTD; private UnmarshallingContextImpl ctx; private NamespaceRegistry nsRegistry = new NamespaceRegistry(); public SundayContentHandler(SchemaBinding schema) { this.schema = schema; this.schemaResolver = null; AbstractPosition.resetTrace(); } public SundayContentHandler(SchemaBindingResolver schemaResolver) { this.schemaResolver = schemaResolver; this.schema = null; AbstractPosition.resetTrace(); } public void startDTD(String dtdRootName, String dtdPublicId, String dtdSystemId) { this.dtdRootName = dtdRootName; this.dtdPublicId = dtdPublicId; this.dtdSystemId = dtdSystemId; } public void endDTD() { this.sawDTD = true; } public void characters(char[] ch, int start, int length) { if(!head.isElement()) return; AbstractPosition position = head; // if current is ended the characters belong to its parent if(position.isEnded()) { position = position.getPrevious(); while(!position.isElement()) position = position.getPrevious(); } position.characters(ch, start, length); } public void endElement(String namespaceURI, String localName, String qName) { while(head != null) { if(head.isElement()) { if(!head.isEnded()) { QName elementQName = head.getParticle().getTerm().getQName(); QName endName = localName.length() == 0 ? new QName(qName) : new QName(namespaceURI, localName); if(!elementQName.equals(endName)) { throw new JBossXBRuntimeException("Failed to end element " + new QName(namespaceURI, localName) + ": element on the stack is " + elementQName ); } head.endParticle(); break; } // assert head.isEnded() == true if(head.getRepeatableParticleValue() != null) head.endRepeatableParticle(); } else { head.endParticle(); } head = head.getPrevious(); } if(head == null) throw new JBossXBRuntimeException("Failed to endElement " + qName + ": binding not found"); } public void startElement(String namespaceURI, String localName, String qName, Attributes atts) { QName startName = localName.length() == 0 ? new QName(qName) : new QName(namespaceURI, localName); SchemaBinding schemaBinding = schema; atts = preprocessAttributes(atts); if(head == null) { ParticleBinding particle = null; if(schemaBinding != null) particle = schemaBinding.getElementParticle(startName); if(particle == null && schemaResolver != null) { String schemaLocation = atts == null ? null : Util.getSchemaLocation(atts, namespaceURI); // Use the dtd info if it exists and there is no schemaLocation if(schemaLocation == null || schemaLocation.length() == 0) { if(sawDTD) schemaLocation = dtdSystemId; // If there is still no schemaLocation and no namespaceURI, pass in the root local name // if the namespace is not null then schemaLocation should be left null and resolved by EntityResolver if(schemaLocation == null && (namespaceURI == null || namespaceURI.length() == 0)) schemaLocation = localName; } schemaBinding = schemaResolver.resolve(namespaceURI, localName, schemaLocation); if(schemaBinding != null) particle = schemaBinding.getElementParticle(startName); else throw new JBossXBRuntimeException("Failed to resolve schema binding for QName " + startName + " with schemaLocation=" + schemaLocation); } if(particle == null) { StringBuffer sb = new StringBuffer(); sb.append("Failed to resolve global element binding "); sb.append(startName); if(schemaBinding == null && schemaResolver == null) sb.append(". Neither SchemaBinding nor SchemaBindingResolver are available."); throw new JBossXBRuntimeException(sb.toString()); } ElementPosition next = new ElementPosition(startName, particle); next.setStack(this); next.push(atts); head = next; return; } while (head != null) { ElementPosition next = head.startParticle(startName, atts); if (next != null) { next.push(atts); head = next; break; } head = head.getPrevious(); } } public void startPrefixMapping(String prefix, String uri) { nsRegistry.addPrefixMapping(prefix, uri); } public void endPrefixMapping(String prefix) { nsRegistry.removePrefixMapping(prefix); } public void processingInstruction(String target, String data) { } public Object getRoot() { if(head.getPrevious() != null) throw new IllegalStateException("The stack still contains positions!"); Object root = head.getValue(); head = null; nsRegistry = null; if (sawDTD) { // Probably should be integrated into schema binding? try { // setDTD(String root, String publicId, String systemId) Class[] sig = {String.class, String.class, String.class}; Method setDTD = root.getClass().getMethod("setDTD", sig); Object[] args = {dtdRootName, dtdPublicId, dtdSystemId}; setDTD.invoke(root, args); } catch (Exception e) { if(log == null) log = Logger.getLogger(SundayContentHandler.class); if(log.isTraceEnabled()) log.trace("No setDTD found on root: " + root); } } return root; } // Private private Attributes preprocessAttributes(Attributes attrs) { SchemaBindingResolver resolver = schemaResolver == null ? schema.getSchemaResolver() : schemaResolver; if(resolver == null || !(resolver instanceof MutableSchemaResolver)) return attrs; String value = attrs.getValue(Constants.NS_JBXB, "schemabinding"); if (value != null) { MutableSchemaResolver defaultResolver = (MutableSchemaResolver)resolver; java.util.StringTokenizer tokenizer = new java.util.StringTokenizer(value); while(tokenizer.hasMoreTokens()) { String uri = tokenizer.nextToken(); if(!tokenizer.hasMoreTokens()) throw new JBossXBRuntimeException("jbxb:schemabinding attribute value is invalid: ns uri '" + uri + "' is missing value in '" + value + "'"); String cls = tokenizer.nextToken(); try { defaultResolver.mapURIToClass(uri, cls); } catch (Exception e) { throw new JBossXBRuntimeException("Failed to addClassBinding: uri='" + uri + "', class='" + cls + "'", e); } } AttributesImpl attrsImpl = new AttributesImpl(attrs.getLength() - 1); for(int i = 0; i < attrs.getLength(); ++i) { if(!attrs.getURI(i).equals(Constants.NS_JBXB)) attrsImpl.add(attrs.getURI(i), attrs.getLocalName(i), attrs.getQName(i), attrs.getType(i), attrs.getValue(i)); } attrs = attrsImpl; } return attrs; } public UnmarshallingContextImpl getContext() { if(ctx == null) ctx = new UnmarshallingContextImpl(); return ctx; } public NamespaceRegistry getNamespaceRegistry() { return nsRegistry; } // Inner public static class UnmarshallingContextImpl implements UnmarshallingContext { public Object parent; public ParticleBinding particle; public ParticleBinding parentParticle; public Object getParentValue() { return parent; } public ParticleBinding getParticle() { return particle; } public ParticleBinding getParentParticle() { return parentParticle; } public String resolvePropertyName() { TermBinding term = particle.getTerm(); PropertyMetaData propertyMetaData = term.getPropertyMetaData(); String prop = propertyMetaData == null ? null : propertyMetaData.getName(); if(prop != null) { return prop; } if(term.isElement()) { QName name = ((ElementBinding)term).getQName(); prop = Util.xmlNameToFieldName(name.getLocalPart(), term.getSchema().isIgnoreLowLine()); } return prop; } public Class resolvePropertyType() { if(parent == null) { return null; } String prop = resolvePropertyName(); if(prop != null) { FieldInfo fieldInfo = FieldInfo.getFieldInfo(parent.getClass(), prop, false); if (fieldInfo != null) { return fieldInfo.getType(); } } return null; } // private public void clear() { parent = null; particle = null; parentParticle = null; } } } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/TermBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Term0000755000175000017500000001357011334317667033246 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.metadata.ClassMetaData; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.metadata.MapEntryMetaData; import org.jboss.xb.binding.metadata.PutMethodMetaData; import org.jboss.xb.binding.metadata.AddMethodMetaData; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.sunday.marshalling.TermBeforeMarshallingCallback; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 4018 $ */ public abstract class TermBinding { protected SchemaBinding schema; protected QName qName; protected ClassMetaData classMetaData; protected PropertyMetaData propertyMetaData; protected MapEntryMetaData mapEntryMetaData; protected PutMethodMetaData putMethodMetaData; protected AddMethodMetaData addMethodMetaData; protected ValueMetaData valueMetaData; protected boolean mapEntryKey; protected boolean mapEntryValue; protected int skip; protected ValueAdapter valueAdapter; protected TermBeforeMarshallingCallback beforeMarshallingCallback; protected TermBeforeSetParentCallback beforeSetParentCallback; protected RepeatableParticleHandler repeatableHandler = DefaultHandlers.REPEATABLE_HANDLER; protected ParticleHandler handler; protected TermBinding(SchemaBinding schema) { this.schema = schema; } protected TermBinding() { } public QName getQName() { return this.qName; } public void setQName(QName name) { qName = name; } public ClassMetaData getClassMetaData() { return classMetaData; } public void setClassMetaData(ClassMetaData classMetaData) { this.classMetaData = classMetaData; } public PropertyMetaData getPropertyMetaData() { return propertyMetaData; } public void setPropertyMetaData(PropertyMetaData propertyMetaData) { this.propertyMetaData = propertyMetaData; } public MapEntryMetaData getMapEntryMetaData() { return mapEntryMetaData; } public void setMapEntryMetaData(MapEntryMetaData mapEntryMetaData) { this.mapEntryMetaData = mapEntryMetaData; } public PutMethodMetaData getPutMethodMetaData() { return putMethodMetaData; } public void setPutMethodMetaData(PutMethodMetaData putMethodMetaData) { this.putMethodMetaData = putMethodMetaData; } public AddMethodMetaData getAddMethodMetaData() { return addMethodMetaData; } public void setAddMethodMetaData(AddMethodMetaData addMethodMetaData) { this.addMethodMetaData = addMethodMetaData; } public ValueMetaData getValueMetaData() { return valueMetaData; } public void setValueMetaData(ValueMetaData valueMetaData) { this.valueMetaData = valueMetaData; } public boolean isMapEntryKey() { return mapEntryKey; } public void setMapEntryKey(boolean mapEntryKey) { this.mapEntryKey = mapEntryKey; } public boolean isMapEntryValue() { return mapEntryValue; } public void setMapEntryValue(boolean mapEntryValue) { this.mapEntryValue = mapEntryValue; } public abstract boolean isSkip(); public void setSkip(boolean skip) { this.skip = skip ? Constants.TRUE : Constants.FALSE; } public ValueAdapter getValueAdapter() { return valueAdapter; } public void setValueAdapter(ValueAdapter valueAdapter) { this.valueAdapter = valueAdapter; } public SchemaBinding getSchema() { return schema; } public abstract boolean isModelGroup(); public abstract boolean isWildcard(); public abstract boolean isElement(); public void setBeforeMarshallingCallback(TermBeforeMarshallingCallback marshallingHandler) { this.beforeMarshallingCallback = marshallingHandler; } public TermBeforeMarshallingCallback getBeforeMarshallingCallback() { return beforeMarshallingCallback; } public void setBeforeSetParentCallback(TermBeforeSetParentCallback beforeSetParent) { this.beforeSetParentCallback = beforeSetParent; } public TermBeforeSetParentCallback getBeforeSetParentCallback() { return beforeSetParentCallback; } public ParticleHandler getHandler() { return handler; } public void setHandler(ParticleHandler handler) { this.handler = handler; } public RepeatableParticleHandler getRepeatableHandler() { return repeatableHandler; } public void setRepeatableHandler(RepeatableParticleHandler repeatableHandler) { this.repeatableHandler = repeatableHandler; } public abstract AbstractPosition newPosition(QName qName, Attributes attrs, ParticleBinding particle); } ././@LongLink0000000000000000000000000000016700000000000011571 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/CharactersHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Char0000644000175000017500000001435411326305334033177 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.List; import java.lang.reflect.Array; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.SimpleTypeBindings; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.metadata.ValueMetaData; /** * @author Alexey Loubyansky * @version $Revision: 3947 $ */ public abstract class CharactersHandler { public static CharactersHandler NOOP = new CharactersHandler() { public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { return value; } }; public static CharactersHandler DEFAULT = new CharactersHandler() { }; protected UnmarshalCharactersHandler unmarshalHandler = DEFAULT_UNMARSHAL_HANDLER; public CharactersHandler() { } public CharactersHandler(UnmarshalCharactersHandler unmarshalHandler) { this.unmarshalHandler = unmarshalHandler; } public Object unmarshalEmpty(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData) { if(typeBinding.isIgnoreEmptyString()) return null; Object result = ""; QName typeQName = typeBinding.getQName(); if(Constants.QNAME_BASE64BINARY.equals(typeQName)) { result = new byte[0]; } else if(Constants.QNAME_BOOLEAN.equals(typeQName)) {// this should be an error but this hack is still here // for backwards compatibility in handling empty elements bound to boolean types result = null; } return result; } public Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { return unmarshalHandler.unmarshal(qName, typeBinding, nsCtx, valueMetaData, value); } public void setValue(QName qName, ElementBinding element, Object owner, Object value) { } public static interface UnmarshalCharactersHandler { Object unmarshal(QName qName, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value); } public static class DefaultUnmarshalCharactersHandler implements UnmarshalCharactersHandler { public Object unmarshal(QName name, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { Object o; QName typeQName = typeBinding.getQName(); TypeBinding itemType = typeBinding.getItemType(); if(itemType != null) { QName itemTypeQName = itemType.getQName(); ValueAdapter adapter = itemType.getValueAdapter(); if(itemTypeQName == null || !Constants.NS_XML_SCHEMA.equals(itemTypeQName.getNamespaceURI())) { if(adapter == null) throw new JBossXBRuntimeException( "Only list types with item type from " + Constants.NS_XML_SCHEMA + " namespace are supported currently." ); else itemTypeQName = Constants.QNAME_STRING; } if(adapter == null) adapter = ValueAdapter.NOOP; List list = SimpleTypeBindings.unmarshalList(itemTypeQName.getLocalPart(), value, nsCtx, adapter); if (typeBinding.getSchemaBinding().isUnmarshalListsToArrays()) { if (list.isEmpty()) { Class compType = SimpleTypeBindings.classForType(itemTypeQName.getLocalPart(), true); o = Array.newInstance(compType, 0); } else { Class compType = list.get(0).getClass(); o = list.toArray((Object[]) Array.newInstance(compType, list.size())); } } else { o = list; } } else if(typeQName != null && Constants.NS_XML_SCHEMA.equals(typeQName.getNamespaceURI())) { try { o = SimpleTypeBindings.unmarshal(typeQName.getLocalPart(), value, nsCtx); } catch (IllegalStateException e) { throw new JBossXBRuntimeException("Characters are not allowed here", e); } } else { TypeBinding baseType = typeBinding.getBaseType(); o = (baseType == null ? value : unmarshal(name, baseType, nsCtx, valueMetaData, value)); } return o; } } public static final UnmarshalCharactersHandler NOOP_UNMARSHAL_HANDLER = new UnmarshalCharactersHandler() { public Object unmarshal(QName name, TypeBinding typeBinding, NamespaceContext nsCtx, ValueMetaData valueMetaData, String value) { return value; } }; public static final UnmarshalCharactersHandler DEFAULT_UNMARSHAL_HANDLER = new DefaultUnmarshalCharactersHandler(); } ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ChoiceBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Choi0000755000175000017500000001013211335111240033164 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.Collections; import java.util.List; import java.util.ArrayList; import java.util.Collection; import javax.xml.namespace.QName; import org.xml.sax.Attributes; /** * @author Alexey Loubyansky * @version $Revision: 4033 $ */ public class ChoiceBinding extends ModelGroupBinding { private List choices = Collections.emptyList(); public ChoiceBinding(SchemaBinding schema) { super(schema); } public ElementBinding getArrayItem() { return null; } public void addParticle(ParticleBinding particle) { switch(choices.size()) { case 0: choices = Collections.singletonList(particle); break; case 1: choices = new ArrayList(choices); default: choices.add(particle); } super.addParticle(particle); } public Collection getParticles() { return choices; } public AbstractPosition newPosition(QName qName, Attributes attrs, ParticleBinding choiceParticle) { for(int i = 0; i < choices.size(); ++i) { ParticleBinding particle = (ParticleBinding)choices.get(i); AbstractPosition next = particle.getTerm().newPosition(qName, attrs, particle); if(next != null) return new ChoicePosition(qName, choiceParticle, next); } return null; } @Override public String getGroupType() { return "choice"; } private final class ChoicePosition extends NonElementPosition { private ChoicePosition(QName name, ParticleBinding particle, AbstractPosition next) { super(name, particle, next); } public AbstractPosition nextPosition(QName qName, Attributes atts) { if(trace) { StringBuffer sb = new StringBuffer(); sb.append("startElement ").append(qName).append(" in ").append(ChoiceBinding.this.toString()); log.trace(sb.toString()); } if (particle.isOccurrenceAllowed(occurrence + 1)) { for (int i = 0; i < choices.size(); ++i) { ParticleBinding choice = (ParticleBinding) choices.get(i); TermBinding term = choice.getTerm(); next = term.newPosition(qName, atts, choice); if (next != null) { next.previous = this; ++occurrence; if(!skip) { o = handler.endParticle(o, qName, particle); if (previous.o != null) setParent(previous, handler); initValue(atts); } if (trace) log.trace("found " + qName + " in " + ChoiceBinding.this + ", term=" + choice.getTerm()); return this; } } } nextNotFound(); return null; } } } ././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AttributeBinding.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Attr0000644000175000017500000001171611042106731033226 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.QName; import org.jboss.xb.binding.metadata.PropertyMetaData; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.sunday.marshalling.AttributeMarshaller; import org.jboss.xb.binding.sunday.marshalling.DefaultAttributeMarshaller; /** * @author Alexey Loubyansky * @version $Revision: 2888 $ */ public class AttributeBinding { private final SchemaBinding schema; private final QName qName; private final TypeBinding type; private AttributeHandler handler; private AttributeMarshaller marshaller = DefaultAttributeMarshaller.INSTANCE; private PropertyMetaData propertyMetaData; private ValueMetaData valueMetaData; /** The default="value" constraint for the attribute */ private String defaultConstraint; private boolean mapEntryKey; private boolean mapEntryValue; private ValueAdapter valueAdapter; private boolean required; protected Boolean normalizeSpace; public AttributeBinding(SchemaBinding schema, QName qName, TypeBinding type, AttributeHandler handler) { if(qName == null) { throw new JBossXBRuntimeException("Each attribute should have a non-null QName!"); } if(type == null || !type.isSimple() && type.getValueAdapter() == ValueAdapter.NOOP) throw new JBossXBRuntimeException("The type of the attribute " + qName + " must be simple or complex with a value adapter: " + type); this.schema = schema; this.qName = qName; this.type = type; this.handler = handler; } public QName getQName() { return qName; } public TypeBinding getType() { return type; } public AttributeHandler getHandler() { return handler; } public void setHandler(AttributeHandler handler) { this.handler = handler; } public AttributeMarshaller getMarshaller() { return marshaller; } public void setMarshaller(AttributeMarshaller marshaller) { this.marshaller = marshaller; } public PropertyMetaData getPropertyMetaData() { return propertyMetaData; } public void setPropertyMetaData(PropertyMetaData propertyMetaData) { this.propertyMetaData = propertyMetaData; } public ValueMetaData getValueMetaData() { return valueMetaData != null ? valueMetaData : type.getValueMetaData(); } public void setValueMetaData(ValueMetaData valueMetaData) { this.valueMetaData = valueMetaData; } public void setMapEntryKey(boolean mapEntryKey) { this.mapEntryKey = mapEntryKey; } public boolean isMapEntryKey() { return mapEntryKey; } public boolean isMapEntryValue() { return mapEntryValue; } public void setMapEntryValue(boolean mapEntryValue) { this.mapEntryValue = mapEntryValue; } public String getDefaultConstraint() { return defaultConstraint; } public void setDefaultConstraint(String value) { defaultConstraint = value; } public SchemaBinding getSchema() { return schema; } public ValueAdapter getValueAdapter() { return valueAdapter == null ? type.getValueAdapter() : valueAdapter; } public void setValueAdapter(ValueAdapter valueAdapter) { this.valueAdapter = valueAdapter; } public String toString() { return super.toString() + "[" + qName + "]"; } public void setRequired(boolean required) { this.required = required; } public boolean getRequired() { return required; } public void setNormalizeSpace(Boolean value) { this.normalizeSpace = value; } public boolean isNormalizeSpace() { if(normalizeSpace != null) return normalizeSpace.booleanValue(); return schema == null ? true : schema.isNormalizeSpace(); } } ././@LongLink0000000000000000000000000000017100000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AnyAttributeHandler.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/AnyA0000755000175000017500000000327611075435045033162 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; /** * A AnyAttributeHandler. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public abstract class AnyAttributeHandler { public Object unmarshal(QName elemName, QName attrName, AnyAttributeBinding binding, NamespaceContext nsCtx, String value) { if(value != null && binding.isNormalizeSpace()) value = value.trim(); return value; } public abstract void attribute(QName elemName, QName attrName, AnyAttributeBinding binding, Object owner, Object value); } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/ElementPosition.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Elem0000644000175000017500000005127211357571642033217 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import java.util.Collections; import java.util.List; import javax.xml.namespace.QName; import org.jboss.util.StringPropertyReplacer; import org.jboss.xb.binding.Constants; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.NamespaceRegistry; import org.jboss.xb.binding.metadata.CharactersMetaData; import org.jboss.xb.binding.metadata.ValueMetaData; import org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.UnmarshallingContextImpl; import org.jboss.xb.binding.sunday.xop.XOPIncludeHandler; import org.xml.sax.Attributes; /** * A ElementPosition. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public class ElementPosition extends AbstractPosition { private TypeBinding type; private ParticleBinding nonXsiParticle; private boolean ignoreCharacters; private StringBuffer textContent; private Boolean indentation; private boolean ignorableCharacters = true; private Object[] interceptorObjects; public ElementPosition(QName qName, ParticleBinding particle) { super(qName, particle); type = ((ElementBinding)term).getType(); } public boolean isElement() { return true; } public void reset() { if(!ended) throw new JBossXBRuntimeException("Attempt to reset a particle that has already been reset: " + term); ended = false; o = null; if(textContent != null) textContent.setLength(0); indentation = null; ignorableCharacters = true; if(nonXsiParticle != null) { particle = nonXsiParticle; term = particle.getTerm(); type = ((ElementBinding)term).getType(); } } public ParticleBinding getNonXsiParticle() { return nonXsiParticle; } public void setNonXsiParticle(ParticleBinding nonXsiParticle) { this.nonXsiParticle = nonXsiParticle; } public boolean isIgnoreCharacters() { return ignoreCharacters; } public void setIgnoreCharacters(boolean ignoreCharacters) { this.ignoreCharacters = ignoreCharacters; } public StringBuffer getTextContent() { return this.textContent; } public AbstractPosition nextPosition(QName startName, Attributes atts) { if (ended) // this is about repeating itself { if (!qName.equals(startName)) { if (repeatableParticleValue != null) endRepeatableParticle(); return null; } if (particle.isRepeatable()) { if (particle.isOccurrenceAllowed(occurrence + 1)) { reset(); ++occurrence; return this; } else if (repeatableParticleValue != null) endRepeatableParticle(); return null; } // it's not repeatable but it re-appeared // it probably has a repeatable parent reset(); previous.repeatForChild(atts); occurrence = 1; if(next != null) { next.previous = null; next = null; } return this; } // this is locating the next child ParticleBinding typeParticle = type.getParticle(); ModelGroupBinding modelGroup = typeParticle == null ? null : (ModelGroupBinding) typeParticle.getTerm(); if (modelGroup == null) { if (startName.equals(Constants.QNAME_XOP_INCLUDE)) { SchemaBinding schema = term.getSchema(); TypeBinding anyUriType = schema.getType(Constants.QNAME_ANYURI); if (anyUriType == null) log.warn("Type " + Constants.QNAME_ANYURI + " not bound."); ElementBinding element = (ElementBinding) term; element.setXopUnmarshaller(schema.getXopUnmarshaller()); flushIgnorableCharacters(); handler = DefaultHandlers.XOP_HANDLER; ignoreCharacters = true; initValue(null); TypeBinding xopIncludeType = new TypeBinding(new QName(Constants.NS_XOP_INCLUDE, "Include")); xopIncludeType.setSchemaBinding(schema); xopIncludeType.addAttribute(new QName("href"), anyUriType, DefaultHandlers.ATTRIBUTE_HANDLER); xopIncludeType.setHandler(new XOPIncludeHandler(type, schema.getXopUnmarshaller())); ElementBinding xopInclude = new ElementBinding(schema, Constants.QNAME_XOP_INCLUDE, xopIncludeType); next = new ElementPosition(startName, new ParticleBinding(xopInclude)); next.stack = stack; next.previous = this; next.notSkippedParent = getLastNotSkipped(); return next; } QName typeName = type.getQName(); throw new JBossXBRuntimeException((typeName == null ? "Anonymous" : typeName.toString()) + " type of element " + qName + " should be complex and contain " + startName + " as a child element."); } if (next != null) { // this increase is actually ahead of its time, it may fail to locate the element // but in the current impl it doesn't matter if (!particle.isOccurrenceAllowed(++occurrence)) throw new JBossXBRuntimeException(startName + " cannot appear in this position. Expected content of " + qName + " is " + modelGroup); } next = modelGroup.newPosition(startName, atts, typeParticle); if (next == null) throw new JBossXBRuntimeException(startName + " not found as a child of " + qName + " in " + modelGroup); next.previous = this; flushIgnorableCharacters(); AbstractPosition nextPosition = next; while (nextPosition.next != null) { nextPosition.notSkippedParent = nextPosition.previous.getLastNotSkipped(); if (nextPosition.repeatableHandler != null) nextPosition.startRepeatableParticle(); nextPosition.stack = stack; nextPosition.initValue(atts); nextPosition.parentType = type; nextPosition = nextPosition.next; } nextPosition.stack = stack; nextPosition.parentType = type; nextPosition.notSkippedParent = nextPosition.previous.getLastNotSkipped(); return (ElementPosition) nextPosition; } public void characters(char[] ch, int start, int length) { // collect characters only if they are allowed content if(!type.isTextContentAllowed()) return; if(indentation != Boolean.FALSE) { if(type.isSimple()) { // simple content is not analyzed indentation = Boolean.FALSE; ignorableCharacters = false; } else if(term.getSchema() != null && !term.getSchema().isIgnoreWhitespacesInMixedContent()) { indentation = Boolean.FALSE; ignorableCharacters = false; } else { // the indentation is currently defined as whitespaces with next line characters // this should probably be externalized in the form of a filter or something for (int i = start; i < start + length; ++i) { if(ch[i] == 0x0a) { indentation = Boolean.TRUE; } else if (!Character.isWhitespace(ch[i])) { indentation = Boolean.FALSE; ignorableCharacters = false; break; } } } } if (textContent == null) textContent = new StringBuffer(); textContent.append(ch, start, length); } public void endParticle() { ended = true; ElementBinding element = (ElementBinding) term; List interceptors = null; List localInterceptors = null; if(interceptorObjects != null) { interceptors = element.getInterceptors(); localInterceptors = parentType == null ? Collections.emptyList() : parentType.getInterceptors(qName); } if(o != SundayContentHandler.NIL) { // // characters // flushIgnorableCharacters(); TypeBinding charType = type.getSimpleType(); if(charType == null) charType = type; CharactersHandler charHandler = ignoreCharacters ? null : charType.getCharactersHandler(); /** * If there is text content then unmarshal it and set. * If there is no text content and the type is simple and * its characters handler is not null then unmarshal and set. * If the type is complex and there is no text data then the unmarshalled value * of the empty text content is assumed to be null * (in case of simple types that's not always true and depends on nillable attribute). */ String textContent = this.textContent == null ? "" : this.textContent.toString(); if(textContent.length() > 0 || charHandler != null && !type.isIgnoreEmptyString()) { String dataContent; SchemaBinding schema = term.getSchema(); if(textContent.length() == 0) { dataContent = null; } else { dataContent = textContent; if(schema != null && schema.isReplacePropertyRefs()) dataContent = StringPropertyReplacer.replaceProperties(dataContent); if(element.isNormalizeSpace()) dataContent = dataContent.trim(); } Object unmarshalled; if(charHandler == null) { if(!type.isSimple() && !term.isSkip() && schema != null && schema.isStrictSchema()) { throw new JBossXBRuntimeException("Element " + qName + " with type binding " + type.getQName() + " does not include text content binding: " + dataContent ); } unmarshalled = dataContent; } else { ValueMetaData valueMetaData = term.getValueMetaData(); if(valueMetaData == null) { CharactersMetaData charactersMetaData = type.getCharactersMetaData(); if(charactersMetaData != null) { valueMetaData = charactersMetaData.getValue(); } } // todo valueMetaData is available from type unmarshalled = dataContent == null ? charHandler.unmarshalEmpty(qName, charType, stack.getNamespaceRegistry(), valueMetaData) : charHandler.unmarshal(qName, charType, stack.getNamespaceRegistry(), valueMetaData, dataContent); } if(unmarshalled != null) { // if startElement returned null, we use characters as the object for this element if(o == null) { o = unmarshalled; } else if(charHandler != null) { TermBeforeSetParentCallback beforeSetParent = charType.getBeforeSetParentCallback(); if(beforeSetParent != null) { UnmarshallingContextImpl ctx = stack.getContext(); ctx.parent = o; ctx.particle = particle; ctx.parentParticle = notSkippedParent.particle; unmarshalled = beforeSetParent.beforeSetParent(unmarshalled, ctx); ctx.clear(); } charHandler.setValue(qName, element, o, unmarshalled); } } if(interceptorObjects != null) { NamespaceRegistry nsRegistry = stack.getNamespaceRegistry(); int ioIndex = 0; for (int i = interceptors.size() - 1; i >= 0; --i) { ElementInterceptor interceptor = interceptors.get(i); interceptor.characters(interceptorObjects[ioIndex++], qName, type, nsRegistry, dataContent); } for (int i = localInterceptors.size() - 1; i >= 0; --i) { ElementInterceptor interceptor = localInterceptors.get(i); interceptor.characters(interceptorObjects[ioIndex++], qName, type, nsRegistry, dataContent); } } } } else { o = null; } if(skip) return; // // endElement // o = handler.endParticle(o, qName, particle); if(interceptorObjects != null && !interceptors.isEmpty()) { int ioIndex = 0; for (int i = interceptors.size() - 1; i >= 0; --i) { ElementInterceptor interceptor = interceptors.get(i); interceptorObjects[ioIndex] = interceptor.endElement(interceptorObjects[ioIndex++], qName, type); } } // // setParent // if(interceptorObjects != null) { int ioIndex = 0; for(int i = interceptors.size() - 1; i >= 0; --i) { ElementInterceptor interceptor = interceptors.get(i); Object parent = interceptorObjects[ioIndex++]; interceptor.add(parent, o, qName); o = parent; } for(int i = localInterceptors.size() - 1; i >= 0; --i) { ElementInterceptor interceptor = localInterceptors.get(i); Object parent = interceptorObjects[ioIndex++]; interceptor.add(parent, o, qName); o = parent; } } else if (notSkippedParent != null) { if (notSkippedParent.o != null) { ParticleHandler handler = this.handler; if (notSkippedParent.term.isWildcard()) { ParticleHandler wh = ((WildcardBinding) notSkippedParent.term).getWildcardHandler(); if (wh != null) handler = wh; } setParent(notSkippedParent, handler); } else if (notSkippedParent.term.isWildcard()) { // the parent has anyType, so it gets the value of its child AbstractPosition parentPos = previous; parentPos.o = o; while(!parentPos.isElement()) { parentPos = parentPos.getPrevious(); parentPos.o = o; } if (trace) log.trace("Value of " + qName + " " + o + " is promoted as the value of its parent element."); } } } public ElementPosition startParticle(QName startName, Attributes atts) { return (ElementPosition) nextPosition(startName, atts); } public void repeatForChild(Attributes atts) { throw new JBossXBRuntimeException("Failed to repeat parent for non-repeatable element: " + "repeatable parent expected to be a model group but got element " + qName); } public void push(Attributes atts) { // TODO xsi:type support should be implemented in a better way String xsiType = atts.getValue(Constants.NS_XML_SCHEMA_INSTANCE, "type"); if (xsiType != null) { if (trace) log.trace(term.getQName() + " uses xsi:type " + xsiType); if (nonXsiParticle == null) nonXsiParticle = particle; String xsiTypePrefix; String xsiTypeLocal; int colon = xsiType.indexOf(':'); if (colon == -1) { xsiTypePrefix = ""; xsiTypeLocal = xsiType; } else { xsiTypePrefix = xsiType.substring(0, colon); xsiTypeLocal = xsiType.substring(colon + 1); } String xsiTypeNs = stack.getNamespaceRegistry().getNamespaceURI(xsiTypePrefix); QName xsiTypeQName = new QName(xsiTypeNs, xsiTypeLocal); SchemaBinding schemaBinding = term.getSchema(); TypeBinding xsiTypeBinding = schemaBinding.getType(xsiTypeQName); if (xsiTypeBinding == null) { throw new JBossXBRuntimeException("Type binding not found for type " + xsiTypeQName + " specified with xsi:type for element " + qName); } ElementBinding xsiElement = new ElementBinding(schemaBinding, qName, xsiTypeBinding); xsiElement.setRepeatableHandler(term.getRepeatableHandler()); particle = new ParticleBinding(xsiElement, particle.getMinOccurs(), particle.getMaxOccurs(), particle.getMaxOccursUnbounded()); term = xsiElement; type = xsiTypeBinding; } if (occurrence == 1 && repeatableHandler != null) startRepeatableParticle(); Object parent = previous == null ? null : previous.o; ElementBinding element = (ElementBinding) term; if(parentType != null) { List interceptors = parentType.getInterceptors(qName); if(!interceptors.isEmpty()) { NamespaceRegistry nsRegistry = stack.getNamespaceRegistry(); interceptorObjects = new Object[interceptors.size() + element.getInterceptors().size()]; // objects are written to the array in the reversed order to optimize endParticle iterations int ioIndex = interceptorObjects.length - 1; for(ElementInterceptor i : interceptors) { parent = i.startElement(parent, qName, type); i.attributes(parent, qName, type, atts, nsRegistry); interceptorObjects[ioIndex--] = parent; } } } if(!element.getInterceptors().isEmpty()) { NamespaceRegistry nsRegistry = stack.getNamespaceRegistry(); int ioIndex; if(interceptorObjects == null) { interceptorObjects = new Object[element.getInterceptors().size()]; ioIndex = interceptorObjects.length - 1; } else ioIndex = element.getInterceptors().size() - 1; for(ElementInterceptor i : element.getInterceptors()) { parent = i.startElement(parent, qName, type); i.attributes(parent, qName, type, atts, nsRegistry); interceptorObjects[ioIndex--] = parent; } } if(element.isNillable()) { String nil = atts.getValue(Constants.NS_XML_SCHEMA_INSTANCE, "nil"); if (nil == null || !("1".equals(nil) || "true".equals(nil))) initValue(atts); else o = SundayContentHandler.NIL; } else initValue(atts); } private void flushIgnorableCharacters() { if(textContent == null) return; if(indentation == Boolean.TRUE || ignorableCharacters) { if(trace) log.trace("ignored characters: " + term.getQName() + " '" + textContent + "'"); textContent = null; indentation = null; } } }././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SchemaResolverFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Sche0000644000175000017500000000263710470642610033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; /** * SchemaResolverFactory. * * @author Adrian Brock * @version $Revision: 1958 $ */ public interface SchemaResolverFactory { /** * Get the schema binding resolver * * @return the schema binding resolver */ SchemaBindingResolver getSchemaBindingResolver(); } ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/SchemaBindingResolver.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/unmarshalling/Sche0000644000175000017500000000432111453330564033201 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday.unmarshalling; import org.w3c.dom.ls.LSInput; /** * @author Alexey Loubyansky * @version $Revision: 4858 $ */ public interface SchemaBindingResolver { String getBaseURI(); void setBaseURI(String baseURI); /** * Returns an instance of SchemaBinding corresponding to the namespace URI. * * @param nsUri - namespace URI of the element with the schema reference * @param elementName - optional root element name * @param schemaLocation - the option schema location uri that matches * nsUri if one exists * @return an instance of SchemaBinding correspnding to the namespace URI * or null if the namespace URI is not recognized (though, in this case it * could also throw an exception) */ SchemaBinding resolve(String nsUri, String elementName, String schemaLocation); /** * This one is used to resolve imported schemas with * @param nsUri * @param baseUri * @param schemaLocation * @return LIInput for the resolved namespace schema if found, null otherwise */ LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation); } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/MarshallerImpl.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/sunday/MarshallerImpl.jav0000755000175000017500000000253610470642610033153 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.sunday; /** * Please, never use this marshaller. The extended marshaller should be * used instead. * * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class MarshallerImpl extends org.jboss.xb.binding.sunday.marshalling.MarshallerImpl { } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/JBossXBException.java0000644000175000017500000000306310470642610032217 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class JBossXBException extends Exception { static final long serialVersionUID = 8229078720076583113L; public JBossXBException() { } public JBossXBException(String message) { super(message); } public JBossXBException(Throwable cause) { super(cause); } public JBossXBException(String message, Throwable cause) { super(message, cause); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/GenericObjectModelFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/GenericObjectModelFactory0000644000175000017500000001131510470642610033161 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import org.xml.sax.Attributes; /** * Direct implementations of ObjectModelFactory interface can be thought of as "typed" factories * in a sense that parameter types of newChild, addChild and setValue methods * (discovered by the framework at runtime with introspection) are supposed to be of specific Java classes * (other than java.lang.Object) from the target class hierarchy. *

    In this interface, newChild, addChild and setValue methods are defined * with arguments of type java.lang.Object. *
    The framework won't introspect an implementation of this interface for "typed" implementations of * newChild, addChild and setValue methods. * Instead it will call the declared generic methods and it's the responsibility of the implementation * of this interface to recognize the types and build the object graph appropriately. * * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public interface GenericObjectModelFactory extends ObjectModelFactory { /** * This method is called when parsing of a new not top-level XML element started. * The method should either return an object that represents this XML element in the Java object model or * null if this XML element is not represented in the Java object model. * * @param parent an object that represents the parent XML element in the object model * @param ctx unmarshalling context * @param namespaceURI namespace URI of the XML element * @param localName local name of the XML element * @param attrs attributes of the XML element * @return an object that represents the XML element in the Java object model or null */ Object newChild(Object parent, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs); /** * This method is called when parsing of a not top-level XML element completed. * The object that represents this XML element in the Java model should now be completely initialized. * An implementation of this method could validate the object that represents the XML element * in the Java object model and add it to the parent. * * @param parent an object that represents the parent XML element in the object model * @param child an object that was returned by the newChild method that * was called when parsing of this XML element started * @param ctx unmarshalling context * @param namespaceURI namespace URI of the XML element * @param localName local name of the XML element */ void addChild(Object parent, Object child, UnmarshallingContext ctx, String namespaceURI, String localName); /** * This method is called when a new not top-level simple XML element (with text content) was parsed. * Such elements are usually mapped to fields in Java classes. So, usually, an implementation of this method * will set the field the XML element is bound to in the parent object to the parsed value possibly applying * some unmarshalling rule for it. * * @param o an object that represents the parent XML element in the Java object model * @param ctx unmarshalling context * @param namespaceURI namespace URI of the XML element * @param localName local name of the XML element * @param value value of the XML element as it appears in the XML content */ void setValue(Object o, UnmarshallingContext ctx, String namespaceURI, String localName, String value); } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/ContentPopulator.java0000644000175000017500000000562410470642610032413 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import org.xml.sax.ContentHandler; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.Attributes; /** * org.xml.sax.ContentHandler implementation that poplulates an instance of org.jboss.xb.binding.Content. * * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class ContentPopulator implements ContentHandler { private Content content = new Content(); // Public public Content getContent() { return content; } // ContentHandler implementation public void setDocumentLocator(Locator locator) { } public void startDocument() throws SAXException { content.startDocument(); } public void endDocument() throws SAXException { content.endDocument(); } public void startPrefixMapping(String prefix, String uri) throws SAXException { content.startPrefixMapping(prefix, uri); } public void endPrefixMapping(String prefix) throws SAXException { content.endPrefixMapping(prefix); } public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { content.startElement(namespaceURI, localName, qName, atts); } public void endElement(String namespaceURI, String localName, String qName) throws SAXException { content.endElement(namespaceURI, localName, qName); } public void characters(char ch[], int start, int length) throws SAXException { content.characters(ch, start, length); } public void ignorableWhitespace(char ch[], int start, int length) throws SAXException { } public void processingInstruction(String target, String data) throws SAXException { } public void skippedEntity(String name) throws SAXException { } }libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/Content.java0000644000175000017500000002505011061473704030503 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import java.io.StringWriter; import java.util.Iterator; import java.util.List; import java.util.ArrayList; import org.jboss.logging.Logger; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; /** * An instance of this class represents XML content. * It is populated on unmarshalling with org.jboss.xb.binding.ContentPopulator and used * to implement content navigation in object model factories. * And on marshalling, first, an instance of this class is created and then it * is serialized into XML content with org.jboss.xb.binding.ContentWriter. * * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class Content { private static Logger log = Logger.getLogger(Content.class); private List content = new ArrayList(); private final boolean trace = log.isTraceEnabled(); // Public public String getChildContent(String namespaceURI, String qName) { StartElement current = ((StartElement)content.get(index)); boolean lookingForStart = true; StartElement start = null; boolean childFound = false; StringBuffer value = new StringBuffer(); int i = index + 1; Object next = content.get(i++); while(!current.isMyEnd(next)) { if(lookingForStart) { if(next instanceof StartElement) { start = (StartElement)next; lookingForStart = false; if(qName.equals(start.qName) && (namespaceURI == null ? start.namespaceURI == null : namespaceURI.equals(start.namespaceURI))) { childFound = true; } } } else if(next instanceof EndElement) { if(start.isMyEnd(next)) { if(childFound) { break; } else { lookingForStart = true; } } } else if(childFound && next instanceof Characters) { Characters chars = (Characters)next; value.append(chars.ch, chars.start, chars.length); } next = content.get(i++); } return value.toString().trim(); } public void handleContent(ContentHandler handler) throws SAXException { handler.startDocument(); for(Iterator i = content.iterator(); i.hasNext();) { Object item = i.next(); if(item instanceof StartElement) { StartElement start = (StartElement)item; handler.startElement(start.namespaceURI, start.localName, start.qName, start.attrs); } else if(item instanceof EndElement) { EndElement end = (EndElement)item; handler.endElement(end.namespaceURI, end.localName, end.qName); } else if(item instanceof Characters) { Characters ch = (Characters)item; handler.characters(ch.ch, ch.start, ch.length); } else if(item instanceof StartPrefixMapping) { /* if(trace) { StartPrefixMapping startPrefix = (StartPrefixMapping)item; log.trace("start prefix mapping: " + startPrefix.prefix + "=" + startPrefix.uri); } */ } else if(item instanceof EndPrefixMapping) { /* if(trace) { EndPrefixMapping endPrefix = (EndPrefixMapping)item; log.trace("end prefix mapping: " + endPrefix.prefix); } */ } else { throw new IllegalStateException("Unexpected element type: " + item); } } handler.endDocument(); } public String toString() { StringWriter writer = new StringWriter(); try { ContentWriter contentWriter = new ContentWriter(writer, true); handleContent(contentWriter); } catch(SAXException e) { writer.write(e.getMessage()); } return writer.getBuffer().toString(); } // Methods that populate the content public void startDocument() { content.clear(); } public void endDocument() { } public void startPrefixMapping(String prefix, String uri) { StartPrefixMapping node = new StartPrefixMapping(prefix, uri); content.add(node); } public void endPrefixMapping(String prefix) { EndPrefixMapping node = new EndPrefixMapping(prefix); content.add(node); } public void startElement(String namespaceURI, String localName, String qName, Attributes atts) { StartElement startElement = new StartElement(namespaceURI, localName, qName, atts); content.add(startElement); if(trace) { log.trace("startElement> uri=" + namespaceURI + ", local=" + localName + ", qn=" + qName + ", attrs=" + atts); } } public void endElement(String namespaceURI, String localName, String qName) { EndElement endElement = new EndElement(namespaceURI, localName, qName); content.add(endElement); if(trace) { log.trace("endElement> uri=" + namespaceURI + ", local=" + localName + ", qn=" + qName); } } public void characters(char[] ch, int start, int length) { Characters characters = new Characters(ch, start, length); // DON'T ignore whitespace-only characters //if(characters.toString().trim().length() > 0) //{ content.add(characters); if(trace) { log.trace("characters> " + characters); } //} } // Methods that navigate through the content private int index; public void append(Content content) { for(Iterator i = content.content.iterator(); i.hasNext();) { this.content.add(i.next()); } } // Inner private static interface Node { } public static class Characters implements Node { private final char[] ch; private final int start; private final int length; public Characters(char[] ch, int start, int length) { /* this.ch = ch; this.start = start; this.length = length; */ this.ch = new char[length]; System.arraycopy(ch, start, this.ch, 0, length); this.start = 0; this.length = length; } public String toString() { return String.valueOf(ch, start, length); } } public static class EndElement implements Node { private final String namespaceURI; private final String localName; private final String qName; public EndElement(String namespaceURI, String localName, String qName) { this.namespaceURI = namespaceURI; this.localName = localName; this.qName = qName; } public String toString() { return '[' + namespaceURI + ',' + localName + ',' + qName + ']'; } } public static class StartElement implements Node { private final String namespaceURI; private final String localName; private final String qName; private final Attributes attrs; public StartElement(String namespaceURI, String localName, String qName, Attributes attrs) { this.namespaceURI = namespaceURI; this.localName = localName; this.qName = qName; this.attrs = new AttributesImpl(attrs); } public boolean isMyEnd(Object element) { boolean itis = false; if(element instanceof EndElement) { EndElement end = (EndElement)element; itis = (namespaceURI == null ? end.namespaceURI == null : namespaceURI.equals(end.namespaceURI)) && qName.equals(end.qName); } return itis; } public String toString() { return '[' + namespaceURI + ',' + localName + ',' + qName + ']'; } } public static class StartPrefixMapping implements Node { public final String prefix; public final String uri; public StartPrefixMapping(String prefix, String uri) { this.prefix = prefix; this.uri = uri; } public void read(ObjectModelBuilder builder) { builder.startPrefixMapping(prefix, uri); } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof StartPrefixMapping)) { return false; } final StartPrefixMapping startPrefixMapping = (StartPrefixMapping)o; if(prefix != null ? !prefix.equals(startPrefixMapping.prefix) : startPrefixMapping.prefix != null) { return false; } if(uri != null ? !uri.equals(startPrefixMapping.uri) : startPrefixMapping.uri != null) { return false; } return true; } public int hashCode() { int result; result = (prefix != null ? prefix.hashCode() : 0); result = 29 * result + (uri != null ? uri.hashCode() : 0); return result; } } public static class EndPrefixMapping implements Node { public final String prefix; public EndPrefixMapping(String prefix) { this.prefix = prefix; } public void read(ObjectModelBuilder builder) { builder.endPrefixMapping(prefix); } } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/JBossXBRuntimeException.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/JBossXBRuntimeException.j0000644000175000017500000000313410470642610033072 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class JBossXBRuntimeException extends RuntimeException { static final long serialVersionUID = -33504134223704483L; public JBossXBRuntimeException() { } public JBossXBRuntimeException(String message) { super(message); } public JBossXBRuntimeException(Throwable cause) { super(cause); } public JBossXBRuntimeException(String message, Throwable cause) { super(message, cause); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/DelegatingObjectModelProvider.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/DelegatingObjectModelProv0000644000175000017500000001314511061473704033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import java.lang.reflect.Method; import org.jboss.logging.Logger; /** * todo come up with a nicer class name * * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class DelegatingObjectModelProvider implements GenericObjectModelProvider { private static final Logger log = Logger.getLogger(DelegatingObjectModelProvider.class); private final ObjectModelProvider provider; private final boolean trace = log.isTraceEnabled(); public DelegatingObjectModelProvider(ObjectModelProvider provider) { this.provider = provider; } public Object getChildren(Object o, MarshallingContext ctx, String namespaceURI, String localName) { return provideChildren(provider, o, namespaceURI, localName); } public Object getElementValue(Object o, MarshallingContext ctx, String namespaceURI, String localName) { return provideValue(provider, o, namespaceURI, localName); } public Object getAttributeValue(Object o, MarshallingContext ctx, String namespaceURI, String localName) { return provideAttributeValue(provider, o, namespaceURI, localName); } public Object getRoot(Object o, MarshallingContext ctx, String namespaceURI, String localName) { return provider.getRoot(o, null, namespaceURI, localName); } // private Object provideChildren(ObjectModelProvider provider, Object parent, String namespaceUri, String name) { Class providerClass = provider.getClass(); Class parentClass = parent.getClass(); String methodName = "getChildren"; Object container = null; Method method = getProviderMethod(providerClass, methodName, new Class[]{parentClass, String.class, String.class} ); if(method != null) { try { container = method.invoke(provider, new Object[]{parent, namespaceUri, name}); } catch(Exception e) { log.error("Failed to invoke method " + methodName, e); throw new IllegalStateException("Failed to invoke method " + methodName); } } else if(trace) { log.trace("No " + methodName + " for " + name); } return container; } Object provideValue(ObjectModelProvider provider, Object parent, String namespaceUri, String name) { Class providerClass = provider.getClass(); Class parentClass = parent.getClass(); String methodName = "getElementValue"; Object value = null; Method method = getProviderMethod(providerClass, methodName, new Class[]{parentClass, String.class, String.class} ); if(method != null) { try { value = method.invoke(provider, new Object[]{parent, namespaceUri, name}); } catch(Exception e) { throw new IllegalStateException("Failed to invoke method " + methodName); } } else if(trace) { log.trace("No " + methodName + " for " + name); } return value; } Object provideAttributeValue(ObjectModelProvider provider, Object object, String namespaceUri, String name) { Class providerClass = provider.getClass(); Class objectClass = object.getClass(); String methodName = "getAttributeValue"; Object value = null; Method method = getProviderMethod(providerClass, methodName, new Class[]{objectClass, String.class, String.class} ); if(method != null) { try { value = method.invoke(provider, new Object[]{object, namespaceUri, name}); } catch(Exception e) { throw new IllegalStateException("Failed to invoke method " + methodName); } } else if(trace) { log.trace("No " + methodName + " for " + name); } return value; } private static Method getProviderMethod(Class providerClass, String methodName, Class[] args) { Method method = null; try { method = providerClass.getMethod(methodName, args); } catch(NoSuchMethodException e) { // no method } return method; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/JBossXBValueFormatException.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/JBossXBValueFormatExcepti0000644000175000017500000000316710470642610033115 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public class JBossXBValueFormatException extends JBossXBRuntimeException { static final long serialVersionUID = -3196504305414545949L; public JBossXBValueFormatException() { } public JBossXBValueFormatException(String message) { super(message); } public JBossXBValueFormatException(Throwable cause) { super(cause); } public JBossXBValueFormatException(String message, Throwable cause) { super(message, cause); } } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/MappingObjectModelFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/MappingObjectModelFactory0000644000175000017500000005530311061473704033210 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import org.jboss.logging.Logger; import org.jboss.util.NestedRuntimeException; import org.jboss.xb.binding.introspection.FieldInfo; import org.xml.sax.Attributes; import org.apache.xerces.xs.XSTypeDefinition; import java.lang.reflect.Constructor; import java.util.Map; import java.util.HashMap; import java.util.Collection; import java.util.ArrayList; /** * An ObjectModelFactory that uses mappings * * @author Alexey Loubyansky * @author Adrian Brock * @version $Revision: 2913 $ */ public class MappingObjectModelFactory implements GenericObjectModelFactory { private final static Logger log = Logger.getLogger(MappingObjectModelFactory.class); /** * The class mappings */ private final Map elementToClassMapping = new HashMap(); /** * The field mappings */ private final Map elementToFieldMapping = new HashMap(); // Public /** * Map an element to a class * * @param element the element name * @param cls the class */ public void mapElementToClass(String element, Class cls) { ElementToClassMapping mapping = new ElementToClassMapping(element, cls); addElementToClassMapping(mapping); if(log.isTraceEnabled()) { log.trace(mapping); } } /** * Map an element to a field * * @param element the element name * @param cls the class * @param field the field name * @param converter the type convertor */ public void mapElementToField(String element, Class cls, String field, TypeBinding converter) { ElementToFieldMapping mapping = new ElementToFieldMapping(element, cls, field, converter); addElementToFieldMapping(mapping); if(log.isTraceEnabled()) { log.trace(mapping); } } // ObjectModelFactory implementation public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs) { if(log.isTraceEnabled()) { log.trace("newRoot root=" + root + " namespaceURI=" + namespaceURI + " localName=" + localName + " attributes=" + attrs ); } if(root == null) { ElementToClassMapping mapping = elementToClassMapping.get(localName); if(mapping != null) { if(log.isTraceEnabled()) { log.trace("creating root using " + mapping); } root = newInstance(mapping.cls); } else { root = create(namespaceURI, localName, ctx.getType()); } if(root == null) { throw new IllegalStateException( "Failed to resolve Java type binding for root element: ns=" + namespaceURI + ", local=" + localName ); } } if(attrs != null) { for(int i = 0; i < attrs.getLength(); ++i) { try { if(attrs.getLocalName(i).length() > 0) { if(!attrs.getQName(i).startsWith("xsi:")) //todo horrible { setAttribute(root, attrs.getLocalName(i), attrs.getValue(i), ctx); } } } catch(Exception e) { String msg = "Failed to set attribute " + attrs.getQName(i) + "=" + attrs.getValue(i); log.error(msg, e); throw new IllegalStateException(msg + ": " + e.getMessage()); } } } return root; } // GenericObjectModelFactory implementation public Object newChild(Object o, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs) { if(log.isTraceEnabled()) { log.trace("newChild object=" + o + " namespaceURI=" + namespaceURI + " localName=" + localName + " attributes=" + attrs ); } if(o == null) { throw new RuntimeException("Attempt to add a new child to a null parent localName=" + localName); } Object child = null; ElementToClassMapping mapping = elementToClassMapping.get(localName); XSTypeDefinition type = ctx.getType(); if(mapping != null) { if(log.isTraceEnabled()) { log.trace("newChild using mapping " + mapping); } try { if(!(o instanceof Collection)) { ElementToFieldMapping fieldMapping = elementToFieldMapping.get( new ElementToFieldMappingKey(localName, o.getClass()) ); FieldInfo fieldInfo; if(fieldMapping != null) { fieldInfo = fieldMapping.fieldInfo; } else { String fieldName = Util.xmlNameToFieldName(localName, true); fieldInfo = FieldInfo.getFieldInfo(o.getClass(), fieldName, true); } child = get(o, localName, fieldInfo); } if(child == null) { child = newInstance(mapping.cls); } if(attrs != null) { for(int i = 0; i < attrs.getLength(); ++i) { if(attrs.getLocalName(i).length() > 0) { if(!attrs.getQName(i).startsWith("xsi:")) //todo horrible { setAttribute(child, attrs.getLocalName(i), attrs.getValue(i), ctx); } } } } } catch(RuntimeException e) { throw e; } catch(Exception e) { throw new NestedRuntimeException("newChild failed for o=" + o + ", uri=" + namespaceURI + ", local=" + localName + ", attrs=" + attrs, e ); } } else { if(o instanceof Collection) { child = create(namespaceURI, localName, type); } else { Class oCls; if(o instanceof Immutable) { oCls = ((Immutable)o).cls; } else { oCls = o.getClass(); } String fieldName = Util.xmlNameToFieldName(localName, true); FieldInfo fieldInfo = FieldInfo.getFieldInfo(oCls, fieldName, true); if(Collection.class.isAssignableFrom(fieldInfo.getType())) { child = get(o, localName, fieldInfo); // now does this element really represent a Java collection or is it an element that can appear more than once? // try to load the class and create an instance Object item = null; if(type == null || type != null && type.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { item = create(namespaceURI, localName, type); } if(item != null) { if(child == null) { setChild(new ArrayList(), o, localName); } child = item; } else { if(child == null) { child = new ArrayList(); } } } else if(!Util.isAttributeType(fieldInfo.getType())) { // id there is no field mapping ElementToFieldMapping fieldMapping = elementToFieldMapping.get( new ElementToFieldMappingKey(localName, o.getClass()) ); TypeBinding converter = fieldMapping == null ? null : fieldMapping.converter; // if converter != null it will be used in setValue if(converter == null) { child = newInstance(fieldInfo.getType()); } } } } return child; } public void addChild(Object parent, Object child, UnmarshallingContext ctx, String namespaceURI, String localName) { if(log.isTraceEnabled()) { log.trace("addChild parent=" + parent + " child=" + child + " namespaceURI=" + namespaceURI + " localName=" + localName ); } if(child instanceof Immutable) { child = ((Immutable)child).newInstance(); } setChild(child, parent, localName); } public void setValue(Object o, UnmarshallingContext ctx, String namespaceURI, String localName, String value) { if(log.isTraceEnabled()) { log.trace("setValue object=" + o + " ctx=" + ctx + " namespaceURI=" + namespaceURI + " localName=" + localName + " value=" + value ); } setAttribute(o, localName, value, ctx); } public Object completeRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName) { if(log.isTraceEnabled()) { log.trace("completeRoot root=" + root + " navigator=" + navigator + " namespaceURI=" + namespaceURI + " localName=" + localName ); } if(root instanceof Immutable) { root = ((Immutable)root).newInstance(); } return root; } // Private private void addElementToClassMapping(ElementToClassMapping mapping) { elementToClassMapping.put(mapping.element, mapping); } private void addElementToFieldMapping(ElementToFieldMapping mapping) { elementToFieldMapping.put(mapping.key, mapping); } private void setChild(Object child, Object parent, String localName) { boolean trace = log.isTraceEnabled(); Object value = child; if(parent instanceof Collection) { if(trace) { log.trace("Add " + value + " to collection " + parent); } ((Collection)parent).add(value); } else { final ElementToFieldMapping fieldMapping = elementToFieldMapping.get( new ElementToFieldMappingKey(localName, parent.getClass()) ); if(fieldMapping != null) { if(trace) { log.trace("Add " + value + " to " + parent + " using field mapping " + fieldMapping); } set(parent, value, localName, fieldMapping.fieldInfo); } else { Class parentCls = parent instanceof Immutable ? ((Immutable)parent).cls : parent.getClass(); String fieldName = Util.xmlNameToFieldName(localName, true); FieldInfo fieldInfo = FieldInfo.getFieldInfo(parentCls, fieldName, false); if(trace) { log.trace("Add " + value + " to property " + fieldName + " of " + parentCls); } if(fieldInfo != null) { if(!(child instanceof Collection) && Collection.class.isAssignableFrom(fieldInfo.getType())) { Object o = get(parent, localName, fieldInfo); Collection col = (Collection)o; if(trace) { log.trace("Add " + value + " to collection " + col + " retrieved from " + fieldName); } col.add(child); } else { set(parent, value, localName, fieldInfo); } } } } } private void setAttribute(Object o, String localName, String value, UnmarshallingContext ctx) { if(o instanceof Collection) { XSTypeDefinition type = ctx.getType(); if(type == null) { log.warn("Type is not available for collection item " + localName + "=" + value + " -> adding as string."); ((Collection)o).add(value); } else { if(type.getName() == null) { throw new IllegalStateException("Name is null for simple type?!"); } Object trgValue = SimpleTypeBindings.unmarshal(type.getName(), value, ctx.getNamespaceContext()); ((Collection)o).add(trgValue); } } else { Object fieldValue = null; final ElementToFieldMapping fieldMapping = elementToFieldMapping.get( new ElementToFieldMappingKey(localName, o.getClass()) ); if(fieldMapping != null) { fieldValue = fieldMapping.converter.unmarshal(value); set(o, fieldValue, localName, fieldMapping.fieldInfo); } else { Class oCls; if(o instanceof Immutable) { oCls = ((Immutable)o).cls; } else { oCls = o.getClass(); } final String fieldName = Util.xmlNameToFieldName(localName, true); FieldInfo fieldInfo = FieldInfo.getFieldInfo(oCls, fieldName, true); fieldValue = SimpleTypeBindings.unmarshal(value, fieldInfo.getType()); set(o, fieldValue, localName, fieldInfo); } } } /** * Converts namspace URI and local name into a class name, tries to load the class, * create an instance and return it. * * @param namespaceURI element's namespace URI * @param localName element's local name * @return null if the class could not be loaded, otherwise an instance of the loaded class */ private static Object create(String namespaceURI, String localName, XSTypeDefinition type) { Object o = null; String clsName = type != null && type.getName() != null ? Util.xmlNameToClassName(namespaceURI, type.getName(), true) : Util.xmlNameToClassName(namespaceURI, localName, true); Class cls = null; try { cls = Thread.currentThread().getContextClassLoader().loadClass(clsName); } catch(ClassNotFoundException e) { if(log.isTraceEnabled()) { log.trace("create: failed to load class " + clsName); } } if(cls != null) { o = newInstance(cls); } return o; } private static Object get(Object o, String localName, FieldInfo fieldInfo) { if(log.isTraceEnabled()) { log.trace("get object=" + o + " localName=" + localName); } Object value; if(o instanceof Immutable) { Immutable con = ((Immutable)o); value = con.getChild(localName); } else { value = fieldInfo.getValue(o); } return value; } private static void set(Object parent, Object child, String localName, FieldInfo fieldInfo) { if(log.isTraceEnabled()) { log.trace("set parent=" + parent + " child=" + child + " localName=" + localName); } if(fieldInfo.isWritable()) { fieldInfo.setValue(parent, child); } else if(parent instanceof Immutable) { ((Immutable)parent).addChild(localName, child); } else { throw new IllegalStateException("Neither write method nor field were found for " + fieldInfo.getName() + " and the parent object is not an immutable container: parent=" + parent.getClass() + ", localName=" + localName + ", parent=" + parent + ", child=" + child ); } } private static Object newInstance(Class cls) { if(log.isTraceEnabled()) { log.trace("new " + cls.getName()); } Object instance; try { Constructor ctor = cls.getConstructor(null); instance = ctor.newInstance(null); } catch(NoSuchMethodException e) { log.warn("No no-arg constructor in " + cls); instance = new Immutable(cls); } catch(Exception e) { throw new IllegalStateException("Failed to create an instance of " + cls + " with the no-arg constructor: " + e.getMessage() ); } return instance; } // Inner classes private class ElementToClassMapping { public final String element; public final Class cls; public ElementToClassMapping(String element, Class cls) { this.element = element; this.cls = cls; } public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("ElementToClass@").append(System.identityHashCode(this)); buffer.append("{element=").append(element); if(cls != null) { buffer.append(" class=").append(cls.getName()); } buffer.append("}"); return buffer.toString(); } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof ElementToClassMapping)) { return false; } final ElementToClassMapping classMapping = (ElementToClassMapping)o; if(cls != null ? !cls.equals(classMapping.cls) : classMapping.cls != null) { return false; } return true; } public int hashCode() { return (cls != null ? cls.hashCode() : 0); } } private class ElementToFieldMappingKey { public final String element; public final Class cls; public ElementToFieldMappingKey(String element, Class cls) { this.element = element; this.cls = cls; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof ElementToFieldMappingKey)) { return false; } final ElementToFieldMappingKey elementToFieldMappingKey = (ElementToFieldMappingKey)o; if(cls != null ? !cls.equals(elementToFieldMappingKey.cls) : elementToFieldMappingKey.cls != null) { return false; } if(element != null ? !element.equals(elementToFieldMappingKey.element) : elementToFieldMappingKey.element != null) { return false; } return true; } public int hashCode() { int result; result = (element != null ? element.hashCode() : 0); result = 29 * result + (cls != null ? cls.hashCode() : 0); return result; } } private class ElementToFieldMapping { public final String element; public final Class cls; public final TypeBinding converter; public final ElementToFieldMappingKey key; public final FieldInfo fieldInfo; public ElementToFieldMapping(String element, Class cls, String fieldName, TypeBinding converter) { this.element = element; this.cls = cls; this.converter = converter; key = new ElementToFieldMappingKey(element, cls); fieldInfo = FieldInfo.getFieldInfo(cls, fieldName, true); } public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("ElementToField@").append(System.identityHashCode(this)); buffer.append("{element=").append(element); if(cls != null) { buffer.append(" class=").append(cls.getName()); } buffer.append(" field=").append(fieldInfo.getName()); if(converter != null) { buffer.append(" convertor=").append(converter.getClass().getName()); } buffer.append("}"); return buffer.toString(); } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof ElementToFieldMapping)) { return false; } final ElementToFieldMapping elementToFieldMapping = (ElementToFieldMapping)o; if(cls != null ? !cls.equals(elementToFieldMapping.cls) : elementToFieldMapping.cls != null) { return false; } if(element != null ? !element.equals(elementToFieldMapping.element) : elementToFieldMapping.element != null) { return false; } if(!fieldInfo.getName().equals(elementToFieldMapping.fieldInfo.getName())) { return false; } return true; } public int hashCode() { int result; result = (element != null ? element.hashCode() : 0); result = 29 * result + (cls != null ? cls.hashCode() : 0); result = 29 * result + fieldInfo.getName().hashCode(); return result; } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/MarshallingContext.java0000644000175000017500000000333710470642610032700 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import org.xml.sax.ContentHandler; /** * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public interface MarshallingContext { /** * @return true if current attribute is required, false otherwise */ boolean isAttributeRequired(); /** * @return true if the element being marshalled has a complex type */ boolean isTypeComplex(); /** * @return the name of the property a simple content of a complex type is bound to */ String getSimpleContentProperty(); ContentHandler getContentHandler(); /** * @return the namespace context */ NamespaceRegistry getNamespaceContext(); } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/XercesXsMarshaller.java0000644000175000017500000013523011061473704032652 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import java.io.IOException; import java.io.Reader; import java.io.Writer; import java.lang.reflect.Array; import java.lang.reflect.Method; import java.util.AbstractList; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; import javax.xml.namespace.QName; import javax.xml.parsers.ParserConfigurationException; import org.apache.xerces.xs.StringList; import org.apache.xerces.xs.XSAttributeDeclaration; import org.apache.xerces.xs.XSAttributeUse; import org.apache.xerces.xs.XSComplexTypeDefinition; import org.apache.xerces.xs.XSConstants; import org.apache.xerces.xs.XSElementDeclaration; import org.apache.xerces.xs.XSModel; import org.apache.xerces.xs.XSModelGroup; import org.apache.xerces.xs.XSNamedMap; import org.apache.xerces.xs.XSObject; import org.apache.xerces.xs.XSObjectList; import org.apache.xerces.xs.XSParticle; import org.apache.xerces.xs.XSSimpleTypeDefinition; import org.apache.xerces.xs.XSTerm; import org.apache.xerces.xs.XSTypeDefinition; import org.apache.xerces.xs.XSWildcard; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; /** * @deprecated In favor of org.jboss.xb.binding.sunday.marshalling.MarshallerImpl. * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class XercesXsMarshaller extends AbstractMarshaller { private Stack stack = new StackImpl(); /** * ObjectModelProvider for this marshaller */ private GenericObjectModelProvider provider; private Object root; /** * Whether NULL values should be ignored or marshalled as xsi:nil='1' */ private boolean supportNil = true; private QName rootTypeQName; private SchemaBindingResolver schemaResolver; private XSModel model; private boolean ignoreUnresolvedWildcard; private XSAttributeUse currentAttribute; private XSTypeDefinition currentElementType; private String simpleContentProperty = "value"; private MarshallingContext ctx = new MarshallingContext() { private ContentHandler ch; public boolean isAttributeRequired() { if(currentAttribute == null) { throw new JBossXBRuntimeException("There is no current attribute!"); } return currentAttribute.getRequired(); } public boolean isTypeComplex() { if(currentElementType == null) { throw new JBossXBRuntimeException("There is no current element!"); } return currentElementType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE; } public String getSimpleContentProperty() { return simpleContentProperty; } public ContentHandler getContentHandler() { if(ch == null) { ch = new ContentHandlerAdaptor(); } return ch; } public NamespaceRegistry getNamespaceContext() { return nsRegistry; } }; public String getSimpleContentProperty() { return simpleContentProperty; } public void setSimpleContentProperty(String simpleContentProperty) { this.simpleContentProperty = simpleContentProperty; } public boolean isIgnoreUnresolvedWildcard() { return ignoreUnresolvedWildcard; } public void setIgnoreUnresolvedWildcard(boolean ignoreUnresolvedWildcard) { this.ignoreUnresolvedWildcard = ignoreUnresolvedWildcard; } public SchemaBindingResolver getSchemaResolver() { return schemaResolver; } public void setSchemaResolver(SchemaBindingResolver schemaResolver) { this.schemaResolver = schemaResolver; } public QName getRootTypeQName() { return rootTypeQName; } public void setRootTypeQName(QName rootTypeQName) { this.rootTypeQName = rootTypeQName; } public boolean isSupportNil() { return supportNil; } public void setSupportNil(boolean supportNil) { this.supportNil = supportNil; } /** * Adds an attribute to the top most elements. * First, we check whether there is a namespace associated with the passed in prefix. * If the prefix was not declared, an exception is thrown. * * @param prefix the prefix of the attribute to be declared * @param localName local name of the attribute * @param type the type of the attribute * @param value the value of the attribute */ public void addAttribute(String prefix, String localName, String type, String value) { // todo addAttribute(String prefix, String localName, String type, String value) } // AbstractMarshaller implementation public void marshal(Reader xsdReader, ObjectModelProvider provider, Object root, Writer writer) throws IOException, SAXException, ParserConfigurationException { XSModel model = Util.loadSchema(xsdReader, null, schemaResolver); marshallInternal(provider, root, model, writer); } public void marshal(String xsdURL, ObjectModelProvider provider, Object root, Writer writer) throws IOException, SAXException { XSModel model = Util.loadSchema(xsdURL, schemaResolver); marshallInternal(provider, root, model, writer); } public void marshal(XSModel model, ObjectModelProvider provider, Object root, Writer writer) throws IOException, SAXException { marshallInternal(provider, root, model, writer); } private void marshallInternal(ObjectModelProvider provider, Object root, XSModel model, Writer writer) throws IOException, SAXException { if(model == null) { throw new JBossXBRuntimeException("XSModel is not available!"); } this.model = model; this.provider = provider instanceof GenericObjectModelProvider ? (GenericObjectModelProvider)provider : new DelegatingObjectModelProvider(provider); this.root = root; content.startDocument(); if(rootTypeQName != null) { if(rootQNames.isEmpty()) { throw new JBossXBRuntimeException("If type name (" + rootTypeQName + ") for the root element is specified then the name for the root element is required!" ); } QName rootQName = rootQNames.get(0); XSTypeDefinition type = model.getTypeDefinition(rootTypeQName.getLocalPart(), rootTypeQName.getNamespaceURI() ); if(type == null) { throw new JBossXBRuntimeException("Global type definition is not found: " + rootTypeQName); } if(isArrayWrapper(type)) { Object o = provider.getRoot(root, null, rootQName.getNamespaceURI(), rootQName.getLocalPart()); stack.push(o); marshalComplexType(rootQName.getNamespaceURI(), rootQName.getLocalPart(), (XSComplexTypeDefinition)type, true, false ); stack.pop(); } else { Object o = provider.getRoot(root, null, rootQName.getNamespaceURI(), rootQName.getLocalPart()); marshalElementOccurence(rootQName.getNamespaceURI(), rootQName.getLocalPart(), type, o, false, false, true ); } } else if(rootQNames.isEmpty()) { XSNamedMap components = model.getComponents(XSConstants.ELEMENT_DECLARATION); if(components.getLength() == 0) { throw new JBossXBRuntimeException("The schema doesn't contain global element declarations."); } for(int i = 0; i < components.getLength(); ++i) { XSElementDeclaration element = (XSElementDeclaration)components.item(i); Object o = provider.getRoot(root, null, element.getNamespace(), element.getName()); marshalElementOccurence(element.getNamespace(), element.getName(), element.getTypeDefinition(), o, element.getNillable(), false, true ); } } else { for(int i = 0; i < rootQNames.size(); ++i) { QName qName = rootQNames.get(i); XSElementDeclaration element = model.getElementDeclaration(qName.getLocalPart(), qName.getNamespaceURI()); if(element == null) { XSNamedMap components = model.getComponents(XSConstants.ELEMENT_DECLARATION); String roots = ""; for(int j = 0; j < components.getLength(); ++j) { XSObject xsObject = components.item(j); if(j > 0) { roots += ", "; } roots += "{" + xsObject.getNamespace() + "}" + xsObject.getName(); } throw new IllegalStateException("Root element not found: " + qName + " among " + roots); } Object o = provider.getRoot(root, null, element.getNamespace(), element.getName()); marshalElementOccurence(element.getNamespace(), element.getName(), element.getTypeDefinition(), o, element.getNillable(), false, true ); } } content.endDocument(); // version & encoding writeXmlVersion(writer); ContentWriter contentWriter = new ContentWriter(writer, propertyIsTrueOrNotSet(Marshaller.PROP_OUTPUT_INDENTATION) ); content.handleContent(contentWriter); if(log.isTraceEnabled()) { java.io.StringWriter traceWriter = new java.io.StringWriter(); contentWriter = new ContentWriter(traceWriter, propertyIsTrueOrNotSet(Marshaller.PROP_OUTPUT_INDENTATION) ); content.handleContent(contentWriter); log.trace("marshalled:\n" + traceWriter.getBuffer().toString()); } } private boolean marshalElement(String elementNs, String elementLocal, XSTypeDefinition type, boolean optional, boolean nillable, boolean declareNs, boolean declareXsiType) { Object value = stack.peek(); boolean result = value != null || value == null && (optional || nillable); boolean trace = log.isTraceEnabled() && result; if(trace) { String prefix = getPrefix(elementNs); log.trace("started element ns=" + elementNs + ", local=" + elementLocal + ", prefix=" + prefix); } if(value != null) { marshalElementType(elementNs, elementLocal, type, declareNs, nillable, declareXsiType); } else if(nillable) { writeNillable(elementNs, elementLocal, nillable); } if(trace) { log.trace("finished element ns=" + elementNs + ", local=" + elementLocal); } return result; } private void marshalElementType(String elementNs, String elementLocal, XSTypeDefinition type, boolean declareNs, boolean nillable, boolean declareXsiType) { switch(type.getTypeCategory()) { case XSTypeDefinition.SIMPLE_TYPE: marshalSimpleType(elementNs, elementLocal, (XSSimpleTypeDefinition)type, declareNs, nillable, declareXsiType ); break; case XSTypeDefinition.COMPLEX_TYPE: marshalComplexType(elementNs, elementLocal, (XSComplexTypeDefinition)type, declareNs, declareXsiType); break; default: throw new IllegalStateException("Unexpected type category: " + type.getTypeCategory()); } } private void marshalSimpleType(String elementUri, String elementLocal, XSSimpleTypeDefinition type, boolean declareNs, boolean nillable, boolean declareXsiType) { Object value = stack.peek(); if(value != null) { String prefix = getPrefix(elementUri); boolean genPrefix = prefix == null && elementUri != null && elementUri.length() > 0; if(genPrefix) { prefix = "ns_" + elementLocal; } AttributesImpl attrs = null; String typeName = type.getName(); if(SimpleTypeBindings.XS_QNAME_NAME.equals(typeName) || SimpleTypeBindings.XS_NOTATION_NAME.equals(typeName) || type.getItemType() != null && (SimpleTypeBindings.XS_QNAME_NAME.equals(type.getItemType().getName()) || SimpleTypeBindings.XS_NOTATION_NAME.equals(type.getItemType().getName()) ) ) { attrs = new AttributesImpl(5); } String marshalled = marshalCharacters(elementUri, prefix, type, value, attrs); if((declareNs || declareXsiType) && nsRegistry.size() > 0) { if(attrs == null) { attrs = new AttributesImpl(nsRegistry.size() + 1); } declareNs(attrs); } if(declareXsiType) { declareXsiType(type, attrs); } if(genPrefix) { if(attrs == null) { attrs = new AttributesImpl(1); } attrs.add(null, prefix, "xmlns:" + prefix, null, (String)elementUri); } String qName = prefixLocalName(prefix, elementLocal); content.startElement(elementUri, elementLocal, qName, attrs); content.characters(marshalled.toCharArray(), 0, marshalled.length()); content.endElement(elementUri, elementLocal, qName); } else { writeNillable(elementUri, elementLocal, nillable); } } private void marshalComplexType(String elementNsUri, String elementLocalName, XSComplexTypeDefinition type, boolean declareNs, boolean declareXsiType) { Object o = stack.peek(); XSParticle particle = type.getParticle(); XSObjectList attributeUses = type.getAttributeUses(); int attrsTotal = declareNs || declareXsiType ? nsRegistry.size() + attributeUses.getLength() + 1 : attributeUses.getLength(); AttributesImpl attrs = attrsTotal > 0 ? new AttributesImpl(attrsTotal) : null; if(declareNs && nsRegistry.size() > 0) { declareNs(attrs); } String generatedPrefix = null; if(declareXsiType) { generatedPrefix = declareXsiType(type, attrs); if(generatedPrefix != null) { String typeNsWithGeneratedPrefix = type.getNamespace(); declareNs(attrs, generatedPrefix, typeNsWithGeneratedPrefix); declareNamespace(generatedPrefix, typeNsWithGeneratedPrefix); } } String prefix = getPrefix(elementNsUri); boolean genPrefix = prefix == null && elementNsUri != null && elementNsUri.length() > 0; if(genPrefix) { // todo: it's possible that the generated prefix already mapped. this should be fixed prefix = "ns_" + elementLocalName; declareNamespace(prefix, elementNsUri); if(attrs == null) { attrs = new AttributesImpl(1); } attrs.add(null, prefix, "xmlns:" + prefix, null, elementNsUri); } for(int i = 0; i < attributeUses.getLength(); ++i) { currentAttribute = (XSAttributeUse)attributeUses.item(i); XSAttributeDeclaration attrDec = currentAttribute.getAttrDeclaration(); String attrNs = attrDec.getNamespace(); String attrLocal = attrDec.getName(); Object attrValue = provider.getAttributeValue(o, ctx, attrNs, attrLocal); if(attrValue != null) { if(attrs == null) { attrs = new AttributesImpl(5); } String attrPrefix = null; if(attrNs != null) { attrPrefix = getPrefix(attrNs); if(attrPrefix == null && attrNs != null && attrNs.length() > 0) { attrPrefix = "ns_" + attrLocal; attrs.add(null, attrPrefix, "xmlns:" + attrPrefix, null, attrNs); } } String qName = attrPrefix == null || attrPrefix.length() == 0 ? attrLocal : attrPrefix + ":" + attrLocal; // todo: this is a quick fix for boolean pattern (0|1 or true|false) should be refactored XSSimpleTypeDefinition attrType = attrDec.getTypeDefinition(); if(attrType.getItemType() != null) { XSSimpleTypeDefinition itemType = attrType.getItemType(); if(Constants.NS_XML_SCHEMA.equals(itemType.getNamespace())) { List list; if(attrValue instanceof List) { list = (List)attrValue; } else if(attrValue.getClass().isArray()) { list = Arrays.asList((QName[])attrValue); } else { throw new JBossXBRuntimeException("Expected value for list type is an array or " + List.class.getName() + " but got: " + attrValue ); } if(Constants.QNAME_QNAME.getLocalPart().equals(itemType.getName())) { for(int listInd = 0; listInd < list.size(); ++listInd) { QName item = (QName)list.get(listInd); String itemNs = item.getNamespaceURI(); if(itemNs != null && itemNs.length() > 0) { String itemPrefix; if(itemNs.equals(elementNsUri)) { itemPrefix = prefix; } else { itemPrefix = getPrefix(itemNs); if(itemPrefix == null) { itemPrefix = attrLocal + listInd; declareNs(attrs, itemPrefix, itemNs); } } item = new QName(item.getNamespaceURI(), item.getLocalPart(), itemPrefix); list.set(listInd, item); } } } attrValue = SimpleTypeBindings.marshalList(itemType.getName(), list, null); } else { throw new JBossXBRuntimeException("Marshalling of list types with item types not from " + Constants.NS_XML_SCHEMA + " is not supported." ); } } else if(attrType.getLexicalPattern().item(0) != null && attrType.derivedFrom(Constants.NS_XML_SCHEMA, Constants.QNAME_BOOLEAN.getLocalPart(), XSConstants.DERIVATION_RESTRICTION )) { String item = attrType.getLexicalPattern().item(0); if(item.indexOf('0') != -1 && item.indexOf('1') != -1) { attrValue = ((Boolean)attrValue).booleanValue() ? "1" : "0"; } else { attrValue = ((Boolean)attrValue).booleanValue() ? "true" : "false"; } } else if(Constants.QNAME_QNAME.getNamespaceURI().equals(attrType.getNamespace()) && Constants.QNAME_QNAME.getLocalPart().equals(attrType.getName())) { QName qNameValue = (QName)attrValue; String qNamePrefix = null; boolean declarePrefix = false; String ns = qNameValue.getNamespaceURI(); if(ns != null && ns.length() > 0) { qNamePrefix = getPrefix(ns); if(qNamePrefix == null) { qNamePrefix = qNameValue.getPrefix(); if(qNamePrefix == null || qNamePrefix.length() == 0) { qNamePrefix = "ns_" + qNameValue.getLocalPart(); } declareNs(attrs, qNamePrefix, ns); nsRegistry.addPrefixMapping(qNamePrefix, ns); declarePrefix = true; } } attrValue = SimpleTypeBindings.marshalQName(qNameValue, nsRegistry); if(declarePrefix) { nsRegistry.removePrefixMapping(qNamePrefix); } } else { attrValue = attrValue.toString(); } attrs.add(attrNs, attrLocal, qName, attrDec.getTypeDefinition().getName(), attrValue.toString() ); } } currentAttribute = null; String characters = null; if(type.getSimpleType() != null) { Object value = getSimpleContentValue(elementNsUri, elementLocalName, type); if(value != null) { XSSimpleTypeDefinition simpleType = type.getSimpleType(); String typeName = simpleType.getName(); if(attrs == null && (SimpleTypeBindings.XS_QNAME_NAME.equals(typeName) || SimpleTypeBindings.XS_NOTATION_NAME.equals(typeName) || simpleType.getItemType() != null && (SimpleTypeBindings.XS_QNAME_NAME.equals(simpleType.getItemType().getName()) || SimpleTypeBindings.XS_NOTATION_NAME.equals(simpleType.getItemType().getName()) ) ) ) { attrs = new AttributesImpl(5); } characters = marshalCharacters(elementNsUri, prefix, simpleType, value, attrs); } } String qName = prefixLocalName(prefix, elementLocalName); content.startElement(elementNsUri, elementLocalName, qName, attrs); if(particle != null) { marshalParticle(particle, false); } if(characters != null) { content.characters(characters.toCharArray(), 0, characters.length()); } content.endElement(elementNsUri, elementLocalName, qName); if(genPrefix) { removePrefixMapping(prefix); } if(generatedPrefix != null) { removePrefixMapping(generatedPrefix); } } private boolean marshalParticle(XSParticle particle, boolean declareNs) { boolean marshalled; XSTerm term = particle.getTerm(); Object o; Iterator i; switch(term.getType()) { case XSConstants.MODEL_GROUP: o = stack.peek(); i = o != null && isRepeatable(particle) ? getIterator(o) : null; if(i != null) { marshalled = true; while(i.hasNext() && marshalled) { Object value = i.next(); stack.push(value); marshalled = marshalModelGroup(particle, declareNs); stack.pop(); } } else { marshalled = marshalModelGroup(particle, declareNs); } break; case XSConstants.WILDCARD: o = stack.peek(); boolean popWildcardValue = false; ObjectLocalMarshaller marshaller = null; FieldToWildcardMapping mapping = (FieldToWildcardMapping)field2WildcardMap.get(o.getClass()); if(mapping != null) { marshaller = mapping.marshaller; o = mapping.fieldInfo.getValue(o); stack.push(o); popWildcardValue = true; } i = o != null && isRepeatable(particle) ? getIterator(o) : null; if(i != null) { marshalled = true; while(i.hasNext() && marshalled) { Object value = i.next(); marshalled = marshalWildcardOccurence(particle, marshaller, value, declareNs); } } else { marshalled = marshalWildcardOccurence(particle, marshaller, o, declareNs); } if(popWildcardValue) { stack.pop(); } break; case XSConstants.ELEMENT_DECLARATION: XSElementDeclaration element = (XSElementDeclaration)term; XSTypeDefinition type = element.getTypeDefinition(); o = getElementValue(element.getNamespace(), element.getName(), type); i = o != null && isRepeatable(particle) ? getIterator(o) : null; if(i != null) { marshalled = true; while(i.hasNext() && marshalled) { Object value = i.next(); marshalled = marshalElementOccurence(element.getNamespace(), element.getName(), type, value, element.getNillable(), particle.getMinOccurs() == 0, declareNs ); } } else { marshalled = marshalElementOccurence(element.getNamespace(), element.getName(), type, o, element.getNillable(), particle.getMinOccurs() == 0, declareNs ); } break; default: throw new IllegalStateException("Unexpected term type: " + term.getType()); } return marshalled; } private boolean marshalElementOccurence(String elementNs, String elementLocal, XSTypeDefinition type, Object value, boolean nillable, boolean optional, boolean declareNs) { boolean declareXsiType = false; QName xsiTypeQName = null; if(value != null) { xsiTypeQName = (QName)cls2TypeMap.get(value.getClass()); if(xsiTypeQName != null && !(type.getName().equals(xsiTypeQName.getLocalPart()) && type.getNamespace().equals(xsiTypeQName.getNamespaceURI()) )) { declareXsiType = true; if(log.isTraceEnabled()) { log.trace(value.getClass() + " is mapped to xsi:type " + xsiTypeQName); } XSTypeDefinition xsiType = model.getTypeDefinition(xsiTypeQName.getLocalPart(), xsiTypeQName.getNamespaceURI() ); if(xsiType == null) { log.warn("Class " + value.getClass() + " is mapped to type " + xsiTypeQName + " but the type is not found in schema." ); } // todo should check derivation also, i.e. if(xsiType.derivedFrom()) else { type = xsiType; } } } stack.push(value); boolean marshalled = marshalElement(elementNs, elementLocal, type, optional, nillable, declareNs, declareXsiType ); stack.pop(); return marshalled; } private boolean marshalWildcardOccurence(XSParticle particle, ObjectLocalMarshaller marshaller, Object value, boolean declareNs) { boolean marshalled = true; if(marshaller != null) { marshaller.marshal(ctx, value); } else { stack.push(value); marshalled = marshalWildcard(particle, declareNs); stack.pop(); } return marshalled; } private boolean marshalWildcard(XSParticle particle, boolean declareNs) { XSWildcard wildcard = (XSWildcard)particle.getTerm(); Object o = stack.peek(); ClassMapping mapping = getClassMapping(o.getClass()); if(mapping == null) { // todo: YAH (yet another hack) QName autoType = SimpleTypeBindings.typeQName(o.getClass()); if(autoType != null) { String marshalled = SimpleTypeBindings.marshal(autoType.getLocalPart(), o, null); content.characters(marshalled.toCharArray(), 0, marshalled.length()); return true; } else { if(ignoreUnresolvedWildcard) { log.warn("Failed to marshal wildcard. Class mapping not found for " + o.getClass() + "@" + o.hashCode() + ": " + o ); return true; } else { throw new IllegalStateException("Failed to marshal wildcard. Class mapping not found for " + o.getClass() + "@" + o.hashCode() + ": " + o ); } } } GenericObjectModelProvider parentProvider = this.provider; Object parentRoot = this.root; Stack parentStack = this.stack; XSModel parentModel = this.model; this.root = o; this.stack = new StackImpl(); this.model = mapping.schemaUrl == null ? this.model : Util.loadSchema(mapping.schemaUrl, schemaResolver); if(mapping.provider != null) { this.provider = mapping.provider; } boolean marshalled; if(mapping.elementName != null) { XSElementDeclaration elDec = model.getElementDeclaration(mapping.elementName.getLocalPart(), mapping.elementName.getNamespaceURI() ); if(elDec == null) { throw new JBossXBRuntimeException("Element " + mapping.elementName + " is not declared in the schema."); } Object elementValue = provider.getRoot(root, null, elDec.getNamespace(), elDec.getName()); marshalled = marshalElementOccurence(elDec.getNamespace(), elDec.getName(), elDec.getTypeDefinition(), elementValue, elDec.getNillable(), particle.getMinOccurs() == 0, declareNs ); } else if(mapping.typeName != null) { XSTypeDefinition typeDef = model.getTypeDefinition(mapping.typeName.getLocalPart(), mapping.typeName.getNamespaceURI() ); if(typeDef == null) { List typeNames = new ArrayList(); XSNamedMap types = model.getComponents(XSConstants.TYPE_DEFINITION); for(int i = 0; i < types.getLength(); ++i) { XSObject type = types.item(i); if(!Constants.NS_XML_SCHEMA.equals(type.getNamespace())) { typeNames.add(new QName(type.getNamespace(), type.getName())); } } throw new JBossXBRuntimeException("Type " + mapping.typeName + " is not defined in the schema." + " Defined types are: " + typeNames ); } Object elementValue = provider.getRoot(root, null, wildcard.getNamespace(), wildcard.getName()); marshalled = marshalElementOccurence(wildcard.getNamespace(), wildcard.getName(), typeDef, elementValue, true, particle.getMinOccurs() == 0, declareNs ); } else { throw new JBossXBRuntimeException("Class mapping for " + mapping.cls + " is associated with neither global element name nor global type name." ); } this.root = parentRoot; this.provider = parentProvider; this.stack = parentStack; this.model = parentModel; return marshalled; } private boolean marshalModelGroup(XSParticle particle, boolean declareNs) { XSModelGroup modelGroup = (XSModelGroup)particle.getTerm(); boolean marshalled; switch(modelGroup.getCompositor()) { case XSModelGroup.COMPOSITOR_ALL: marshalled = marshalModelGroupAll(modelGroup.getParticles(), declareNs); break; case XSModelGroup.COMPOSITOR_CHOICE: marshalled = marshalModelGroupChoice(modelGroup.getParticles(), declareNs); break; case XSModelGroup.COMPOSITOR_SEQUENCE: marshalled = marshalModelGroupSequence(modelGroup.getParticles(), declareNs); break; default: throw new IllegalStateException("Unexpected compsitor: " + modelGroup.getCompositor()); } return marshalled; } private boolean marshalModelGroupAll(XSObjectList particles, boolean declareNs) { boolean marshalled = false; for(int i = 0; i < particles.getLength(); ++i) { XSParticle particle = (XSParticle)particles.item(i); marshalled |= marshalParticle(particle, declareNs); } return marshalled; } private boolean marshalModelGroupChoice(XSObjectList particles, boolean declareNs) { boolean marshalled = false; Content mainContent = this.content; for(int i = 0; i < particles.getLength() && !marshalled; ++i) { XSParticle particle = (XSParticle)particles.item(i); this.content = new Content(); marshalled = marshalParticle(particle, declareNs); } if(marshalled) { mainContent.append(this.content); } this.content = mainContent; return marshalled; } private boolean marshalModelGroupSequence(XSObjectList particles, boolean declareNs) { boolean marshalled = true; for(int i = 0; i < particles.getLength(); ++i) { XSParticle particle = (XSParticle)particles.item(i); marshalled &= marshalParticle(particle, declareNs); } return marshalled; } private String marshalCharacters(String elementUri, String elementPrefix, XSSimpleTypeDefinition type, Object value, AttributesImpl attrs) { String marshalled; if(type.getItemType() != null) { XSSimpleTypeDefinition itemType = type.getItemType(); if(Constants.NS_XML_SCHEMA.equals(itemType.getNamespace())) { List list; if(value instanceof List) { list = (List)value; } else if(value.getClass().isArray()) { list = asList(value); } else { // todo: qname are also not yet supported throw new JBossXBRuntimeException( "Expected value for list type is an array or " + List.class.getName() + " but got: " + value ); } marshalled = SimpleTypeBindings.marshalList(itemType.getName(), list, null); } else { throw new JBossXBRuntimeException("Marshalling of list types with item types not from " + Constants.NS_XML_SCHEMA + " is not supported." ); } } else if(Constants.NS_XML_SCHEMA.equals(type.getNamespace())) { String typeName = type.getName(); String prefix = null; boolean removePrefix = false; if(SimpleTypeBindings.XS_QNAME_NAME.equals(typeName) || SimpleTypeBindings.XS_NOTATION_NAME.equals(typeName)) { QName qName = (QName)value; if(qName.getNamespaceURI() != null && qName.getNamespaceURI().length() > 0) { prefix = nsRegistry.getPrefix(qName.getNamespaceURI()); if(prefix == null) { prefix = qName.getPrefix(); if(prefix == null || prefix.length() == 0) { prefix = qName.getLocalPart() + "_ns"; } nsRegistry.addPrefixMapping(prefix, qName.getNamespaceURI()); declareNs(attrs, prefix, qName.getNamespaceURI()); removePrefix = true; } } } marshalled = SimpleTypeBindings.marshal(typeName, value, nsRegistry); if(removePrefix) { nsRegistry.removePrefixMapping(prefix); } } // todo: this is a quick fix for boolean pattern (0|1 or true|false) should be refactored else if(type.getLexicalPattern().item(0) != null && type.derivedFrom(Constants.NS_XML_SCHEMA, Constants.QNAME_BOOLEAN.getLocalPart(), XSConstants.DERIVATION_RESTRICTION )) { String item = type.getLexicalPattern().item(0); if(item.indexOf('0') != -1 && item.indexOf('1') != -1) { marshalled = ((Boolean)value).booleanValue() ? "1" : "0"; } else { marshalled = ((Boolean)value).booleanValue() ? "true" : "false"; } } else { StringList lexicalEnumeration = type.getLexicalEnumeration(); if(lexicalEnumeration != null && lexicalEnumeration.getLength() > 0) { Method getValue; try { getValue = value.getClass().getMethod("value", null); } catch(NoSuchMethodException e) { try { getValue = value.getClass().getMethod("getValue", null); } catch(NoSuchMethodException e1) { List values = new ArrayList(lexicalEnumeration.getLength()); for(int i = 0; i < lexicalEnumeration.getLength(); ++i) { values.add(lexicalEnumeration.item(i)); } throw new JBossXBRuntimeException("Failed to find neither value() nor getValue() in " + value.getClass() + " which is bound to enumeration type (" + type.getNamespace() + ", " + type.getName() + "): " + values ); } } try { value = getValue.invoke(value, null); } catch(Exception e) { throw new JBossXBRuntimeException( "Failed to invoke getValue() on " + value + " to get the enumeration value", e ); } } marshalled = marshalCharacters(elementUri, elementPrefix, (XSSimpleTypeDefinition)type.getBaseType(), value, attrs ); } return marshalled; } /** * Adds xsi:type attribute and optionally declares namespaces for xsi and type's namespace. * @param type the type to declare xsi:type attribute for * @param attrs the attributes to add xsi:type attribute to * @return prefix for the type's ns if it was generated */ private String declareXsiType(XSTypeDefinition type, AttributesImpl attrs) { String result = null; String xsiPrefix = nsRegistry.getPrefix(Constants.NS_XML_SCHEMA_INSTANCE); if(xsiPrefix == null) { attrs.add(Constants.NS_XML_SCHEMA, "xmlns", "xmlns:xsi", null, Constants.NS_XML_SCHEMA_INSTANCE); xsiPrefix = "xsi"; } String pref = getPrefix(type.getNamespace()); if(pref == null) { // the ns is not declared result = pref = type.getName() + "_ns"; } String typeQName = pref == null ? type.getName() : pref + ':' + type.getName(); attrs.add(Constants.NS_XML_SCHEMA_INSTANCE, "type", xsiPrefix + ":type", null, typeQName); return result; } private Object getElementValue(String elementNs, String elementLocal, XSTypeDefinition type) { Object value; Object peeked = stack.isEmpty() ? root : stack.peek(); if(peeked == null) { value = null; } else if(peeked instanceof Collection || peeked.getClass().isArray()) { // collection is the provider value = peeked; } else { XSTypeDefinition parentType = currentElementType; currentElementType = type; value = provider.getChildren(peeked, ctx, elementNs, elementLocal); if(value == null) { value = provider.getElementValue(peeked, ctx, elementNs, elementLocal); } currentElementType = parentType; } return value; } private Object getSimpleContentValue(String elementNs, String elementLocal, XSTypeDefinition type) { Object value; Object peeked = stack.isEmpty() ? root : stack.peek(); if(peeked == null) { value = null; } else { XSTypeDefinition parentType = currentElementType; currentElementType = type; value = provider.getElementValue(peeked, ctx, elementNs, elementLocal); currentElementType = parentType; } return value; } private void writeNillable(String elementNs, String elementLocal, boolean nillable) { if(!supportNil) { return; } if(!nillable) { throw new JBossXBRuntimeException("Failed to marshal " + new QName(elementNs, elementLocal) + ": Java value is null but the element is not nillable." ); } AttributesImpl attrs; String prefix = getPrefix(elementNs); if(prefix == null && elementNs != null && elementNs.length() > 0) { prefix = "ns_" + elementLocal; attrs = new AttributesImpl(2); attrs.add(null, prefix, "xmlns:" + prefix, null, elementNs); } else { attrs = new AttributesImpl(1); } String xsiPrefix = getPrefix(Constants.NS_XML_SCHEMA_INSTANCE); if(xsiPrefix == null) { xsiPrefix = "xsi"; attrs.add(null, xsiPrefix, "xmlns:xsi", null, Constants.NS_XML_SCHEMA_INSTANCE ); } String nilQName = xsiPrefix + ":nil"; attrs.add(Constants.NS_XML_SCHEMA_INSTANCE, "nil", nilQName, null, "1"); String qName = prefixLocalName(prefix, elementLocal); content.startElement(elementNs, elementLocal, qName, attrs); content.endElement(elementNs, elementLocal, qName); } private static boolean isArrayWrapper(XSTypeDefinition type) { boolean is = false; if(XSTypeDefinition.COMPLEX_TYPE == type.getTypeCategory()) { XSComplexTypeDefinition cType = (XSComplexTypeDefinition)type; XSParticle particle = cType.getParticle(); if(particle != null) { is = particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1; } } return is; } private Iterator getIterator(Object value) { Iterator i = null; if(value instanceof Collection) { i = ((Collection)value).iterator(); } else if(value.getClass().isArray()) { final Object arr = value; i = new Iterator() { private int curInd = 0; private int length = Array.getLength(arr); public boolean hasNext() { return curInd < length; } public Object next() { return Array.get(arr, curInd++); } public void remove() { throw new UnsupportedOperationException("remove is not implemented."); } }; } else if(value instanceof Iterator) { i = (Iterator)value; } else { //throw new JBossXBRuntimeException("Unexpected type for children: " + value.getClass()); } return i; } private static boolean isRepeatable(XSParticle particle) { return particle.getMaxOccursUnbounded() || particle.getMaxOccurs() > 1 || particle.getMinOccurs() > 1; } private static final List asList(final Object arr) { return new AbstractList() { private final Object array = arr; public Object get(int index) { return Array.get(array, index); } public int size() { return Array.getLength(array); } }; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/parser/0000755000175000017500000000000011620316767027526 5ustar twernertwernerlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/parser/sax/0000755000175000017500000000000011620316767030321 5ustar twernertwerner././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/parser/sax/SaxJBossXBParser.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/parser/sax/SaxJBossXBPars0000644000175000017500000003026011426265127033016 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.parser.sax; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.jboss.logging.Logger; import org.jboss.util.JBossStringBuilder; import org.jboss.util.xml.JBossEntityResolver; import org.jboss.xb.binding.JBossXBException; import org.jboss.xb.binding.JBossXBRuntimeException; import org.jboss.xb.binding.parser.JBossXBParser; import org.xml.sax.Attributes; import org.xml.sax.EntityResolver; import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.Locator; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; /** * @author Alexey Loubyansky * @version $Revision: 4825 $ */ public class SaxJBossXBParser implements JBossXBParser, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler, ErrorHandler { private static final Logger log = Logger.getLogger("org.jboss.xb.binding.parser.sax.SaxJBossXBParser"); private static final SAXParserFactory saxFactory = SAXParserFactory.newInstance(); static { saxFactory.setValidating(true); saxFactory.setNamespaceAware(true); try { saxFactory.setXIncludeAware(true); } catch (UnsupportedOperationException e) { log.trace("setXIncludeAware is not supported by the SAXParserFactory", e); } } private final SAXParser parser; private final XMLReader reader; private JBossXBParser.ContentHandler contentHandler; private boolean trace; private boolean warnOnParserErrors; public SaxJBossXBParser() throws JBossXBException { trace = log.isTraceEnabled(); try { parser = saxFactory.newSAXParser(); reader = parser.getXMLReader(); } catch(Exception e) { throw new JBossXBException("Failed to create a new SAX parser", e); } reader.setContentHandler(this); reader.setErrorHandler(this); reader.setEntityResolver( new EntityResolver() { private EntityResolver delegate; public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if(delegate == null) delegate = new JBossEntityResolver(); return delegate.resolveEntity(publicId, systemId); } } ); // LexicalHandler try { reader.setProperty("http://xml.org/sax/properties/lexical-handler", this); } catch(Exception e) { log.trace("LexicalHandler", e); } /* setFeature(Unmarshaller.VALIDATION, true); setFeature(Unmarshaller.SCHEMA_VALIDATION, true); setFeature(Unmarshaller.SCHEMA_FULL_CHECKING, true); setFeature(Unmarshaller.DYNAMIC_VALIDATION, true); setFeature(Unmarshaller.NAMESPACES, true); */ } // JBossXBParser implementation public void setWarnOnParserErrors(boolean value) { this.warnOnParserErrors = value; } /** * This property controls whether the (underlying) parser errors should be * logged as warnings or should they terminate parsing with errors. * The default is to terminate parsing by re-throwing parser errors. * * @return false if parser errors should be logged as warnings, otherwise - true */ public boolean getWarnOnParserErrors() { return this.warnOnParserErrors; } public void setEntityResolver(EntityResolver entityResolver) throws JBossXBException { reader.setEntityResolver(entityResolver); } public void setProperty(String name, Object value) { try { reader.setProperty(name, value); } catch(SAXException e) { throw new JBossXBRuntimeException("Failed to set property on the XML reader", e); } } public void setFeature(String name, boolean value) { try { reader.setFeature(name, value); if(trace) log.trace(name+" set to: "+reader.getFeature(name)); } catch(SAXException e) { throw new JBossXBRuntimeException("Failed to set feature on the XMLReader", e); } } public void parse(String systemId, ContentHandler handler) throws JBossXBException { this.contentHandler = handler; if(trace) logParserInfo(); try { reader.parse(systemId); } catch(Throwable e) { throw new JBossXBException("Failed to parse source: " + getLocationAsString(systemId), e); } } public void parse(InputStream is, ContentHandler handler) throws JBossXBException { parse(new InputSource(is), handler); } public void parse(Reader reader, ContentHandler handler) throws JBossXBException { parse(new InputSource(reader), handler); } public void parse(InputSource source, ContentHandler handler) throws JBossXBException { this.contentHandler = handler; if(trace) logParserInfo(); try { reader.parse(source); } catch(Throwable e) { String str; if(locator != null) str = getLocationAsString(null); else if(source.getSystemId() != null) str = source.getSystemId(); else if(source.getByteStream() != null) str = source.getByteStream().toString(); else if(source.getCharacterStream() != null) str = source.getCharacterStream().toString(); else str = ""; throw new JBossXBException("Failed to parse source: " + str, e); } } public String getLocationAsString(String fileName) { if (locator == null) return fileName; else { JBossStringBuilder buffer = new JBossStringBuilder(); String id = locator.getSystemId(); if (id == null) id = locator.getPublicId(); if (id == null) id = "xml_stream"; buffer.append(id).append('@'); buffer.append(locator.getLineNumber()); buffer.append(','); buffer.append(locator.getColumnNumber()); return buffer.toString(); } } private void logParserInfo() { StringBuffer sb = new StringBuffer(); sb.append("Created parser: ").append(parser) .append(", isNamespaceAware: ").append(parser.isNamespaceAware()) .append(", isValidating: ").append(parser.isValidating()) .append(", isXIncludeAware: "); try { sb.append(parser.isXIncludeAware()); } catch(UnsupportedOperationException e) { sb.append("unsupported operation '").append(e.getMessage()).append('\''); } log.trace(sb.toString()); } // LexicalHandler private Locator locator; public void comment(char[] ch, int start, int length) throws SAXException { } public void startDTD(String name, String publicId, String systemId) throws SAXException { if (contentHandler instanceof DtdAwareContentHandler) { DtdAwareContentHandler dach = (DtdAwareContentHandler) contentHandler; dach.startDTD(name, publicId, systemId); } } public void endDTD() throws SAXException { if (contentHandler instanceof DtdAwareContentHandler) { DtdAwareContentHandler dach = (DtdAwareContentHandler) contentHandler; dach.endDTD(); } } public void startEntity(String name) throws SAXException { } public void endEntity(String name) throws SAXException { } public void startCDATA() throws SAXException { } public void endCDATA() throws SAXException { } // ContentHandler public void endDocument() { } public void startDocument() { } public void characters(char ch[], int start, int length) { // todo look at this later // do not notify content handler if these are just whitespaces //int i = start; //while(i < start + length) //{ // if(!Character.isWhitespace(ch[i++])) // { contentHandler.characters(ch, start, length); // break; // } //} } public void ignorableWhitespace(char ch[], int start, int length) { } public void endPrefixMapping(String prefix) { contentHandler.endPrefixMapping(prefix); } public void skippedEntity(String name) { } public Locator getDocumentLocator() { return locator; } public void setDocumentLocator(Locator locator) { this.locator = locator; } public void processingInstruction(String target, String data) { contentHandler.processingInstruction(target, data); } public void startPrefixMapping(String prefix, String uri) { contentHandler.startPrefixMapping(prefix, uri); } public void endElement(String namespaceURI, String localName, String qName) { if (trace) { String name = localName.length() == 0 ? qName : namespaceURI + ':' + localName; log.trace("Enter endElement " + name); try { contentHandler.endElement(namespaceURI, localName, qName); } finally { log.trace("Exit endElement " + name); } } else contentHandler.endElement(namespaceURI, localName, qName); } public void startElement(String namespaceURI, String localName, String qName, Attributes atts) { if (trace) { String name = localName.length() == 0 ? qName : namespaceURI + ':' + localName; log.trace("Enter startElement " + name); try { contentHandler.startElement(namespaceURI, localName, qName, atts); } finally { log.trace("Exit startElement " + name); } } else contentHandler.startElement(namespaceURI, localName, qName, atts); } // Error handling public void warning(SAXParseException exception) { log.warn(formatMessage(exception)); } public void error(SAXParseException exception) throws SAXException { if(this.warnOnParserErrors) log.warn(formatMessage(exception)); else throw new SAXException(formatMessage(exception)); } public void fatalError(SAXParseException exception) throws SAXException { throw new SAXException(formatMessage(exception)); } public String formatMessage(SAXParseException exception) { StringBuffer buffer = new StringBuffer(50); buffer.append(exception.getMessage()).append(" @ "); String location = exception.getPublicId(); if (location != null) { buffer.append(location); } else { location = exception.getSystemId(); if (location != null) { buffer.append(location); } else { buffer.append("*unknown*"); } } buffer.append('['); buffer.append(exception.getLineNumber()).append(','); buffer.append(exception.getColumnNumber()).append(']'); return buffer.toString(); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/parser/JBossXBParser.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/parser/JBossXBParser.java0000644000175000017500000000630311426265127033017 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding.parser; import java.io.InputStream; import java.io.Reader; import org.jboss.xb.binding.JBossXBException; import org.xml.sax.Attributes; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; /** * @author Alexey Loubyansky * @version $Revision: 4825 $ */ public interface JBossXBParser { interface ContentHandler { void characters(char[] ch, int start, int length); void endElement(String namespaceURI, String localName, String qName); void startElement(String namespaceURI, String localName, String qName, Attributes atts); void startPrefixMapping(String prefix, String uri); void endPrefixMapping(String prefix); void processingInstruction(String target, String data); Object getRoot(); } /** * Extended to support key SAX2 LexicalHandler events */ interface DtdAwareContentHandler extends ContentHandler { public void startDTD(String name, String publicId, String systemId); public void endDTD(); } /** * This property controls whether the (underlying) parser errors should be * logged as warnings or should they terminate parsing with errors. * The default is to terminate parsing by re-throwing parser errors. */ void setWarnOnParserErrors(boolean value); /** * This property controls whether the (underlying) parser errors should be * logged as warnings or should they terminate parsing with errors. * The default is to terminate parsing by re-throwing parser errors. * * @return false if parser errors should be logged as warnings, otherwise - true */ boolean getWarnOnParserErrors(); void setEntityResolver(EntityResolver entityResolver) throws JBossXBException; void setProperty(String name, Object value); void setFeature(String name, boolean value); void parse(String source, ContentHandler handler) throws JBossXBException; void parse(InputStream is, ContentHandler handler) throws JBossXBException; void parse(Reader reader, ContentHandler handler) throws JBossXBException; void parse(InputSource source, ContentHandler handler) throws JBossXBException; } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/Immutable.java0000644000175000017500000000757511061473704031024 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import org.jboss.logging.Logger; import java.util.List; import java.lang.reflect.Constructor; /** * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class Immutable { private static final Logger log = Logger.getLogger(Immutable.class); public final Class cls; final List names = new java.util.ArrayList(); final List values = new java.util.ArrayList(); public Immutable(Class cls) { this.cls = cls; if(log.isTraceEnabled()) { log.trace("created immutable container for " + cls); } } public void addChild(String localName, Object child) { if(!names.isEmpty() && names.get(names.size() - 1).equals(localName)) { throw new IllegalStateException("Attempt to add duplicate element " + localName + ": prev value=" + values.get(values.size() - 1) + ", new value=" + child ); } names.add(localName); values.add(child); if(log.isTraceEnabled()) { log.trace("added child " + localName + " for " + cls + ": " + child); } } public Object getChild(String localName) { return names.isEmpty() ? null : (names.get(names.size() - 1).equals(localName) ? values.get(values.size() - 1) : null); } public Object newInstance() { Constructor ctor = null; Constructor[] ctors = cls.getConstructors(); if(ctors == null || ctors.length == 0) { throw new JBossXBRuntimeException("The class has no declared constructors: " + cls); } for(int i = 0; i < ctors.length; ++i) { Class[] types = ctors[i].getParameterTypes(); if(types == null || types.length == 0) { throw new IllegalStateException("Found no-arg constructor for immutable " + cls); } if(types.length == values.size()) { ctor = ctors[i]; int typeInd = 0; while(typeInd < types.length) { if(!types[typeInd].isAssignableFrom(values.get(typeInd++).getClass())) { ctor = null; break; } } if(ctor != null) { break; } } } if(ctor == null) { throw new IllegalStateException("No constructor in " + cls + " that would take arguments " + values); } try { return ctor.newInstance(values.toArray()); } catch(Exception e) { throw new IllegalStateException("Failed to create immutable instance of " + cls + " using arguments: " + values + ": " + e.getMessage() ); } } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/DelegatingObjectModelFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/DelegatingObjectModelFact0000644000175000017500000002233711061473704033127 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import org.jboss.util.StringPropertyReplacer; import org.xml.sax.Attributes; import java.lang.reflect.Method; import java.util.Map; import java.util.HashMap; /** * GenericObjectModelFactory that delegates to a ObjectModelFactory * using reflection. * * @author Alexey Loubyansky * @author Scott.Stark@jboss.org * @version $Revision: 2913 $ */ public class DelegatingObjectModelFactory implements GenericObjectModelFactory { private final ObjectModelFactory typedFactory; private final Map, AddMethods> addMethodsByParent = new HashMap, AddMethods>(); private boolean replaceProps; public DelegatingObjectModelFactory(ObjectModelFactory typedFactory) { this.typedFactory = typedFactory; replaceProps = isReplacePropertyRefs(typedFactory); Method[] methods = typedFactory.getClass().getMethods(); for(int i = 0; i < methods.length; ++i) { Method method = methods[i]; if("addChild".equals(method.getName())) { Class parent = method.getParameterTypes()[0]; AddMethods addMethods = addMethodsByParent.get(parent); if(addMethods == null) { addMethods = new AddMethods(parent); addMethodsByParent.put(parent, addMethods); } addMethods.addMethod(method); } } } public void startDTD(String name, String publicId, String systemId) { try { Class[] sig = {String.class, String.class, String.class}; Method startDTD = typedFactory.getClass().getMethod("startDTD", sig); Object[] args = {name, publicId, systemId}; startDTD.invoke(typedFactory, args); } catch(Exception e) { // Ignore } } public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { return typedFactory.newRoot(root, navigator, namespaceURI, localName, attrs); } public Object newChild(Object parent, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { // Get the newChild method Class objClass = parent.getClass(); Class[] classes = new Class[] { objClass, UnmarshallingContext.class, String.class, String.class, Attributes.class }; Method method = ObjectModelBuilder.getMethodForElement(typedFactory, "newChild", classes); // If null, try to get the newChild method from the super class while (method == null && objClass.getSuperclass() != Object.class) { objClass = objClass.getSuperclass(); classes = new Class[] { objClass, UnmarshallingContext.class, String.class, String.class, Attributes.class }; method = ObjectModelBuilder.getMethodForElement(typedFactory, "newChild", classes); } // invoke the setValue method Object child = null; if (method != null) { Object[] objects = new Object[] { parent, navigator, namespaceURI, localName, attrs }; child = ObjectModelBuilder.invokeFactory(typedFactory, method, objects); } return child; } public void addChild(Object parent, Object child, UnmarshallingContext navigator, String namespaceURI, String localName) { /* Method method = ObjectModelBuilder.getMethodForElement(typedFactory, "addChild", new Class[]{ parent.getClass(), child.getClass(), ContentNavigator.class, String.class, String.class }); */ AddMethods addMethods = addMethodsByParent.get(parent.getClass()); if(addMethods != null) { Method method = addMethods.getMethodForChild(child.getClass()); if(method != null) { ObjectModelBuilder.invokeFactory(typedFactory, method, new Object[]{ parent, child, navigator, namespaceURI, localName } ); } } } public void setValue(Object o, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { // Get the setValue method Class objClass = o.getClass(); Class[] classes = new Class[] { objClass, UnmarshallingContext.class, String.class, String.class, String.class }; Method method = ObjectModelBuilder.getMethodForElement(typedFactory, "setValue", classes); // If null, try to get the setValue method from the super class while (method == null && objClass.getSuperclass() != Object.class) { objClass = objClass.getSuperclass(); classes = new Class[] { objClass, UnmarshallingContext.class, String.class, String.class, String.class }; method = ObjectModelBuilder.getMethodForElement(typedFactory, "setValue", classes); } // invoke the setValue method if (method != null) { // property replacement if( replaceProps ) value = StringPropertyReplacer.replaceProperties(value); Object[] objects = new Object[] { o, navigator, namespaceURI, localName, value }; ObjectModelBuilder.invokeFactory(typedFactory, method, objects); } } public Object completeRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName) { return root; } /** * Check whether gactory supports a boolean isReplacePropertyRefs() * method that determins if property replacement is done. * @return isReplacePropertyRefs value if found, true otherwise to * default replacement to true. */ static boolean isReplacePropertyRefs(ObjectModelFactory factory) { boolean replace = true; try { Class[] sig = {}; Method isReplace = factory.getClass().getMethod("isReplacePropertyRefs", sig); if( Boolean.class.isAssignableFrom(isReplace.getReturnType())) { Object[] args = {}; Boolean flag = (Boolean) isReplace.invoke(factory, args); replace = flag.booleanValue(); } } catch(Exception e) { // Ignore } return replace; } // Inner private static class AddMethods { private static final int DEFAULT_METHODS_SIZE = 10; public final Class parent; private Method[] methods = new Method[DEFAULT_METHODS_SIZE]; private int totalMethods; public AddMethods(Class parent) { this.parent = parent; } public void addMethod(Method m) { if(totalMethods == methods.length) { Method[] tmp = methods; methods = new Method[methods.length + DEFAULT_METHODS_SIZE]; System.arraycopy(tmp, 0, methods, 0, tmp.length); } methods[totalMethods++] = m; } public Method getMethodForChild(Class child) { Class closestParam = null; Method closestMethod = null; for(int i = 0; i < totalMethods; ++i) { Method method = methods[i]; Class param = method.getParameterTypes()[1]; if(param == child) { return method; } else if(param.isAssignableFrom(child) && (closestParam == null || closestParam.isAssignableFrom(param))) { closestParam = param; closestMethod = method; } } return closestMethod; } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof AddMethods)) { return false; } final AddMethods addMethods = (AddMethods)o; if(!parent.equals(addMethods.parent)) { return false; } return true; } public int hashCode() { return parent.hashCode(); } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/NamespaceRegistry.java0000644000175000017500000002442111061473704032517 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import java.io.Serializable; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.List; import java.util.ArrayList; /** * A simple namespace registry. * * It assignes namespace prefixes of the form 'ns?' where ? is an incrementing integer. * {@see registerURI(String,String)} * * [TODO] cleanup the api * * @author Thomas.Diesler@jboss.org * @author Alexey Loubyansky * @author Anil Saldhana * @since 08-June-2004 */ public class NamespaceRegistry implements NamespaceContext, Serializable { private static final long serialVersionUID = 8435680858785550261L; // The index of the last assigned prefix private int namespaceIndex; private final Map prefixByUri = new HashMap(); private final Map uriByPrefix = new HashMap(); public NamespaceRegistry() { } /** Register a QName and return a QName that is guarantied to have a prefix */ public QName registerQName(QName qname) { if (qname == null) return null; String nsURI = qname.getNamespaceURI(); String prefix = getPrefix(nsURI); if (prefix == null) { prefix = qname.getPrefix(); if (prefix.length() == 0) prefix = registerURI(nsURI, null); else prefix = registerURI(nsURI, prefix); } qname = new QName(nsURI, qname.getLocalPart(), prefix); return qname; } /** Register the given nsURI/prefix combination. * In case the prefix is null, it will be assigend. * * @param nsURI The nsURI * @param prefix The corresponding prefix, maybe null * @return A prefix, never null */ public String registerURI(String nsURI, String prefix) { if (prefix == null) { prefix = "ns" + (++namespaceIndex); } addPrefixMapping(prefix, nsURI); return prefix; } /** * Adds prefix mapping. * * @param prefix prefix to map * @param nsURI the URI to prefix to */ public void addPrefixMapping(String prefix, String nsURI) { if (nsURI == null) throw new IllegalArgumentException("Cannot add mapping for null namespace URI"); Object obj = uriByPrefix.get(prefix); if (nsURI.equals(obj) == false) { if (obj == null) { uriByPrefix.put(prefix, nsURI); } else if (obj instanceof String) { List list = new ArrayList(); list.add((String) obj); list.add(nsURI); uriByPrefix.put(prefix, list); } else if (obj instanceof List) { ((List)obj).add(nsURI); } else { throwUnexpectedEntryException(obj); } obj = prefixByUri.get(nsURI); if (obj == null) { prefixByUri.put(nsURI, prefix); } else if (obj instanceof String) { List list = new ArrayList(); list.add((String) obj); list.add(prefix); prefixByUri.put(nsURI, list); } else if (obj instanceof List) { ((List)obj).add(prefix); } else { throwUnexpectedEntryException(obj); } } } /** * Removes the last mapping for the given prefix. * * @param prefix the prefix to remove mapping for */ public void removePrefixMapping(String prefix) { Object obj = uriByPrefix.get(prefix); if (obj != null) { String uri = null; if (obj instanceof String) { uri = (String)obj; uriByPrefix.remove(prefix); } else if (obj instanceof List) { List list = (List)obj; uri = (String)list.remove(list.size() - 1); if (list.isEmpty()) { uriByPrefix.remove(prefix); } } else { throwUnexpectedEntryException(obj); } if (uri != null) { obj = prefixByUri.get(uri); if (obj instanceof String) { if (!prefix.equals(obj)) { throw new IllegalStateException("Inconsistent mapping: prefix=" + prefix + ", found=" + obj); } prefixByUri.remove(uri); } else if (obj instanceof List) { List list = (ArrayList)obj; list.remove(prefix); if (list.isEmpty()) { prefixByUri.remove(uri); } } else { throwUnexpectedEntryException(obj); } } } } /** * Unregisters all prefix mappings for the given URI, not just the last one added. * todo what is this used for? * * @param nsURI the URI to unregister */ public void unregisterURI(String nsURI) { Object obj = prefixByUri.get(nsURI); if (obj != null) { String prefix = null; if (obj instanceof String) { prefix = (String)obj; prefixByUri.remove(nsURI); removePrefixMappingOnly(prefix, nsURI); } else if (obj instanceof List) { List list = (List)obj; for (int i = 0; i < list.size(); ++i) { removePrefixMappingOnly((String)list.get(i), nsURI); } prefixByUri.remove(nsURI); } else { throwUnexpectedEntryException(obj); } } } /** True if the given nsURI is registered. */ public boolean isRegistered(String nsURI) { return prefixByUri.containsKey(nsURI); } /** Return an iterator over all registered nsURIs. */ public Iterator getRegisteredURIs() { return prefixByUri.keySet().iterator(); } /** Return an iterator over all registered nsURIs. */ public Iterator getRegisteredPrefixes() { return uriByPrefix.keySet().iterator(); } /** * @return the number of registered URIs */ public int size() { return prefixByUri.size(); } // NamespaceContext implementation /** * Returns the last mapping for the prefix or null if the prefix was not mapped. */ public String getPrefix(String nsURI) { Object obj = prefixByUri.get(nsURI); String prefix = null; if (obj != null) { if (obj instanceof String) { prefix = (String)obj; } else if (obj instanceof List) { List list = (List)obj; prefix = (String)list.get(list.size() - 1); } else { throwUnexpectedEntryException(obj); } } return prefix; } /** * Returns all prefixes for the given URI. * * @param namespaceURI the URI to return prefixes for * @return prefixes mapped to the URI */ public Iterator getPrefixes(String namespaceURI) { Object obj = prefixByUri.get(namespaceURI); Iterator result = null; if (obj == null) { result = Collections.EMPTY_LIST.iterator(); } else if (obj instanceof String) { result = Collections.singletonList((String)obj).iterator(); } else if (obj instanceof List) { result = ((List)obj).iterator(); } else { throwUnexpectedEntryException(obj); } return result; } /** Get the nsURI for a given prefix, maybe null. */ public String getNamespaceURI(String prefix) { Object obj = uriByPrefix.get(prefix); String uri = null; if (obj != null) { if (obj instanceof String) { uri = (String)obj; } else if (obj instanceof List) { List list = (List)obj; uri = (String)list.get(list.size() - 1); } else { throwUnexpectedEntryException(obj); } } return uri; } // Private private void removePrefixMappingOnly(String prefix, String nsURI) { Object obj = uriByPrefix.get(prefix); if (obj instanceof String) { if (!obj.equals(nsURI)) { throw new IllegalStateException("Inconsistent mapping: uri=" + nsURI + ", found=" + obj); } uriByPrefix.remove(prefix); } else if (obj instanceof List) { List list = (List) obj; list.remove(prefix); if (list.isEmpty()) { uriByPrefix.remove(prefix); } } } private void throwUnexpectedEntryException(Object entry) { throw new IllegalStateException("Unexpected entry type: expected java.lang.String or java.util.List but got " + entry.getClass()); } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/ObjectModelBuilder.java0000644000175000017500000003732211321376347032600 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import org.xml.sax.Attributes; import org.jboss.logging.Logger; import org.jboss.xb.binding.parser.JBossXBParser; import org.apache.xerces.xs.XSTypeDefinition; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import java.util.Map; import java.util.HashMap; import java.util.Collections; import java.util.StringTokenizer; import java.util.Iterator; import java.util.List; import java.util.ArrayList; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** * An instance of this class translates SAX events into org.jboss.xml.binding.GenericObjectModelFactory calls * such as newChild, addChild and setValue. * WARN: this implementation is not thread-safe! * * @author Alexey Loubyansky * @version $Revision: 3903 $ */ public class ObjectModelBuilder implements UnmarshallingContext, JBossXBParser.DtdAwareContentHandler { /** * logger */ private static final Logger log = Logger.getLogger(ObjectModelBuilder.class); /** * The object that represents an ignored by the object model factory XML element, i.e. the factory returned null * from its newChild method */ private static final Object IGNORED = new Object(); /** * The root of the unmarshalled object graph */ private Object root; /** * the stack of all the objects including IGNORED */ private Stack all = new StackImpl(); /** * the stack of only accepted objects (all - IGNORED) */ private Stack accepted = new StackImpl(); private GenericObjectModelFactory curFactory; private String curNameSwitchingFactory; private String curNsSwitchingFactory; private Stack nameSwitchingFactory; private Stack nsSwitchingFactory; /** * default object model factory */ private GenericObjectModelFactory defaultFactory; /** * factories mapped to namespace URIs */ private Map factoriesToNs = Collections.emptyMap(); /** * NamespaceContext implementation */ private final NamespaceRegistry nsRegistry = new NamespaceRegistry(); // whether text content should be trimmed before it is set private boolean trimTextContent = true; // for backwards compatibility private boolean trace = log.isTraceEnabled(); // Public public void mapFactoryToNamespace(ObjectModelFactory factory, String namespaceUri) { if(factoriesToNs.isEmpty()) { factoriesToNs = new HashMap(); } factoriesToNs.put(namespaceUri, getGenericObjectModelFactory(factory)); } public void init(ObjectModelFactory defaultFactory, Object root) { this.defaultFactory = getGenericObjectModelFactory(defaultFactory); all.clear(); accepted.clear(); this.root = root; } public void pushFactory(String namespaceURI, String localName, GenericObjectModelFactory factory) { if(curNsSwitchingFactory != null) { if(nsSwitchingFactory == null) { nsSwitchingFactory = new StackImpl(); nameSwitchingFactory = new StackImpl(); } nsSwitchingFactory.push(curNsSwitchingFactory); nameSwitchingFactory.push(curNameSwitchingFactory); } curNsSwitchingFactory = namespaceURI; curNameSwitchingFactory = localName; curFactory = factory; } public void popFactory() { if(nsSwitchingFactory == null || nsSwitchingFactory.isEmpty()) { curNameSwitchingFactory = null; curNsSwitchingFactory = null; } else { curNameSwitchingFactory = (String)nameSwitchingFactory.pop(); curNsSwitchingFactory = (String)nsSwitchingFactory.pop(); } curFactory = getFactory(curNsSwitchingFactory); } // UnmarshallingContext implementation public Iterator getNamespaceURIs() { return nsRegistry.getRegisteredURIs(); } public NamespaceContext getNamespaceContext() { return nsRegistry; } public boolean isTrimTextContent() { return trimTextContent; } public void setTrimTextContent(boolean trimTextContent) { this.trimTextContent = trimTextContent; } /** * Construct a QName from a value * * @param value A value that is of the form [prefix:]localpart */ public QName resolveQName(String value) { StringTokenizer st = new StringTokenizer(value, ":"); if(st.countTokens() == 1) return new QName(value); if(st.countTokens() != 2) throw new IllegalArgumentException("Illegal QName: " + value); String prefix = st.nextToken(); String local = st.nextToken(); String nsURI = nsRegistry.getNamespaceURI(prefix); if (nsURI == null) throw new IllegalStateException("Cannot obtain namespace URI for prefix: " + prefix); return new QName(nsURI, local, prefix); } public String getChildContent(String namespaceURI, String qName) { // todo reimplement later throw new UnsupportedOperationException(); //return content.getChildContent(namespaceURI, qName); } public XSTypeDefinition getType() { return null; } // Public public void startPrefixMapping(String prefix, String uri) { nsRegistry.addPrefixMapping(prefix, uri); } public void endPrefixMapping(String prefix) { nsRegistry.removePrefixMapping(prefix); } public void processingInstruction(String target, String data) { if(!"jbossxb".equals(target)) { return; } int i = data.indexOf("factory=\""); if(i != -1) { int end = data.indexOf('\"', i + 9); if(end == -1) { throw new JBossXBRuntimeException( "Property 'factory' is not terminated with '\"' in processing instruction: " + data ); } String factoryProp = data.substring(i + 9, end); Class factoryCls; try { factoryCls = Thread.currentThread().getContextClassLoader().loadClass(factoryProp); } catch(ClassNotFoundException e) { throw new JBossXBRuntimeException("Failed to load factory class : " + e.getMessage(), e); } ObjectModelFactory factory; try { factory = (ObjectModelFactory)factoryCls.newInstance(); } catch(Exception e) { throw new JBossXBRuntimeException("Failed to instantiate factory " + factoryProp + ": " + e.getMessage(), e ); } i = data.indexOf("ns=\""); if(i == -1) { throw new JBossXBRuntimeException( "Property 'ns' not found in factory mapping processing instruction: " + data ); } end = data.indexOf("\"", i + 4); if(end == -1) { throw new JBossXBRuntimeException( "Property 'ns' is not terminated with '\"' in processing instruction: " + data ); } String nsProp = data.substring(i + 4, end); mapFactoryToNamespace(factory, nsProp); } else { throw new JBossXBRuntimeException( "Unexpected data in processing instruction: target=" + target + ", data=" + data ); } } public Object getRoot() { if(!all.isEmpty()) { popAll(); popAccepted(); } return root; } public void startDTD(String name, String publicId, String systemId) { GenericObjectModelFactory factory = getFactory(systemId); try { Class[] sig = {String.class, String.class, String.class}; Method startDTD = factory.getClass().getMethod("startDTD", sig); Object[] args = {name, publicId, systemId}; startDTD.invoke(factory, args); } catch(Exception e) { log.debug("No startDTD found on factory: " + factory); } } public void endDTD() { // TODO: should use the factory it called in the startDTD try { Class[] sig = {}; Method endDTD = defaultFactory.getClass().getMethod("endDTD", sig); Object[] args = {}; endDTD.invoke(defaultFactory, args); } catch(Exception e) { log.debug("No endDTD found on factory: "+defaultFactory); } } public void startElement(String namespaceURI, String localName, String qName, Attributes atts) { Object parent = accepted.isEmpty() ? root : peekAccepted(); Object element; if(!namespaceURI.equals(curNsSwitchingFactory)) { GenericObjectModelFactory newFactory = getFactory(namespaceURI); if(newFactory != curFactory) { element = newFactory.newRoot(parent, this, namespaceURI, localName, atts); } else { element = newFactory.newChild(parent, this, namespaceURI, localName, atts); } // still have to push since curNsSwitchingFactory needs to be updated to prevent // newRoot calls for the children pushFactory(namespaceURI, localName, newFactory); } else { element = curFactory.newChild(parent, this, namespaceURI, localName, atts); } if(element == null) { pushAll(IGNORED); if(trace) { log.trace("ignored " + namespaceURI + ':' + qName); } } else { pushAll(element); pushAccepted(element); if(trace) { log.trace("accepted " + namespaceURI + ':' + qName); } } } public void endElement(String namespaceURI, String localName, String qName) { AllElement element = popAll(); if(!accepted.isEmpty()) { Object acceptedElement = peekAccepted(); if(element.characters != null && element.characters.length() > 0) { if(trimTextContent) { String characters = element.characters.toString().trim(); if (characters.length() > 0) { curFactory.setValue(acceptedElement, this, namespaceURI, localName, characters); } } else { curFactory.setValue(acceptedElement, this, namespaceURI, localName, element.characters.toString()); } } } if(localName.equals(curNameSwitchingFactory) && namespaceURI.equals(curNsSwitchingFactory)) { popFactory(); } if(element.element != IGNORED) { popAccepted(); Object parent = (accepted.isEmpty() ? null : peekAccepted()); if(parent != null) { curFactory.addChild(parent, element.element, this, namespaceURI, localName); } else { root = curFactory.completeRoot(element.element, this, namespaceURI, localName); } } } public void characters(char[] ch, int start, int length) { if(!accepted.isEmpty()) { String str = String.valueOf(ch, start, length); AllElement allElement = peekAll(); if(allElement.characters == null) { allElement.characters = new StringBuffer(str); } else { allElement.characters.append(str); } } } // Private private GenericObjectModelFactory getFactory(String namespaceUri) { GenericObjectModelFactory factory = (GenericObjectModelFactory)factoriesToNs.get(namespaceUri); if(factory == null) { factory = defaultFactory; } return factory; } static Object invokeFactory(Object factory, Method method, Object[] args) { try { return method.invoke(factory, args); } catch(InvocationTargetException e) { Throwable te = e.getCause(); if(te instanceof RuntimeException) { throw (RuntimeException)te; } String msg = "Failed to invoke method " + method + ", factory=" + factory; log.error(msg, e.getTargetException()); IllegalStateException ise = new IllegalStateException(msg); ise.initCause(te); throw ise; } catch(Exception e) { String msg = "Failed to invoke method " + method.getName() + ", factory=" + factory; log.error(msg, e); IllegalStateException ise = new IllegalStateException(msg); ise.initCause(e); throw ise; } } static Method getMethodForElement(Object factory, String name, Class[] params) { Method method = null; try { method = factory.getClass().getMethod(name, params); } catch(NoSuchMethodException e) { } catch(SecurityException e) { throw e; } return method; } static final GenericObjectModelFactory getGenericObjectModelFactory(ObjectModelFactory factory) { if(!(factory instanceof GenericObjectModelFactory)) { factory = new DelegatingObjectModelFactory(factory); } return factory instanceof GenericObjectModelFactory ? (GenericObjectModelFactory)factory : new DelegatingObjectModelFactory(factory); } private void pushAccepted(Object o) { accepted.push(o); } private Object popAccepted() { return accepted.pop(); } private Object peekAccepted() { return accepted.peek(); } private void pushAll(Object o) { all.push(new AllElement(o)); } private AllElement popAll() { return (AllElement)all.pop(); } private AllElement peekAll() { return (AllElement)all.peek(); } private static final class AllElement { public final Object element; public StringBuffer characters; public AllElement(Object element) { this.element = element; } } private static interface Stack { void clear(); void push(Object o); Object pop(); Object peek(); boolean isEmpty(); } private static class StackImpl implements Stack { private List list = new ArrayList(); public void clear() { list.clear(); } public void push(Object o) { list.add(o); } public Object pop() { return list.remove(list.size() - 1); } public Object peek() { return list.get(list.size() - 1); } public boolean isEmpty() { return list.isEmpty(); } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/Constants.java0000644000175000017500000001172711326355033031051 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import javax.xml.namespace.QName; /** * @author Alexey Loubyansky * @version $Revision: 3954 $ */ public interface Constants { String NS_XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"; String NS_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; String NS_XML_SCHEMA_INSTANCE = "http://www.w3.org/2001/XMLSchema-instance"; String NS_XML_XMLNS = "http://www.w3.org/2000/xmlns/"; String NS_XML_MIME = "http://www.w3.org/2005/05/xmlmime"; String NS_XOP_INCLUDE = "http://www.w3.org/2004/08/xop/include"; String NS_JAXB = "http://java.sun.com/xml/ns/jaxb"; String NS_JBXB = "http://www.jboss.org/xml/ns/jbxb"; // // XML schema type names // QName QNAME_ANYSIMPLETYPE = new QName(NS_XML_SCHEMA, "anySimpleType"); QName QNAME_ANYTYPE = new QName(NS_XML_SCHEMA, "anyType"); // primitive datatypes QName QNAME_STRING = new QName(NS_XML_SCHEMA, "string"); QName QNAME_BOOLEAN = new QName(NS_XML_SCHEMA, "boolean"); QName QNAME_DECIMAL = new QName(NS_XML_SCHEMA, "decimal"); QName QNAME_FLOAT = new QName(NS_XML_SCHEMA, "float"); QName QNAME_DOUBLE = new QName(NS_XML_SCHEMA, "double"); QName QNAME_DURATION = new QName(NS_XML_SCHEMA, "duration"); QName QNAME_DATETIME = new QName(NS_XML_SCHEMA, "dateTime"); QName QNAME_TIME = new QName(NS_XML_SCHEMA, "time"); QName QNAME_DATE = new QName(NS_XML_SCHEMA, "date"); QName QNAME_GYEARMONTH = new QName(NS_XML_SCHEMA, "gYearMonth"); QName QNAME_GYEAR = new QName(NS_XML_SCHEMA, "gYear"); QName QNAME_GMONTHDAY = new QName(NS_XML_SCHEMA, "gMonthDay"); QName QNAME_GDAY = new QName(NS_XML_SCHEMA, "gDay"); QName QNAME_GMONTH = new QName(NS_XML_SCHEMA, "gMonth"); QName QNAME_HEXBINARY = new QName(NS_XML_SCHEMA, "hexBinary"); QName QNAME_BASE64BINARY = new QName(NS_XML_SCHEMA, "base64Binary"); QName QNAME_ANYURI = new QName(NS_XML_SCHEMA, "anyURI"); QName QNAME_QNAME = new QName(NS_XML_SCHEMA, "QName"); QName QNAME_NOTATION = new QName(NS_XML_SCHEMA, "NOTATION"); // derived datatypes QName QNAME_NORMALIZEDSTRING = new QName(NS_XML_SCHEMA, "normalizedString"); QName QNAME_TOKEN = new QName(NS_XML_SCHEMA, "token"); QName QNAME_LANGUAGE = new QName(NS_XML_SCHEMA, "language"); QName QNAME_NMTOKEN = new QName(NS_XML_SCHEMA, "NMTOKEN"); QName QNAME_NMTOKENS = new QName(NS_XML_SCHEMA, "NMTOKENS"); QName QNAME_NAME = new QName(NS_XML_SCHEMA, "Name"); QName QNAME_NCNAME = new QName(NS_XML_SCHEMA, "NCName"); QName QNAME_ID = new QName(NS_XML_SCHEMA, "ID"); QName QNAME_IDREF = new QName(NS_XML_SCHEMA, "IDREF"); QName QNAME_IDREFS = new QName(NS_XML_SCHEMA, "IDREFS"); QName QNAME_ENTITY = new QName(NS_XML_SCHEMA, "ENTITY"); QName QNAME_ENTITIES = new QName(NS_XML_SCHEMA, "ENTITIES"); QName QNAME_INTEGER = new QName(NS_XML_SCHEMA, "integer"); QName QNAME_NONPOSITIVEINTEGER = new QName(NS_XML_SCHEMA, "nonPositiveInteger"); QName QNAME_NEGATIVEINTEGER = new QName(NS_XML_SCHEMA, "negativeInteger"); QName QNAME_LONG = new QName(NS_XML_SCHEMA, "long"); QName QNAME_INT = new QName(NS_XML_SCHEMA, "int"); QName QNAME_SHORT = new QName(NS_XML_SCHEMA, "short"); QName QNAME_BYTE = new QName(NS_XML_SCHEMA, "byte"); QName QNAME_NONNEGATIVEINTEGER = new QName(NS_XML_SCHEMA, "nonNegativeInteger"); QName QNAME_UNSIGNEDLONG = new QName(NS_XML_SCHEMA, "unsignedLong"); QName QNAME_UNSIGNEDINT = new QName(NS_XML_SCHEMA, "unsignedInt"); QName QNAME_UNSIGNEDSHORT = new QName(NS_XML_SCHEMA, "unsignedShort"); QName QNAME_UNSIGNEDBYTE = new QName(NS_XML_SCHEMA, "unsignedByte"); QName QNAME_POSITIVEINTEGER = new QName(NS_XML_SCHEMA, "positiveInteger"); QName QNAME_XMIME_BASE64BINARY = new QName(NS_XML_MIME, "base64Binary"); QName QNAME_XMIME_CONTENTTYPE = new QName(NS_XML_MIME, "contentType"); QName QNAME_XOP_INCLUDE = new QName(Constants.NS_XOP_INCLUDE, "Include"); int NOT_SET = 0; int FALSE = 1; int TRUE = 2; } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/MappingObjectModelProvider.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/MappingObjectModelProvide0000644000175000017500000002610711061473704033211 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import java.util.HashMap; import java.util.Map; import javax.xml.namespace.QName; import org.jboss.logging.Logger; import org.jboss.util.Classes; import org.jboss.xb.binding.introspection.FieldInfo; /** * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class MappingObjectModelProvider implements GenericObjectModelProvider { private static final Logger log = Logger.getLogger(MappingObjectModelProvider.class); private final Map, ClassToElementMapping> classMappings = new HashMap, ClassToElementMapping>(); private final Map fieldMappings = new HashMap(); private boolean ignoreLowLine = true; private boolean ignoreNotFoundField = true; public boolean isIgnoreNotFoundField() { return ignoreNotFoundField; } public void setIgnoreNotFoundField(boolean ignoreNotFoundField) { this.ignoreNotFoundField = ignoreNotFoundField; } public void mapClassToElement(Class cls, String namespaceURI, String localName, ObjectModelProvider provider) { ClassToElementMapping mapping = new ClassToElementMapping(cls, namespaceURI, localName, provider instanceof GenericObjectModelProvider ? (GenericObjectModelProvider)provider : new DelegatingObjectModelProvider(provider) ); classMappings.put(mapping.cls, mapping); } public void mapFieldToElement(Class cls, String field, String namespaceURI, String localName, TypeBinding converter) { FieldToElementMapping mapping = new FieldToElementMapping(cls, field, namespaceURI, localName, converter); mapFieldToElement(mapping); } public boolean isIgnoreLowLine() { return ignoreLowLine; } public void setIgnoreLowLine(boolean ignoreLowLine) { this.ignoreLowLine = ignoreLowLine; } // GenericObjectModelProvider implementation public Object getChildren(Object o, MarshallingContext ctx, String namespaceURI, String localName) { Object children = null; if(!writeAsValue(o.getClass())) { children = getJavaValue(namespaceURI, localName, null, o, true, ignoreNotFoundField); } return children; } public Object getElementValue(Object o, MarshallingContext ctx, String namespaceURI, String localName) { Object value; if(writeAsValue(o.getClass())) { value = o; } else { String fieldName = null; if(ctx != null && ctx.isTypeComplex()) { // this is how it should be fieldName = ctx.getSimpleContentProperty(); } // this is a hack for soap enc try { value = getJavaValue(namespaceURI, localName, fieldName, o, false, false); } catch(JBossXBRuntimeException e) { value = getJavaValue(namespaceURI, localName, null, o, false, ignoreNotFoundField); } } return value; } public Object getAttributeValue(Object o, MarshallingContext ctx, String namespaceURI, String localName) { boolean optional = ctx == null ? ignoreNotFoundField : !ctx.isAttributeRequired() || ignoreNotFoundField; return getJavaValue(namespaceURI, localName, null, o, false, optional); } public Object getRoot(Object o, MarshallingContext ctx, String namespaceURI, String localName) { //String correspCls = Util.xmlNameToClassName(localName, true); //String shortName = Classes.stripPackageName(o.getClass()); //return correspCls.equals(shortName) ? o : null; return o; } // Private private void mapFieldToElement(FieldToElementMapping mapping) { String mappingKey = mapping.cls.getName() + ":" + mapping.localName; fieldMappings.put(mappingKey, mapping); } private Object getJavaValue(String namespaceURI, String localName, String fieldName, Object o, boolean forComplexType, boolean optional) { String mappingKey = o.getClass().getName() + ":" + localName; FieldToElementMapping mapping = fieldMappings.get(mappingKey); if(mapping == null) { if(fieldName == null) { fieldName = Util.xmlNameToFieldName(localName, ignoreLowLine); } // cache the fieldmapping try { mapping = new FieldToElementMapping(o.getClass(), fieldName, namespaceURI, localName, null); mapFieldToElement(mapping); } catch(JBossXBRuntimeException e) { if(optional) { if(log.isTraceEnabled()) { log.trace(e.getMessage()); } } else { throw e; } } } FieldInfo fieldInfo = null; if(mapping != null) { fieldInfo = mapping.fieldInfo; } Object value = null; if(fieldInfo != null && (!forComplexType || forComplexType && !writeAsValue(fieldInfo.getType()))) { value = fieldInfo.getValue(o); } if(value != null && mapping != null && mapping.converter != null) { value = mapping.converter.marshal(value); } return value; } private boolean writeAsValue(final Class type) { return Classes.isPrimitive(type) || type == String.class || type == java.util.Date.class || type == java.math.BigDecimal.class || type == java.math.BigInteger.class; } // Inner private class ClassToElementMapping { public final Class cls; public final String namespaceURI; public final String localName; public final GenericObjectModelProvider provider; public ClassToElementMapping(Class cls, String namespaceURI, String localName, GenericObjectModelProvider provider) { this.cls = cls; this.namespaceURI = namespaceURI; this.localName = localName; this.provider = provider; if(log.isTraceEnabled()) { log.trace("new ClassToElementMapping: [cls=" + cls.getName() + ",qname=" + new QName(namespaceURI, localName) + "]" ); } } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof ClassToElementMapping)) { return false; } final ClassToElementMapping classToElementMapping = (ClassToElementMapping)o; if(cls != null ? !cls.equals(classToElementMapping.cls) : classToElementMapping.cls != null) { return false; } if(localName != null ? !localName.equals(classToElementMapping.localName) : classToElementMapping.localName != null) { return false; } if(namespaceURI != null ? !namespaceURI.equals(classToElementMapping.namespaceURI) : classToElementMapping.namespaceURI != null) { return false; } return true; } public int hashCode() { int result; result = (cls != null ? cls.hashCode() : 0); result = 29 * result + (namespaceURI != null ? namespaceURI.hashCode() : 0); result = 29 * result + (localName != null ? localName.hashCode() : 0); return result; } } private class FieldToElementMapping { public final Class cls; public final String namespaceURI; public final String localName; public final TypeBinding converter; public final FieldInfo fieldInfo; public FieldToElementMapping(Class cls, String field, String namespaceURI, String localName, TypeBinding converter) { this.cls = cls; this.namespaceURI = namespaceURI; this.localName = localName; this.converter = converter; if(log.isTraceEnabled()) { log.trace("new FieldToElementMapping: [cls=" + cls.getName() + ",field=" + field + ",qname=" + new QName(namespaceURI, localName) + "]" ); } fieldInfo = FieldInfo.getFieldInfo(cls, field, true); } public boolean equals(Object o) { if(this == o) { return true; } if(!(o instanceof FieldToElementMapping)) { return false; } final FieldToElementMapping fieldToElementMapping = (FieldToElementMapping)o; if(cls != null ? !cls.equals(fieldToElementMapping.cls) : fieldToElementMapping.cls != null) { return false; } if(!fieldInfo.getName().equals(fieldToElementMapping.fieldInfo.getName())) { return false; } if(localName != null ? !localName.equals(fieldToElementMapping.localName) : fieldToElementMapping.localName != null) { return false; } if(namespaceURI != null ? !namespaceURI.equals(fieldToElementMapping.namespaceURI) : fieldToElementMapping.namespaceURI != null) { return false; } return true; } public int hashCode() { int result; result = (cls != null ? cls.hashCode() : 0); result = 29 * result + fieldInfo.getName().hashCode(); result = 29 * result + (namespaceURI != null ? namespaceURI.hashCode() : 0); result = 29 * result + (localName != null ? localName.hashCode() : 0); return result; } } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/UnmarshallingContext.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/UnmarshallingContext.java0000644000175000017500000000501411061473704033240 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import org.apache.xerces.xs.XSTypeDefinition; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import java.util.Iterator; /** * An interface for content navigation. At the moment it has only one method to get child's content. * But it could also implement XPath navigation. * * @version $Revision: 2913 $ * @author Alexey Loubyansky */ public interface UnmarshallingContext { /** Construct a QName from a value * @param value A value that is of the form [prefix:]localpart */ QName resolveQName(String value); /** * @return all the known namespace URIs */ Iterator getNamespaceURIs(); /** * @return NamespaceContext instance */ NamespaceContext getNamespaceContext(); /** * @return true if the text content passed to the setValue(...) method * is automatically trimmed (the default). */ boolean isTrimTextContent(); /** * Should the text content be automatically trimmed before setValue(...) is called. * @param trimTextContent */ void setTrimTextContent(boolean trimTextContent); /** * Returns child's content. * todo consider deprecating this method * @param namespaceURI * @param qName * @return */ String getChildContent(String namespaceURI, String qName); /** * @return current element's type definition or null if this info is not available */ XSTypeDefinition getType(); }libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/ObjectModelFactory.java0000644000175000017500000001613210470642610032606 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import org.xml.sax.Attributes; /** * All object model factories must implement this interface. Object model factories are used on unmarshalling * to build an object graph that is a representation of the XML content unmarshalled. *

    Each object model factory must implement methods newRoot and completeRoot * defined in this interface, plus a set of newChild, addChild and setValue * methods that will be descovered by the framework at runtime with introspection. *

    The contract for methods discovered at runtime with introspection: *

      *
    • newChild methods *
      This method is called by the framework on the object model factory when parsing of a new XML element started. * Each newChild method must have five arguments: *
        *
      1. parent object of a concrete Java type (not java.lang.Object) for this new child
      2. *
      3. instance of org.jboss.xml.binding.UnmarshallingContext
      4. *
      5. namespace URI of the child XML element as java.lang.String
      6. *
      7. local name of the child XML element as java.lang.String
      8. *
      9. attributes of the child XML element as org.xml.sax.Attributes
      10. *
      * Each newChild() method returns either a new instance of * the child object that represents the XML element with the namespace URI and local name * (in this case, the child XML element is said to be accepted, i.e. should be represented in the object graph) * or null if this child XML element should be ignored, i.e. not be represented in the object graph. *
    • *
      *
    • addChild methods *
      This method is called on the object model factory by the framework when parsing * of a child XML element completed. The arguments of the addChild() method are: *
        *
      1. parent object of a conrete Java type (not java.lang.Object) of the child
      2. *
      3. child object of a concrete Java type (returned earlier by the newChild * method that was called when parsing of this child XML element started)
      4. *
      5. instance of org.jboss.xml.binding.UnmarshallingContext
      6. *
      7. namespace URI for the child XML element as java.lang.String
      8. *
      9. local name for the child XML element as java.lang.String
      10. *
      * When addChild method is called, the child object is supposed to be populated with all the data from * the corresponding XML element. The child object now can be validated and added to the parent. *
    • *
      *
    • setValue methods *
      This method is called on the object model factory by the framework when a new XML element * with text content was parsed. * The method must have four arguments: *
        *
      1. an object of a concrete Java type (not java.lang.Object) which was returned earlier * by the newChild method (that was called when parsing of the parent XML element started) * for which the value of an XML element was read
      2. *
      3. instance of org.jboss.xml.binding.UnmarshallingContext
      4. *
      5. namespace URI of the child XML element as java.lang.String
      6. *
      7. local name of the child XML element as java.lang.String
      8. *
      9. the value of the child XML element as java.lang.String
      10. *
      * In setValue method the object model factory is supposed to set the value on the field which represents * the parsed XML element possibly converting the parsed XML element value to the field's Java type. *
    • *
    * * @author Alexey Loubyansky * @version $Revision: 1958 $ */ public interface ObjectModelFactory { /** * This method is called by the framework and returns the root of the object graph. *

    If root argument is null, the factory is supposed to create and return a new one * that is going to be the real root object of the graph or an object that will represent the root object * during unmarshalling and which will be used to create the real root object when unmarshalling is complete * in completeRoot if the real root object can't be created while its children are not available, * e.g. no no-arg constructor or other reasons. *

    If root argument is not null (i.e. a user provided the root object through the * org.jboss.xml.binding.Unmarshaller) then the factory could just return it as is or * extract the real root from the root argument based on the namespace URI and local name * if root argument wraps/contains the real root. * * @param root an object that is the root or which contains the root of the object graph * @param ctx unmarshalling context * @param namespaceURI namespace URI of the root * @param localName local name of the root * @param attrs attributes of the root object * @return the root of the object graph */ Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs); /** * This method is called by the framework when unmarshalling of the object graph completed. * The method returns the root object of the object graph. * If at the beginning of unmarshalling newRoot returned not the real root object but an * object that represented the root during unmarshalling, the real root object should be created * and returned. * * @param root the object returned by newRoot at the beginning of unmarshalling * @param ctx unmarshalling context * @param namespaceURI namespace URI that corresponds to the root * @param localName local element name the root of the object graph is bound to * @return the root of the object graph */ Object completeRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName); } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/AttributesImpl.java0000644000175000017500000001717611374713342032055 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import org.xml.sax.Attributes; import java.util.List; import java.util.ArrayList; /** * org.xml.sax.Attributes implementation. * * @version $Revision: 4391 $ * @author Alexey Loubyansky */ public class AttributesImpl implements Attributes { private final List attrList; public AttributesImpl(Attributes attrs) { this(attrs == null ? 0 : attrs.getLength()); if(attrs != null) { for(int i = 0; i < attrs.getLength(); ++i) { add( attrs.getURI(i), attrs.getLocalName(i), attrs.getQName(i), attrs.getType(i), attrs.getValue(i) ); } } } public AttributesImpl(int size) { this.attrList = new ArrayList(size); } public void add(String namespaceUri, String localName, String qName, String type, String value) { attrList.add(new AttributeImpl(namespaceUri, localName, qName, type, value)); } public void addAll(Attributes attrs) { for(int i = 0; i < attrs.getLength(); ++i) { add(attrs.getURI(i), attrs.getLocalName(i), attrs.getQName(i), attrs.getType(i), attrs.getValue(i)); } } // Attributes implementation public int getLength() { return attrList.size(); } public String getURI(int index) { return getAttribute(index).namespaceUri; } public String getLocalName(int index) { return getAttribute(index).localName; } public String getQName(int index) { return getAttribute(index).qName; } public String getType(int index) { return getAttribute(index).type; } public String getValue(int index) { return getAttribute(index).value; } public int getIndex(String uri, String localName) { int i = 0; while(i < attrList.size()) { final AttributeImpl attr = getAttribute(i++); if( (attr.namespaceUri == null ? uri == null : attr.namespaceUri.equals(uri)) && (attr.localName == null ? localName == null : attr.localName.equals(localName)) ) { break; } } if (i == attrList.size()) return -1; return i; } public int getIndex(String qName) { int i = 0; while(i < attrList.size()) { final AttributeImpl attr = getAttribute(i++); if(attr.qName.equals(qName)) { break; } } if (i == attrList.size()) return -1; return i; } public String getType(String uri, String localName) { AttributeImpl attr = null; int i = 0; while(i < attrList.size()) { attr = getAttribute(i++); if( (attr.namespaceUri == null ? uri == null : attr.namespaceUri.equals(uri)) && (attr.localName == null ? localName == null : attr.localName.equals(localName)) ) { break; } } if (attr == null) return null; return attr.type; } public String getType(String qName) { AttributeImpl attr = null; int i = 0; while(i < attrList.size()) { attr = getAttribute(i++); if(attr.qName.equals(qName)) { break; } } if (attr == null) return null; return attr.type; } public String getValue(String uri, String localName) { AttributeImpl attr = null; int i = 0; while(i < attrList.size()) { attr = getAttribute(i++); if( (attr.namespaceUri == null ? uri == null : attr.namespaceUri.equals(uri)) && (attr.localName == null ? localName == null : attr.localName.equals(localName)) ) { return attr.value; } } return null; } public String getValue(String qName) { AttributeImpl attr = null; int i = 0; while(i < attrList.size()) { attr = getAttribute(i++); if(attr.qName.equals(qName)) { break; } } if (attr == null) return null; return attr.value; } // Public public String toString() { String result; if(this.attrList.isEmpty()) { result = "[]"; } else { StringBuffer sb = new StringBuffer(); sb.append('['); sb.append(getQName(0)).append('=').append(getValue(0)); for(int i = 1; i < attrList.size(); ++i) { sb.append(", ").append(getQName(i)).append('=').append(getValue(i)); } sb.append(']'); result = sb.toString(); } return result; } // Private private AttributeImpl getAttribute(int index) { return attrList.get(index); } // Inner private static final class AttributeImpl { public final String namespaceUri; public final String localName; public final String qName; public final String type; public final String value; public AttributeImpl(String namespaceUri, String localName, String qName, String type, String value) { this.namespaceUri = namespaceUri; this.localName = localName; this.qName = qName; this.type = type; this.value = value; } public boolean equals(Object o) { if(this == o) return true; if(!(o instanceof AttributeImpl)) return false; final AttributeImpl attribute = (AttributeImpl)o; if(localName != null ? !localName.equals(attribute.localName) : attribute.localName != null) return false; if(namespaceUri != null ? !namespaceUri.equals(attribute.namespaceUri) : attribute.namespaceUri != null) return false; if(qName != null ? !qName.equals(attribute.qName) : attribute.qName != null) return false; if(type != null ? !type.equals(attribute.type) : attribute.type != null) return false; if(value != null ? !value.equals(attribute.value) : attribute.value != null) return false; return true; } public int hashCode() { int result; result = (namespaceUri != null ? namespaceUri.hashCode() : 0); result = 29 * result + (localName != null ? localName.hashCode() : 0); result = 29 * result + (qName != null ? qName.hashCode() : 0); result = 29 * result + (type != null ? type.hashCode() : 0); result = 29 * result + (value != null ? value.hashCode() : 0); return result; } } }libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/DtdMarshaller.java0000644000175000017500000003613711061473704031627 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import com.wutka.dtd.DTD; import com.wutka.dtd.DTDAttribute; import com.wutka.dtd.DTDContainer; import com.wutka.dtd.DTDElement; import com.wutka.dtd.DTDEmpty; import com.wutka.dtd.DTDItem; import com.wutka.dtd.DTDMixed; import com.wutka.dtd.DTDName; import com.wutka.dtd.DTDPCData; import com.wutka.dtd.DTDParser; import com.wutka.dtd.DTDCardinal; import org.jboss.logging.Logger; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import java.io.IOException; import java.io.Reader; import java.io.Writer; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Collection; import java.util.Collections; import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; import java.util.Map; import java.util.HashMap; import java.util.List; import java.util.ArrayList; import java.net.URL; import java.net.MalformedURLException; import javax.xml.parsers.ParserConfigurationException; /** * A DTD based org.jboss.xb.binding.Marshaller implementation. * * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class DtdMarshaller extends AbstractMarshaller { private static final Logger log = Logger.getLogger(DtdMarshaller.class); private String publicId; private String systemId; private final Stack stack = new StackImpl(); private DTD dtd; private GenericObjectModelProvider provider; private Content content = new Content(); private final List elementStack = new ArrayList(); private final Map simpleTypeBindings = new HashMap(); public void addBinding(String elementName, TypeBinding binding) { simpleTypeBindings.put(elementName, binding); } public void mapPublicIdToSystemId(String publicId, String systemId) { this.publicId = publicId; this.systemId = systemId; } public void declareNamespace(String prefix, String uri) { throw new UnsupportedOperationException("declareNamespace is not implemented."); } public void addAttribute(String prefix, String localName, String type, String value) { throw new UnsupportedOperationException("addAttribute is not implemented."); } public void marshal(String schemaUri, ObjectModelProvider provider, Object root, Writer writer) throws IOException, ParserConfigurationException, SAXException { URL url; try { url = new URL(schemaUri); } catch(MalformedURLException e) { throw new IllegalArgumentException("Malformed schema URI " + schemaUri + ": " + e.getMessage()); } InputStream is; try { is = url.openStream(); } catch(IOException e) { throw new IllegalStateException("Failed to open input stream for schema " + schemaUri + ": " + e.getMessage()); } try { InputStreamReader reader = new InputStreamReader(is); marshal(reader, provider, root, writer); } finally { is.close(); } } public void marshal(Reader dtdReader, ObjectModelProvider provider, Object document, Writer writer) throws IOException, SAXException { DTDParser parser = new DTDParser(dtdReader); dtd = parser.parse(true); this.provider = provider instanceof GenericObjectModelProvider ? (GenericObjectModelProvider)provider : new DelegatingObjectModelProvider(provider); //stack.push(document); DTDElement[] roots = null; if(dtd.rootElement != null) { handleRootElement(document, dtd.rootElement); } else { roots = getRootList(dtd); for(int i = 0; i < roots.length; ++i) { handleRootElement(document, roots[i]); } } //stack.pop(); // version & encoding writeXmlVersion(writer); // DOCTYPE writer.write("\n"); ContentWriter contentWriter = new ContentWriter(writer, propertyIsTrueOrNotSet(Marshaller.PROP_OUTPUT_INDENTATION)); content.handleContent(contentWriter); } private void handleRootElement(Object o, final DTDElement dtdRoot) { Element el = new Element(dtdRoot, true); elementStack.add(el); content.startDocument(); Object root = provider.getRoot(o, null, systemId, dtdRoot.getName()); if(root == null) { return; } stack.push(root); Attributes attrs = provideAttributes(dtdRoot, root); content.startElement("", dtdRoot.getName(), dtdRoot.getName(), attrs); handleElement(dtd, dtdRoot, attrs); content.endElement("", dtdRoot.getName(), dtdRoot.getName()); stack.pop(); content.endDocument(); elementStack.remove(elementStack.size() - 1); } private final void handleElement(DTD dtd, DTDElement element, Attributes attrs) { DTDItem item = element.content; if(item instanceof DTDMixed) { handleMixedElement(element, attrs); } else if(item instanceof DTDEmpty) { final Object value = provider.getElementValue(stack.peek(), null, systemId, element.getName()); if(Boolean.TRUE.equals(value)) { writeSkippedElements(); content.startElement("", element.getName(), element.getName(), attrs); content.endElement("", element.getName(), element.getName()); } } else if(item instanceof DTDContainer) { processContainer(dtd, (DTDContainer)item); } else { throw new IllegalStateException("Unexpected element: " + element.getName()); } } private final void handleMixedElement(DTDElement element, Attributes attrs) { boolean startElement = false; if(!elementStack.isEmpty()) { Element e = elementStack.get(elementStack.size() - 1); startElement = element != e.element; } DTDMixed mixed = (DTDMixed) element.content; String elementName = element.getName(); Object parent = stack.peek(); DTDItem[] items = mixed.getItems(); for(int i = 0; i < items.length; ++i) { DTDItem item = items[i]; if(item instanceof DTDPCData) { Object value = provider.getElementValue(parent, null, systemId, elementName); if(value != null) { writeSkippedElements(); String marshalled; TypeBinding binding = simpleTypeBindings.get(elementName); if(binding != null) { marshalled = binding.marshal(value); } else { marshalled = value.toString(); } char[] ch = marshalled.toCharArray(); if(startElement) { content.startElement("", elementName, elementName, attrs); } content.characters(ch, 0, ch.length); if(startElement) { content.endElement("", elementName, elementName); } } } } } private final void handleChildren(DTD dtd, DTDElement element, DTDCardinal elementCardinal) { Object parent = stack.peek(); Object children = provider.getChildren(parent, null, systemId, element.getName()); if(children != null) { Iterator iter; if(children instanceof Iterator) { iter = (Iterator)children; } else if(children instanceof Collection) { iter = ((Collection)children).iterator(); } else { iter = Collections.singletonList(children).iterator(); } writeSkippedElements(); Element el = new Element(element, true); elementStack.add(el); final boolean singleValued = elementCardinal == DTDCardinal.NONE || elementCardinal == DTDCardinal.OPTIONAL; if(singleValued) { // todo attributes! content.startElement("", element.getName(), element.getName(), null); } while(iter.hasNext()) { Object child = iter.next(); stack.push(child); AttributesImpl attrs = (element.attributes.isEmpty() ? null : provideAttributes(element, child)); if(!singleValued) { content.startElement("", element.getName(), element.getName(), attrs); } handleElement(dtd, element, attrs); if(!singleValued) { content.endElement(systemId, element.getName(), element.getName()); } stack.pop(); } if(singleValued) { content.endElement(systemId, element.getName(), element.getName()); } elementStack.remove(elementStack.size() - 1); } else { boolean removeLast = false; if(!(element.getContent() instanceof DTDMixed || element.getContent() instanceof DTDEmpty)) { Element el = new Element(element); elementStack.add(el); removeLast = true; } AttributesImpl attrs = (element.attributes.isEmpty() ? null : provideAttributes(element, parent)); handleElement(dtd, element, attrs); if(removeLast) { Element el = elementStack.remove(elementStack.size() - 1); if(el.started) { DTDElement started = el.element; content.endElement("", started.getName(), started.getName()); } } } } private final void processContainer(DTD dtd, DTDContainer container) { DTDItem[] items = container.getItems(); for(int i = 0; i < items.length; ++i) { DTDItem item = items[i]; if(item instanceof DTDContainer) { processContainer(dtd, (DTDContainer)item); } else if(item instanceof DTDName) { DTDName name = (DTDName)item; DTDElement element = (DTDElement)dtd.elements.get(name.value); handleChildren(dtd, element, name.getCardinal()); } } } private void writeSkippedElements() { Element el = elementStack.get(elementStack.size() - 1); if(!el.started) { int firstNotStarted = elementStack.size() - 1; do { el = elementStack.get(--firstNotStarted); } while(!el.started); ++firstNotStarted; while(firstNotStarted < elementStack.size()) { el = elementStack.get(firstNotStarted++); DTDElement notStarted = el.element; if(log.isTraceEnabled()) { log.trace("starting skipped> " + notStarted.getName()); } content.startElement("", notStarted.getName(), notStarted.getName(), null); el.started = true; } } } private AttributesImpl provideAttributes(DTDElement element, Object container) { final Hashtable attributes = element.attributes; AttributesImpl attrs = new AttributesImpl(attributes.size()); for(Iterator attrIter = attributes.values().iterator(); attrIter.hasNext();) { DTDAttribute attr = (DTDAttribute)attrIter.next(); final Object attrValue = provider.getAttributeValue(container, null, systemId, attr.getName()); if(attrValue != null) { attrs.add(systemId, attr.getName(), attr.getName(), attr.getType().toString(), attrValue.toString() ); } } return attrs; } /** * @param dtd the DTD object model * @return root element names */ protected static DTDElement[] getRootList(DTD dtd) { Hashtable roots = new Hashtable(); Enumeration e = dtd.elements.elements(); while(e.hasMoreElements()) { DTDElement element = (DTDElement)e.nextElement(); roots.put(element.name, element); } e = dtd.elements.elements(); while(e.hasMoreElements()) { DTDElement element = (DTDElement)e.nextElement(); if(!(element.content instanceof DTDContainer)) { continue; } Enumeration items = ((DTDContainer)element.content).getItemsVec().elements(); while(items.hasMoreElements()) { removeElements(roots, dtd, (DTDItem)items.nextElement()); } } final Collection rootCol = roots.values(); return rootCol.toArray(new DTDElement[rootCol.size()]); } protected static void removeElements(Hashtable h, DTD dtd, DTDItem item) { if(item instanceof DTDName) { h.remove(((DTDName)item).value); } else if(item instanceof DTDContainer) { Enumeration e = ((DTDContainer)item).getItemsVec().elements(); while(e.hasMoreElements()) { removeElements(h, dtd, (DTDItem)e.nextElement()); } } } // Inner private static final class Element { public final DTDElement element; public boolean started; public Element(DTDElement element, boolean started) { this.element = element; this.started = started; } public Element(DTDElement element) { this.element = element; } public String toString() { return "[element=" + element.getName() + ", started=" + started + "]"; } } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/GenericValueContainer.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/GenericValueContainer.jav0000644000175000017500000001542711274325076033157 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import java.lang.reflect.Array; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.xml.namespace.QName; import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtUtil; /** * @author Alexey Loubyansky * @version $Revision: 3634 $ */ public interface GenericValueContainer { class FACTORY { public static GenericValueContainer array(final Class itemClass) { return array(null, null, itemClass); } public static GenericValueContainer array(final Class wrapperClass, final String itemProperty, final Class itemClass) { return new GenericValueContainer() { private final Class wrapperType = wrapperClass; private final String itemProp = itemProperty; private final Class itemType = itemClass; private final List items = new ArrayList(); public void addChild(QName name, Object value) { if(value != null && Collection.class.isAssignableFrom(value.getClass())) items.addAll((Collection) value); else items.add(value); } public Object instantiate() { /* for collected repeatable particles Object arr; if(items.isEmpty()) { arr = Array.newInstance(itemType, 0); } else { java.util.Collection col = (java.util.Collection)items.get(0); arr = Array.newInstance(itemType, col.size()); if(itemType.isPrimitive()) { int i = 0; for(java.util.Iterator iter = col.iterator(); iter.hasNext();) { Object item = iter.next(); try { Array.set(arr, i++, item); } catch(IllegalArgumentException e) { throw new JBossXBRuntimeException("Failed to set " + item + " as an item of array " + arr ); } } } else { col.toArray((Object[])arr); } } */ Object arr = Array.newInstance(itemType, items.size()); for(int i = 0; i < items.size(); ++i) { try { Array.set(arr, i, items.get(i)); } catch(IllegalArgumentException e) { throw new JBossXBRuntimeException("Failed to set " + items.get(i) + " as an item of array " + arr ); } } Object result = arr; // wrap if(wrapperType != null) { Constructor ctor = null; try { try { Class[] sig = null; ctor = wrapperType.getConstructor(sig); Object[] args = null; result = ctor.newInstance(args); RtUtil.set(result, arr, itemProp, null, false, null); } catch(NoSuchMethodException e) { Constructor[] ctors = wrapperType.getConstructors(); for(int i = 0; i < ctors.length; ++i) { Class[] types = ctors[i].getParameterTypes(); if(types.length == 1 && types[0].isAssignableFrom(arr.getClass())) { ctor = ctors[i]; break; } } if(ctor == null) { throw new JBossXBRuntimeException("Failed to find an appropriate ctor in " + wrapperType + " to wrap " + arr ); } result = ctor.newInstance(new Object[]{arr}); } } catch(JBossXBRuntimeException e) { throw e; } catch(Exception e) { throw new JBossXBRuntimeException( "Failed to initialize array wrapper " + wrapperType + " for " + arr, e ); } } return result; } public Class getTargetClass() { // this method should only be called for multidimansional arrays // todo: what's the best way to get a class for array having the item class? return Array.newInstance(itemType, 0).getClass(); } public String toString() { return super.toString() + "array"; } }; } } void addChild(QName name, Object value); Object instantiate(); Class getTargetClass(); } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/SchemalessObjectModelFactory.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/SchemalessObjectModelFact0000644000175000017500000001476411061473704033160 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import org.jboss.logging.Logger; import org.jboss.util.Classes; import org.xml.sax.Attributes; import java.lang.reflect.Method; import java.util.Collection; import java.util.List; import java.util.ArrayList; import java.util.Set; import java.util.HashSet; import java.util.Locale; import java.text.SimpleDateFormat; /** * Sandbox. Very testcase specific impl. * * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class SchemalessObjectModelFactory implements GenericObjectModelFactory { private static final Logger log = Logger.getLogger(SchemalessObjectModelFactory.class); public Object newChild(Object parent, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { Object child = null; try { if(parent instanceof Collection) { if(!localName.equals(java.lang.String.class.getName())) { Class itemClass = Thread.currentThread().getContextClassLoader().loadClass(localName); child = itemClass.newInstance(); ((Collection)parent).add(child); } } else { Method getter = parent.getClass().getMethod("get" + localName, null); if(!SchemalessMarshaller.isAttributeType(getter.getReturnType())) { if(List.class.isAssignableFrom(getter.getReturnType())) { child = new ArrayList(); } else if(Set.class.isAssignableFrom(getter.getReturnType())) { child = new HashSet(); } else if(Collection.class.isAssignableFrom(getter.getReturnType())) { child = new ArrayList(); } else { child = getter.getReturnType().newInstance(); } } if(child != null) { Method setter = Classes.getAttributeSetter(parent.getClass(), localName, getter.getReturnType()); setter.invoke(parent, new Object[]{child}); } } } catch(NoSuchMethodException e) { log.error("Failed to get getter/setter method for " + localName + " from " + parent.getClass(), e); throw new IllegalStateException("Failed to get getter/setter method for " + localName + " from " + parent.getClass() + ": " + e.getMessage() ); } catch(Exception e) { log.error("Failed to instantiate child", e); throw new IllegalStateException("Failed to instantiate child: " + e.getMessage()); } return child; } public void addChild(Object parent, Object child, UnmarshallingContext navigator, String namespaceURI, String localName) { } public void setValue(Object o, UnmarshallingContext navigator, String namespaceURI, String localName, String value) { try { if(o instanceof Collection) { if(localName.equals(java.lang.String.class.getName())) { ((Collection)o).add(value); } } else { Method getter = Classes.getAttributeGetter(o.getClass(), localName); Method setter = Classes.getAttributeSetter(o.getClass(), localName, getter.getReturnType()); Object fieldValue; if(java.util.Date.class.isAssignableFrom(getter.getReturnType())) { SimpleDateFormat formatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); fieldValue = formatter.parse(value); } else { fieldValue = value; } setter.invoke(o, new Object[]{fieldValue}); } } catch(NoSuchMethodException e) { throw new IllegalStateException("Failed to discover getter/setter for " + localName + " in " + o); } catch(Exception e) { throw new IllegalStateException("Failed to set value for " + localName + " in " + o); } } public Object newRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs) { Class rootClass; try { rootClass = Thread.currentThread().getContextClassLoader().loadClass(localName); } catch(ClassNotFoundException e) { log.error("Faile to load root class " + localName, e); throw new IllegalStateException("Failed to load root class: " + localName + ": " + e.getMessage()); } try { root = rootClass.newInstance(); } catch(Exception e) { log.error("Failed to create an instance of root " + localName, e); throw new IllegalStateException("Failed to create an instance of root " + localName + ": " + e.getMessage()); } return root; } public Object completeRoot(Object root, UnmarshallingContext navigator, String namespaceURI, String localName) { return root; } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/Util.java0000644000175000017500000006322611336746232030021 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import java.io.InputStream; import java.io.Reader; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Iterator; import java.util.StringTokenizer; import javax.xml.XMLConstants; import javax.xml.namespace.QName; import javax.xml.namespace.NamespaceContext; import org.apache.xerces.xs.XSImplementation; import org.apache.xerces.xs.XSLoader; import org.apache.xerces.xs.XSModel; import org.jboss.logging.Logger; import org.jboss.util.Classes; import org.jboss.xb.binding.sunday.unmarshalling.LSInputAdaptor; import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding; import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding; import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver; import org.jboss.xb.binding.sunday.unmarshalling.TermBinding; import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding; import org.jboss.xb.binding.sunday.unmarshalling.XsdBinderTerminatingErrorHandler; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMErrorHandler; import org.w3c.dom.bootstrap.DOMImplementationRegistry; import org.w3c.dom.ls.LSInput; import org.w3c.dom.ls.LSResourceResolver; import org.xml.sax.Attributes; import org.xml.sax.InputSource; /** * Various utilities for XML binding. * * @author Alexey Loubyansky * @version $Revision: 4038 $ */ public final class Util { /** * Characters that are considered to be word separators while convertinging XML names to Java identifiers * according to JAXB 2.0 spec. */ public static final char HYPHEN_MINUS = '\u002D'; public static final char FULL_STOP = '\u002E'; public static final char COLLON = '\u003A'; public static final char LOW_LINE = '\u005F'; public static final char MIDDLE_DOT = '\u00B7'; public static final char GREEK_ANO_TELEIA = '\u0387'; public static final char ARABIC_END_OF_AYAH = '\u06DD'; public static final char ARABIC_START_OF_RUB_EL_HIZB = '\u06DE'; private static final Logger log = Logger.getLogger(Util.class); private static XSImplementation xsImpl; /** * Returns a prefixed name for the passed in QName instance. * If the argument has a prefix, the prefix is used. If not then * local part is returned. * * @param qName an instance of QName to generate prefix name for * @return generated prefixed name or empty string in case the argument is null */ public static String getPrefixedName(QName qName) { String result = ""; if(qName != null) { String prefix = qName.getPrefix(); if(prefix.length() > 0) { result = prefix + ':' + qName.getLocalPart(); } else { result = qName.getLocalPart(); } } return result; } /** * Returns a prefixed name for passed in QName instance. * If the argument has a prefix then its prefix is used. * If not and the argument has namespace URI then namespace context is used * to get the prefix. * * @param qName an instance of QName to generate prefix name for * @param nc an instance of the NamespaceContext * @return generated prefixed name or empty string in case the argument is null */ public static String getPrefixedName(QName qName, NamespaceContext nc) { String result = ""; if(qName != null) { String prefix = qName.getPrefix(); if(prefix.length() > 0) { result = prefix + ':' + qName.getLocalPart(); } else { String ns = qName.getNamespaceURI(); prefix = nc.getPrefix(ns); if(prefix != null && prefix.length() > 0) { result = prefix + ':' + qName.getLocalPart(); } else { result = qName.getLocalPart(); } } } return result; } /** * Converts XML name to Java class name according to * Binding XML Names to Java Identifiers * C.2. The Name to Identifier Mapping Algorithm * jaxb-2_0-edr-spec-10_jun_2004.pdf * * @param name XML name * @param ignoreLowLine whether low lines should not be parts of Java identifiers * @return Java class name */ public static String xmlNameToClassName(String name, boolean ignoreLowLine) { return XMLNameToJavaIdentifierConverter.PARSER.parse(XMLNameToJavaIdentifierConverter.CLASS_NAME, name, ignoreLowLine ); } public static String xmlNameToFieldName(String name, boolean ignoreLowLine) { return XMLNameToJavaIdentifierConverter.PARSER.parse(XMLNameToJavaIdentifierConverter.FIELD_NAME, name, ignoreLowLine ); } /** * Converts XML name to Java getter method name according to * Binding XML Names to Java Identifiers * C.2. The Name to Identifier Mapping Algorithm * jaxb-2_0-edr-spec-10_jun_2004.pdf * * @param name XML name * @param ignoreLowLine whether low lines should not be parts of Java identifiers * @return Java getter method name */ public static String xmlNameToGetMethodName(String name, boolean ignoreLowLine) { return "get" + xmlNameToClassName(name, ignoreLowLine); } /** * Converts XML name to Java setter method name according to * Binding XML Names to Java Identifiers * C.2. The Name to Identifier Mapping Algorithm * jaxb-2_0-edr-spec-10_jun_2004.pdf * * @param name XML name * @param ignoreLowLine whether low lines should not be parts of Java identifiers * @return Java setter method name */ public static String xmlNameToSetMethodName(String name, boolean ignoreLowLine) { return "set" + xmlNameToClassName(name, ignoreLowLine); } /** * Converts XML name to Java constant name according to * Binding XML Names to Java Identifiers * C.2. The Name to Identifier Mapping Algorithm * jaxb-2_0-edr-spec-10_jun_2004.pdf * * @param name XML name * @return Java constant name */ public static String xmlNameToConstantName(String name) { return XMLNameToJavaIdentifierConverter.PARSER.parse(XMLNameToJavaIdentifierConverter.CONSTANT_NAME, name, true ); } /** * Converts XML namespace to Java package name. * The base algorithm is described in JAXB-2.0 spec in 'C.5 Generating a Java package name'. * * @param namespace XML namespace * @return Java package name */ public static String xmlNamespaceToJavaPackage(String namespace) { if(namespace.length() == 0) { return namespace; } char[] src = namespace.toLowerCase().toCharArray(); char[] dst = new char[namespace.length()]; int srcInd = 0; // skip protocol part, i.e. http://, urn:// while(src[srcInd++] != ':') { } while(src[srcInd] == '/') { ++srcInd; } // skip www part if(src[srcInd] == 'w' && src[srcInd + 1] == 'w' && src[srcInd + 2] == 'w') { srcInd += 4; } // find domain start and end indexes int domainStart = srcInd; while(srcInd < src.length && src[srcInd] != '/') { ++srcInd; } int dstInd = 0; // copy domain parts in the reverse order for(int start = srcInd - 1, end = srcInd; true; --start) { if(start == domainStart) { System.arraycopy(src, start, dst, dstInd, end - start); dstInd += end - start; break; } if(src[start] == '.') { System.arraycopy(src, start + 1, dst, dstInd, end - start - 1); dstInd += end - start; dst[dstInd - 1] = '.'; end = start; } } // copy the rest while(srcInd < src.length) { char c = src[srcInd++]; if(c == '/') { if(srcInd < src.length) { dst = append(dst, dstInd++, '.'); if(!Character.isJavaIdentifierStart(src[srcInd])) { dst = append(dst, dstInd++, '_'); } } } else if(c == '.') { // for now assume it's an extention, i.e. '.xsd' break; } else { dst = append(dst, dstInd++, Character.isJavaIdentifierPart(c) ? c : '_'); } } return String.valueOf(dst, 0, dstInd); } /** * Converts XML namespace URI and local name to fully qualified class name. * * @param namespaceUri namespace URI * @param localName local name * @param ignoreLowLine should low lines be ignored in the class name * @return fully qualified class name */ public static String xmlNameToClassName(String namespaceUri, String localName, boolean ignoreLowLine) { return namespaceUri == null || namespaceUri.length() == 0 ? xmlNameToClassName(localName, ignoreLowLine) : xmlNamespaceToJavaPackage(namespaceUri) + '.' + xmlNameToClassName(localName, ignoreLowLine); } public static boolean isAttributeType(final Class type) { return Classes.isPrimitive(type) || type == String.class || type == java.util.Date.class; } /** * Parse the namespace location pairs in the schemaLocation and return the * location that matches the nsURI argument. * * @return the location uri if found, null otherwise */ public static String getSchemaLocation(Attributes attrs, String nsUri) { String location = null; String schemaLocation = attrs.getValue(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "schemaLocation"); if(schemaLocation != null) { StringTokenizer tokenizer = new StringTokenizer(schemaLocation, " \t\n\r"); while (tokenizer.hasMoreTokens()) { String namespace = tokenizer.nextToken(); if (namespace.equals(nsUri) && tokenizer.hasMoreTokens()) { location = tokenizer.nextToken(); break; } } } return location; } public static XSModel loadSchema(String xsdURL, SchemaBindingResolver schemaResolver) { boolean trace = log.isTraceEnabled(); long start = System.currentTimeMillis(); if(trace) log.trace("loading xsd: " + xsdURL); if(xsImpl == null) xsImpl = getXSImplementation(); XSLoader schemaLoader = xsImpl.createXSLoader(null); if(schemaResolver != null) setResourceResolver(schemaLoader, schemaResolver); setDOMErrorHandler(schemaLoader); XSModel model = schemaLoader.loadURI(xsdURL); if(model == null) throw new IllegalArgumentException("Invalid URI for schema: " + xsdURL); if (trace) log.trace("Loaded xsd: " + xsdURL + " in " + (System.currentTimeMillis() - start) + "ms"); return model; } public static XSModel loadSchema(InputStream is, String encoding, SchemaBindingResolver schemaResolver) { if(log.isTraceEnabled()) log.trace("loading xsd from InputStream"); LSInputAdaptor input = new LSInputAdaptor(is, encoding); if(xsImpl == null) xsImpl = getXSImplementation(); XSLoader schemaLoader = xsImpl.createXSLoader(null); if(schemaResolver != null) setResourceResolver(schemaLoader, schemaResolver); setDOMErrorHandler(schemaLoader); return schemaLoader.load(input); } public static XSModel loadSchema(Reader reader, String encoding, SchemaBindingResolver schemaResolver) { if(log.isTraceEnabled()) log.trace("loading xsd from Reader"); LSInputAdaptor input = new LSInputAdaptor(reader, encoding); if(xsImpl == null) xsImpl = getXSImplementation(); XSLoader schemaLoader = xsImpl.createXSLoader(null); if(schemaResolver != null) setResourceResolver(schemaLoader, schemaResolver); setDOMErrorHandler(schemaLoader); return schemaLoader.load(input); } public static XSModel loadSchema(String data, String encoding) { if(log.isTraceEnabled()) log.trace("loading xsd from string"); LSInputAdaptor input = new LSInputAdaptor(data, encoding); if(xsImpl == null) xsImpl = getXSImplementation(); XSLoader schemaLoader = xsImpl.createXSLoader(null); setDOMErrorHandler(schemaLoader); return schemaLoader.load(input); } public static XSModel loadSchema(InputSource is, SchemaBindingResolver schemaResolver) { if(log.isTraceEnabled()) log.trace("loading xsd from InputSource"); LSInputAdaptor input = new LSInputAdaptor(is); if(xsImpl == null) xsImpl = getXSImplementation(); XSLoader schemaLoader = xsImpl.createXSLoader(null); if(schemaResolver != null) setResourceResolver(schemaLoader, schemaResolver); setDOMErrorHandler(schemaLoader); return schemaLoader.load(input); } // Private /** * Sets an array character's element with the given index to a character value. * If index is more or equal to the length of the array, a new array is created with enough length to set * the element. * * @param buf array of characters * @param index index of the element to set * @param ch character to set * @return if the index parameter is less then array's length then the original array is returned, * otherwise a new array is returned */ private static char[] append(char[] buf, int index, char ch) { if(index >= buf.length) { char[] tmp = buf; buf = new char[index + 4]; System.arraycopy(tmp, 0, buf, 0, tmp.length); } buf[index] = ch; return buf; } private static void setResourceResolver(XSLoader schemaLoader, final SchemaBindingResolver schemaResolver) { DOMConfiguration config = schemaLoader.getConfig(); config.setParameter("resource-resolver", new LSResourceResolver() { public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) { if (Constants.NS_XML_SCHEMA.equals(type)) { String schemaLocation = systemId; return schemaResolver.resolveAsLSInput(namespaceURI, baseURI, schemaLocation); } return null; } } ); } private static void setDOMErrorHandler(XSLoader schemaLoader) { DOMConfiguration config = schemaLoader.getConfig(); DOMErrorHandler errorHandler = (DOMErrorHandler)config.getParameter("error-handler"); if (errorHandler == null) { config.setParameter("error-handler", XsdBinderTerminatingErrorHandler.newInstance()); } } private static XSImplementation getXSImplementation() { return (XSImplementation) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { // Get DOM Implementation using DOM Registry ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { // Try the 2.6.2 version String name = "org.apache.xerces.dom.DOMXSImplementationSourceImpl"; loader.loadClass(name); System.setProperty(DOMImplementationRegistry.PROPERTY, name); } catch(ClassNotFoundException e) { // Try the 2.7.0 version String name = "org.apache.xerces.dom.DOMXSImplementationSourceImpl"; System.setProperty(DOMImplementationRegistry.PROPERTY, name); } XSImplementation impl; try { DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); impl = (XSImplementation)registry.getDOMImplementation("XS-Loader"); } catch(Exception e) { throw new IllegalStateException("Failed to create schema loader: " + e.getClass().getName() + " " + e.getMessage()); } return impl; } }); } // Inner /** * An interface for XML name to Java identifier (class name, get/set methods, constant names) converter. * The following rules and algorithms should be supported *
      *
    • Binding XML Names to Java Identifiers, * C.2. The Name to Identifier Mapping Algorithm, * jaxb-2_0-edr-spec-10_jun_2004.pdf
    • *
    • http://www.w3.org/TR/soap12-part2/#namemap
    • *
    *

    * But these are not guaranteed to work yet. Instead, a simplified implementation is provided. * Incompatabilities should be fixed. */ interface XMLNameToJavaIdentifierConverter { // commands indicating what should be done with the next character from the XML name byte IGNORE = 0; byte APPEND = 1; byte APPEND_WITH_LOW_LINE = 2; byte APPEND_UPPER_CASED = 3; byte APPEND_UPPER_CASED_WITH_LOW_LINE = 4; /** * Returns a command for the next character given the previous character. * * @param prev previous character * @param next next character * @param ignoreLowLine whether low lines are allowed in the Java identifier or should be ignored * @return command for the next character */ byte commandForNext(char prev, char next, boolean ignoreLowLine); char firstCharacter(char ch, String str, int secondCharIndex); /** * An XML name parser class that parses the XML name and asks the outer interface implementation * what to do with the next parsed character from the XML name. */ final class PARSER { /** * Parses an XML name, asks the converter for a command for the next parsed character, * applies the command, composed the resulting Java identifier. * * @param converter an implementation of XMLNameToJavaIdentifierConverter * @param xmlName XML name * @param ignoreLowLine indicated whether low lines are allowed as part of the Java identifier or * should be ignored * @return Java identifier */ static String parse(XMLNameToJavaIdentifierConverter converter, String xmlName, boolean ignoreLowLine) { if(xmlName == null || xmlName.length() == 0) { throw new IllegalArgumentException("Bad XML name: " + xmlName); } char c = xmlName.charAt(0); int i = 1; if(!Character.isJavaIdentifierStart(c) || (c == LOW_LINE && ignoreLowLine)) { while(i < xmlName.length()) { c = xmlName.charAt(i++); if(Character.isJavaIdentifierStart(c) && !(c == LOW_LINE && ignoreLowLine)) { break; } } if(i == xmlName.length()) { throw new IllegalArgumentException( "XML name contains no valid character to start Java identifier: " + xmlName ); } } char[] buf = new char[xmlName.length() - i + 1]; buf[0] = converter.firstCharacter(c, xmlName, i); int bufInd = 1; while(i < xmlName.length()) { char prev = c; c = xmlName.charAt(i++); byte command = converter.commandForNext(prev, c, ignoreLowLine); switch(command) { case IGNORE: break; case APPEND: buf = Util.append(buf, bufInd++, c); break; case APPEND_WITH_LOW_LINE: buf = Util.append(buf, bufInd++, LOW_LINE); buf = Util.append(buf, bufInd++, c); break; case APPEND_UPPER_CASED: buf = Util.append(buf, bufInd++, Character.toUpperCase(c)); break; case APPEND_UPPER_CASED_WITH_LOW_LINE: buf = Util.append(buf, bufInd++, LOW_LINE); buf = Util.append(buf, bufInd++, Character.toUpperCase(c)); break; default: throw new IllegalArgumentException("Unexpected command: " + command); } } return new String(buf, 0, bufInd); } } /** * XML name to Java class name converter */ XMLNameToJavaIdentifierConverter CLASS_NAME = new XMLNameToJavaIdentifierConverter() { public char firstCharacter(char ch, String str, int secondCharIndex) { return Character.toUpperCase(ch); } public byte commandForNext(char prev, char next, boolean ignoreLowLine) { byte command; if(Character.isDigit(next)) { command = APPEND; } else if(next == LOW_LINE) { command = ignoreLowLine ? IGNORE : APPEND; } else if(Character.isJavaIdentifierPart(next)) { if(Character.isJavaIdentifierPart(prev) && !Character.isDigit(prev)) { command = prev == LOW_LINE ? APPEND_UPPER_CASED : APPEND; } else { command = APPEND_UPPER_CASED; } } else { command = IGNORE; } return command; } }; /** * XML name to Java class name converter */ XMLNameToJavaIdentifierConverter FIELD_NAME = new XMLNameToJavaIdentifierConverter() { public char firstCharacter(char ch, String str, int secondCharIndex) { if(Character.isLowerCase(ch)) { return ch; } else { return (str.length() > secondCharIndex && Character.isJavaIdentifierPart(str.charAt(secondCharIndex)) && Character.isUpperCase(str.charAt(secondCharIndex)) ) ? Character.toUpperCase(ch) : Character.toLowerCase(ch); } } public byte commandForNext(char prev, char next, boolean ignoreLowLine) { return CLASS_NAME.commandForNext(prev, next, ignoreLowLine); } }; /** * XML name to Java constant name converter */ XMLNameToJavaIdentifierConverter CONSTANT_NAME = new XMLNameToJavaIdentifierConverter() { public char firstCharacter(char ch, String str, int secondCharIndex) { return Character.toUpperCase(ch); } public byte commandForNext(char prev, char next, boolean ignoreLowLine) { byte command; if(Character.isDigit(next)) { command = Character.isDigit(prev) ? APPEND : APPEND_UPPER_CASED_WITH_LOW_LINE; } else if(Character.isJavaIdentifierPart(next)) { if(Character.isDigit(prev)) { command = APPEND_UPPER_CASED_WITH_LOW_LINE; } else if(Character.isJavaIdentifierPart(prev)) { command = Character.isUpperCase(next) ? (Character.isUpperCase(prev) ? APPEND_UPPER_CASED : APPEND_WITH_LOW_LINE) : APPEND_UPPER_CASED; } else { command = APPEND_UPPER_CASED_WITH_LOW_LINE; } } else { command = IGNORE; } return command; } }; } public static WildcardBinding getWildcard(TermBinding term) { if(term.isWildcard()) return (WildcardBinding) term; if(term.isModelGroup()) { ModelGroupBinding group = (ModelGroupBinding) term; for(Iterator i = group.getParticles().iterator(); i.hasNext();) { term = i.next().getTerm(); if(term.isWildcard()) return (WildcardBinding)term; else if(term.isModelGroup()) { WildcardBinding wc = getWildcard(term); if (wc != null) return wc; } } } return null; } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/SchemalessMarshaller.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/binding/SchemalessMarshaller.java0000644000175000017500000001601611061473704033175 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.binding; import org.jboss.logging.Logger; import org.xml.sax.SAXException; import java.io.StringWriter; import java.util.List; import java.util.Map; import java.util.HashMap; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.Properties; import java.lang.reflect.Method; import java.lang.reflect.Array; /** * Sandbox. Very testcase specific impl. * * @author Alexey Loubyansky * @version $Revision: 2913 $ */ public class SchemalessMarshaller { private static final Logger log = Logger.getLogger(SchemalessMarshaller.class); public static final String PROPERTY_JAXB_SCHEMA_LOCATION = "jaxb.schemaLocation"; private final Properties props = new Properties(); private final Map, List> gettersPerClass = new HashMap, List>(); private final Content content = new Content(); public void setProperty(String name, String value) { props.setProperty(name, value); } public void marshal(Object root, StringWriter writer) { log.debug("marshal: root=" + root); content.startDocument(); marshalObject(root, root.getClass().getName(), writer); content.endDocument(); writer.write("\n"); ContentWriter contentWriter = new ContentWriter(writer, true); try { content.handleContent(contentWriter); } catch(SAXException e) { log.error("Failed to write content.", e); throw new IllegalStateException("Failed to write content: " + e.getMessage()); } } private void marshalObject(Object root, String localName, StringWriter writer) { List getters = getGetterList(root.getClass()); AttributesImpl attrs = null; //new AttributesImpl(5); content.startElement(null, localName, localName, attrs); for(int i = 0; i < getters.size(); ++i) { Method getter = getters.get(i); Object child; try { child = getter.invoke(root, null); } catch(Exception e) { log.error("Failed to invoke getter " + getter.getName() + " on " + root, e); throw new IllegalStateException( "Failed to invoke getter " + getter.getName() + " on " + root + ": " + e.getMessage() ); } if(child != null) { String childName = getter.getName().substring(3); if(isAttributeType(child.getClass())) { marshalAttributeType(childName, child); /* attrs.add(null, getter.getName().substring(3), getter.getName().substring(3), getter.getClass().getName(), child.toString() ); */ } else if(child.getClass().isArray()) { content.startElement(null, childName, childName, null); for(int arrInd = 0; arrInd < Array.getLength(child); ++arrInd) { Object o = Array.get(child, arrInd); marshalCollectionItem(o, o.getClass().getName(), o.getClass().getName(), writer); } content.endElement(null, childName, childName); } else if(Collection.class.isAssignableFrom(child.getClass())) { content.startElement(null, childName, childName, null); Collection col = (Collection)child; for(Iterator iter = col.iterator(); iter.hasNext();) { Object o = iter.next(); marshalCollectionItem(o, o.getClass().getName(), o.getClass().getName(), writer); } content.endElement(null, childName, childName); } else { marshalObject(child, childName, writer); } } } content.endElement(null, localName, localName); } private void marshalCollectionItem(Object o, String childName, String qName, StringWriter writer) { if(o != null) { if(isAttributeType(o.getClass())) { marshalAttributeType(childName, o); } else { marshalObject(o, qName, writer); } } } private void marshalAttributeType(String qName, Object child) { content.startElement(null, qName, qName, null); String value = child.toString(); content.characters(value.toCharArray(), 0, value.length()); content.endElement(null, qName, qName); } private List getGetterList(Class aClass) { List getters = gettersPerClass.get(aClass); if(getters == null) { getters = new ArrayList(); Method[] methods = aClass.getMethods(); for(int i = 0; i < methods.length; ++i) { Method method = methods[i]; if(method.getDeclaringClass() != Object.class) { if((method.getName().startsWith("get") || method.getName().startsWith("is")) && (method.getParameterTypes() == null || method.getParameterTypes().length == 0)) { getters.add(method); } } } gettersPerClass.put(aClass, getters); } return getters; } static boolean isAttributeType(Class cls) { if(cls.isPrimitive() || cls == Byte.class || cls == Short.class || cls == Integer.class || cls == Long.class || cls == Float.class || cls == Double.class || cls == Character.class || cls == Boolean.class || cls == String.class || cls == java.util.Date.class) { return true; } else { return false; } } } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/0000755000175000017500000000000011620316770027147 5ustar twernertwerner././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlGroupText.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlGroupText.jav0000644000175000017500000000273010625561630033237 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * JBossGroupText. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlGroupText { Class wrapper() default Object.class; String property() default "value"; } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlMapValue.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlMapValue.java0000644000175000017500000000376510743142021033150 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * A JBossXmlMapValue. Specifies which property in the entry class * represents the entry's value. * If none of the properties in the entry class is annotated with * JBossXmlMapValue then an instance of the entry class * is considered the value. * * Note: this annotation doesn't bind Java element to XML schema construct * directly but just signifies which property should be used as the map * entry's value property. The standard JAXB/JBossXB annotations * should be used for binding the property to the XML schema construct. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.FIELD}) public @interface JBossXmlMapValue {} ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlGroupWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlGroupWildcard0000644000175000017500000000300410625561630033260 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * JBossGroupWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlGroupWildcard { boolean lax() default false; Class wrapper() default Object.class; String property() default "value"; } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlNsPrefix.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlNsPrefix.java0000644000175000017500000000601311134036000033153 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Sometimes, it is desirable to bind a class into different schemas * with different namespaces or bind a class hierarchy into a specific * target namespace and some of the classes into a different namespace * the value of which depends on the root element's namespace. * XmlElement's namespace attribute cannot be used in a case like that. * What we need is to specify a prefix instead of the namespace itself * and define the namespace to prefix mapping in the JBossXmlSchema annotation. * * This annotation is used to reference a namespace by its prefix. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Target({ElementType.FIELD, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlNsPrefix { String prefix(); /** * If the prefix mapping is not found and the value is true * then the target schema namespace will be used, if the value is * false then an exception will be thrown. * * @return */ boolean schemaTargetIfNotMapped() default false; /** * True means the element or model group the property is bound to will be bound to the namespace specified by the prefix. * False means the element or model group will be in the schema's target namespace. * * @return */ boolean applyToComponentQName() default true; /** * True means the type of the property (including its child elements, their types and model groups recursively) * will be bound to the namespace specified by the prefix. * False means the type of the property (including its child elements, their types and model groups recursively) * will be bound to the schema's target namespace. * * @return */ boolean applyToComponentContent() default true; } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlMapEntry.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlMapEntry.java0000644000175000017500000000670410742740174033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * A JBossXmlMapEntry. Binds Java maps to XSD structures. * The annotation can be used on a type which implements java.util.Map * or property of type that implements java.util.Map. * * Some of the possible bindings: * *

    sequence of key and value elements

    *
     * <key>key1</key><value>value1</value>
     * <key>key2</key><value>value2</value>
     * 
     * @JBossXmlMapKeyElement(name="key")
     * @JBossXmlMapValueElement(name="value")
     * public Map getMap(){ return map; }
     * 
    * *

    sequence of key and value elements wrapped inside entry element

    *
     * <entry>
     *   <key>key1</key>
     *   <value>value1</value>
     * </entry>
     * <entry>
     *   <key>key2</key>
     *   <value>value2</value>
     * </entry>
     * 
     * @JBossXmlMapEntry(name="entry")
     * @JBossXmlMapKeyElemenet(name="key")
     * @JBossXmlMapValueElement(name="value")
     * public Map getMap(){ return map; }
     * 
    * *

    key and value attributes in entry element

    *
     * <entry key='key1' value='value1'/>
     * <entry key='key2' value='value2'/>
     * 
     * @JBossXmlMapEntry(name="entry")
     * @JBossXmlMapKeyAttribute(name="key")
     * @JBossXmlMapValueAttribute(name="value")
     * public Map getMap(){ return map; }
     * 
    * *

    key is an attribute and the value is the value of entry element

    *
     * <entry key='key1'>value1</entry>
     * <entry key='key2'>value2</entry>
     * 
     * /**
     *  * value binding is not specified, it's supposed to be the value of entry element
     *  */
     * @JBossXmlMapEntry(name="entry")
     * @JBossXmlMapKeyAttribute(name="key")
     * public Map getMap(){ return map; }
     * 
    * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlMapEntry { String name() default JBossXmlConstants.DEFAULT; String namespace() default JBossXmlConstants.DEFAULT; Class type() default DEFAULT.class; class DEFAULT {}; } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlMapValueElement.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlMapValueEleme0000644000175000017500000000313110742740174033177 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * A JBossXmlMapValueElement. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlMapValueElement { String name(); String namespace() default JBossXmlConstants.DEFAULT; } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlMapKeyAttribute.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlMapKeyAttribu0000644000175000017500000000313110742740174033236 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * A JBossXmlMapKeyAttribute. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlMapKeyAttribute { String name(); String namespace() default JBossXmlConstants.DEFAULT; } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlModelGroup.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlModelGroup.ja0000644000175000017500000000474511350256505033173 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.xml.bind.annotation.XmlElement; /** * JBossXmlModelGroup binds a Java class to a model group in the schema. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlModelGroup { /** * if not specified, the default will be either sequence or unordered sequence depending on whether * unordered sequences are disabled (default) or enabled */ String kind() default JBossXmlConstants.DEFAULT; String name() default JBossXmlConstants.DEFAULT; /** * Used when a model group is bound to a Java class propeties * of which are bound to model group particles * * @return */ String[] propOrder() default {""}; JBossXmlAccessMode accessMode() default JBossXmlAccessMode.NOT_SPECIFIED; /** * Used when a model group is bound to a class hierarchy, * i.e. each subclass of the class annotated with JBossXmlModelGroup * is bound to particle of the model group. * Note: most likely the model group is going to be a choice (?) */ Particle[] particles() default {}; @interface Particle { XmlElement element(); Class type(); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlNoElements.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlNoElements.ja0000644000175000017500000000260410625561630033161 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * JBossNoElements. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlNoElements { } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlMapValueAttribute.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlMapValueAttri0000644000175000017500000000313510742740174033237 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * A JBossXmlMapValueAttribute. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlMapValueAttribute { String name(); String namespace() default JBossXmlConstants.DEFAULT; } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlValue.java0000644000175000017500000000275311061213247032511 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * A JBossXmlValue. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlValue { boolean ignoreEmptyString() default true; } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlPreserveWhitespace.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlPreserveWhite0000644000175000017500000000332611042106731033304 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2005, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * A JBossXmlPreserveWhitespace. * This annotation can be used for string properties to signify whether to trim or preserve whitespaces of the values. * The schema default behavior is set with JBossXmlSchema.normalizeSpace(). * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlPreserveWhitespace { boolean preserve() default true; } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlType.java0000644000175000017500000000356111345730356032366 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.jboss.xb.spi.BeanAdapterBuilder; import org.jboss.xb.spi.DefaultBeanAdapterBuilder; /** * JBossXmlType. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlType { /** * The bean adapter builder * * @return the builder */ Class beanAdapterBuilder() default DefaultBeanAdapterBuilder.class; /** * @return model group type which should be used for the xml type */ String modelGroup() default JBossXmlConstants.DEFAULT; JBossXmlAccessMode accessMode() default JBossXmlAccessMode.NOT_SPECIFIED; } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlMapKey.java0000644000175000017500000000365610743142021032623 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * A JBossXmlMapKey. Specifies which property in the entry class * represents the entry's key. * There must be only one property in the entry class annotated with * JBossXmlMapKey. * * Note: this annotation doesn't bind Java element to XML schema construct * directly but just signifies which property should be used as the map * entry's key property. The standard JAXB/JBossXB annotations * should be used for binding the property to the XML schema construct. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.FIELD}) public @interface JBossXmlMapKey {} ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlTransient.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlTransient.jav0000644000175000017500000000276211225465065033254 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * A JBossXmlTransient. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Target(ElementType.PACKAGE) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlTransient { Class type(); String[] properties() default {}; } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlConstants.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlConstants.jav0000644000175000017500000000273211151173230033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; /** * JBossXmlConstants. * * @author Adrian Brock * @version $Revision: 1.1 $ */ public interface JBossXmlConstants { /** A default value */ String DEFAULT = "##default"; String MODEL_GROUP_SEQUENCE = "sequence"; String MODEL_GROUP_CHOICE = "choice"; String MODEL_GROUP_ALL = "all"; String MODEL_GROUP_UNORDERED_SEQUENCE = "unordered_sequence"; class DEFAULT { private DEFAULT(){} } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlTransients.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlTransients.ja0000644000175000017500000000272511225465065033250 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2009, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * A JBossXmlTransients. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Target(ElementType.PACKAGE) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlTransients { JBossXmlTransient[] value(); } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlMapKeyElement.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlMapKeyElement0000644000175000017500000000312510742740174033220 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * A JBossXmlMapKeyElement. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlMapKeyElement { String name(); String namespace() default JBossXmlConstants.DEFAULT; } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlCollection.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlCollection.ja0000644000175000017500000000327610707700162033205 0ustar twernertwerner/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * A JBossXmlCollection. * * Used to specify the implementation of java.util.Collection * for collection properties. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlCollection { Class type() default java.util.ArrayList.class; } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlAdaptedTypes.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlAdaptedTypes.0000644000175000017500000000270210625561630033163 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * JBossXmlAdaptedTypes. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Target({ElementType.PACKAGE, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlAdaptedTypes { JBossXmlAdaptedType[] value(); } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlAdaptedType.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlAdaptedType.j0000644000175000017500000000343511046574376033167 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter; /** * JBossXmlAdaptedType. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Target({ElementType.PACKAGE, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlAdaptedType { /** The namespace **/ String namespace() default JBossXmlConstants.DEFAULT; /** The name **/ String name() default JBossXmlConstants.DEFAULT; /** The type */ Class type() default JBossXmlConstants.DEFAULT.class; /** The value adapter */ Class valueAdapter(); } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlGroup.java0000644000175000017500000000262610625561630032537 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * JBossGroup. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlGroup { JBossXmlChild[] value(); } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlChildren.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlChildren.java0000644000175000017500000000263410625561630033172 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * JBossChildren. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlChildren { JBossXmlChild[] value(); } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlAccessMode.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlAccessMode.ja0000644000175000017500000000325311345730356033122 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2010, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; /** * A JBossXmlPropertyAccessMode. * * @author Alexey Loubyansky * @version $Revision: 1.1 $ */ public enum JBossXmlAccessMode { // not specified which means it will inherit the value from somewhere else depending on the context NOT_SPECIFIED, // equivalent to javax.xml.bind.annotation.XmlAccessType.PROPERTY and org.jboss.beans.info.spi.BeanAccessMode.STANDARD PROPERTY, // equivalent to javax.xml.bind.annotation.XmlAccessType.PUBLIC_MEMBER and org.jboss.beans.info.spi.BeanAccessMode.FIELD PUBLIC_MEMBER, // org.jboss.beans.info.spi.BeanAccessMode.ALL ALL } ././@LongLink0000000000000000000000000000015200000000000011563 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlChildWildcard.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlChildWildcard0000644000175000017500000000300410625561630033207 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * JBossChildWildcard. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlChildWildcard { boolean lax() default false; Class wrapper() default Object.class; String property() default "value"; } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlEnum.java0000644000175000017500000000265610770206227032351 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.Target; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * JBoss enum extension. * * @author Ales Justin */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlEnum { boolean ignoreCase(); } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlChild.java0000644000175000017500000000321410651631511032453 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * JBossChild. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlChild { /** The namespace **/ String namespace() default JBossXmlConstants.DEFAULT; /** The name **/ String name(); int minOccurs() default 0; int maxOccurs() default 1; boolean unbounded() default false; /** The type */ Class type(); } libjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlSchema.java0000755000175000017500000000502611345730356032646 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.xml.bind.annotation.XmlNs; import javax.xml.bind.annotation.XmlNsForm; /** * JBossXmlSchema. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Target({ElementType.TYPE, ElementType.PACKAGE}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlSchema { /** The namespace **/ String namespace() default JBossXmlConstants.DEFAULT; /** The element form default */ XmlNsForm elementFormDefault() default XmlNsForm.UNSET; /** The attribute form default */ XmlNsForm attributeFormDefault() default XmlNsForm.UNSET; XmlNs[] xmlns() default {}; /** Whether to ignore unresolved field and class names, default true */ boolean ignoreUnresolvedFieldOrClass() default true; /** Should _ be considered as part of a java identifier, default true */ boolean ignoreLowLine() default true; /** Should system properties be replaced, default true */ boolean replacePropertyRefs() default true; /** The package name to resolve classes, default is package or the package of the type */ String packageName() default JBossXmlConstants.DEFAULT; /** Whether the schema is strict */ boolean strict() default true; /** Whether to trim string values */ boolean normalizeSpace() default false; JBossXmlAccessMode accessMode() default JBossXmlAccessMode.PROPERTY; } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootlibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlAttribute.javalibjboss-xml-binding-java-2.0.3.GA.orig/src/main/java/org/jboss/xb/annotations/JBossXmlAttribute.jav0000644000175000017500000000274010625561630033242 0ustar twernertwerner/* * JBoss, Home of Professional Open Source * Copyright 2006, JBoss Inc., and individual contributors as indicated * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.xb.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * JBossXmlAttribute. * * @author Adrian Brock * @version $Revision: 1.1 $ */ @Target({ElementType.METHOD, ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) public @interface JBossXmlAttribute { /** The attribute type */ Class type() default Object.class; } libjboss-xml-binding-java-2.0.3.GA.orig/projectSet.psf0000644000175000017500000000034710475105455022501 0ustar twernertwerner libjboss-xml-binding-java-2.0.3.GA.orig/.project0000644000175000017500000000110211374713342021301 0ustar twernertwerner jbossxb JBoss XML Binding org.eclipse.jdt.core.javabuilder org.maven.ide.eclipse.maven2Builder org.maven.ide.eclipse.maven2Nature org.eclipse.jdt.core.javanature