├── .gitignore ├── MIT-LICENSE ├── README.md ├── build.xml ├── common-taskdefs.xml ├── common.xml ├── contrib-helper.xml ├── contrib.xml ├── depend.xml ├── exclude ├── paths ├── external-build-jars └── external-se-jars ├── project-setup.xml ├── raxs ├── MIT-LICENSE ├── build.xml ├── scripts │ ├── exper │ │ ├── editcommit │ │ ├── rndedit │ │ ├── rndread │ │ ├── seqread │ │ └── versionrecall │ └── verify │ │ ├── sync-initial │ │ ├── sync-local │ │ ├── sync-raxs │ │ └── sync-remote └── test │ ├── ebook │ ├── images │ │ ├── FS-layout.png │ │ ├── abiword-taskbar.png │ │ ├── brother-webinterface.png │ │ ├── caution.gif │ │ ├── evolution.png │ │ ├── fork-and-exec.png │ │ ├── formatfloppy.png │ │ ├── home.gif │ │ ├── important.gif │ │ ├── itl.jpg │ │ ├── konqueror.png │ │ ├── links.png │ │ ├── next.gif │ │ ├── note.gif │ │ ├── openoffice.png │ │ ├── prev.gif │ │ ├── printconf.png │ │ ├── redcarpet.png │ │ ├── redhat-config-network.png │ │ ├── ssh_X11.png │ │ ├── system-monitor.png │ │ ├── tip.gif │ │ ├── toc-blank.gif │ │ ├── toc-minus.gif │ │ ├── toc-plus.gif │ │ ├── trappen.png │ │ ├── up.gif │ │ ├── warning.gif │ │ ├── xcdroast.png │ │ ├── xchat.png │ │ ├── xmms.png │ │ └── xterm.png │ ├── linux-intro.xml │ └── simple-docbook.xsl │ └── simple │ └── simple.xml ├── res ├── exper │ ├── firsts │ └── lasts └── test │ └── xml │ └── rsp8.xml ├── src ├── .gitignore ├── deps.py ├── fc │ ├── test │ │ ├── XmlTest.java │ │ ├── bench │ │ │ ├── XmlMemory.java │ │ │ └── XmlPass.java │ │ └── junit │ │ │ ├── XasTest.java │ │ │ └── XmlData.java │ ├── util │ │ ├── BaInputStream.java │ │ ├── ByteArray.java │ │ ├── CompareUtil.java │ │ ├── Debug.java │ │ ├── ExtUtil.java │ │ ├── IOExceptionTrap.java │ │ ├── IOUtil.java │ │ ├── ImmutableArrayList.java │ │ ├── MagicInputStream.java │ │ ├── Measurer.java │ │ ├── Pair.java │ │ ├── RaInputStream.java │ │ ├── RingBuffer.java │ │ ├── SeekableInputStream.java │ │ ├── Stack.java │ │ ├── StringUtil.java │ │ ├── Utf8Reader.java │ │ ├── Util.java │ │ └── log │ │ │ ├── AbstractLogger.java │ │ │ ├── Log.java │ │ │ ├── LogLevels.java │ │ │ ├── Logger.java │ │ │ ├── StreamLogger.java │ │ │ └── SysoutLogger.java │ └── xml │ │ ├── diff │ │ ├── Diff.java │ │ ├── GlMatcher.java │ │ ├── HashAlgorithm.java │ │ ├── IoUtil.java │ │ ├── Patch.java │ │ ├── Preamble.java │ │ ├── Segment.java │ │ ├── benchmark │ │ │ ├── BenchMark.java │ │ │ ├── SynteticDirTree.java │ │ │ └── UseCases.java │ │ ├── encode │ │ │ ├── AlignEncoder.java │ │ │ ├── DefaultPosTranformer.java │ │ │ ├── DiffEncoder.java │ │ │ ├── ListOfMatchedEvents.java │ │ │ ├── ListPosTransformer.java │ │ │ ├── PosTransformer.java │ │ │ ├── RefTreeByIdEncoder.java │ │ │ ├── RefTreeEncoder.java │ │ │ └── XmlDiffEncoder.java │ │ └── test │ │ │ ├── DirTreeGenerator.java │ │ │ └── RootSuite.java │ │ ├── xas │ │ ├── AppendableItem.java │ │ ├── AttributeNode.java │ │ ├── Comment.java │ │ ├── Doctype.java │ │ ├── EndDocument.java │ │ ├── EndTag.java │ │ ├── EntityRef.java │ │ ├── FormatFactory.java │ │ ├── FragmentItem.java │ │ ├── FragmentIterator.java │ │ ├── FragmentPointer.java │ │ ├── Item.java │ │ ├── ItemList.java │ │ ├── ItemSource.java │ │ ├── ItemTarget.java │ │ ├── ItemTransform.java │ │ ├── MutableFragmentPointer.java │ │ ├── MutablePointer.java │ │ ├── NullItem.java │ │ ├── ParserSource.java │ │ ├── Pi.java │ │ ├── Pointer.java │ │ ├── PrefixNode.java │ │ ├── Qname.java │ │ ├── Queryable.java │ │ ├── SerializableItem.java │ │ ├── SerializerTarget.java │ │ ├── StartDocument.java │ │ ├── StartTag.java │ │ ├── TargetOutputStream.java │ │ ├── Text.java │ │ ├── TransformSource.java │ │ ├── TransformTarget.java │ │ ├── Verifier.java │ │ ├── WrapperItem.java │ │ ├── XasFragment.java │ │ ├── XasUtil.java │ │ ├── XmlFormatFactory.java │ │ ├── XmlOutput.java │ │ ├── XmlPullFactory.java │ │ ├── XmlPullSource.java │ │ ├── XmlPullTarget.java │ │ ├── index │ │ │ ├── DeweyKey.java │ │ │ ├── Document.java │ │ │ ├── GlobalPointer.java │ │ │ ├── Index.java │ │ │ ├── KeyIterator.java │ │ │ ├── LazyFragment.java │ │ │ ├── LazyPointer.java │ │ │ ├── SeekableKXmlSource.java │ │ │ ├── SeekableParserSource.java │ │ │ ├── SeekableSource.java │ │ │ ├── VersionNode.java │ │ │ ├── VersionedDocument.java │ │ │ ├── VersionedEntry.java │ │ │ └── VersionedPointer.java │ │ ├── transform │ │ │ ├── CoalesceContent.java │ │ │ ├── DataItems.java │ │ │ └── NsPrefixFixer.java │ │ └── typing │ │ │ ├── Codec.java │ │ │ ├── DecodeSource.java │ │ │ ├── ParsedPrimitive.java │ │ │ ├── PrimitiveCodec.java │ │ │ ├── PrimitiveSource.java │ │ │ ├── TypedItem.java │ │ │ ├── TypingUtil.java │ │ │ ├── UnparsedPrimitive.java │ │ │ ├── ValueCodec.java │ │ │ └── XmlCodec.java │ │ └── xmlr │ │ ├── AbstractMutableRefTree.java │ │ ├── BatchMutable.java │ │ ├── ChangeBuffer.java │ │ ├── ChangeTree.java │ │ ├── DerefRefTree.java │ │ ├── IdAddressableRefTree.java │ │ ├── IdAddressableRefTreeImpl.java │ │ ├── Key.java │ │ ├── KeyMap.java │ │ ├── MutableRefTree.java │ │ ├── MutableRefTreeImpl.java │ │ ├── NodeNotFoundException.java │ │ ├── NodeReference.java │ │ ├── RefTree.java │ │ ├── RefTreeImpl.java │ │ ├── RefTreeNode.java │ │ ├── RefTreeNodeImpl.java │ │ ├── RefTrees.java │ │ ├── Reference.java │ │ ├── RekeyedRefTree.java │ │ ├── TreeReference.java │ │ ├── XmlrDebug.java │ │ ├── XmlrUtil.java │ │ ├── model │ │ ├── IdentificationModel.java │ │ ├── KeyIdentificationModel.java │ │ ├── KeyModel.java │ │ ├── NodeModel.java │ │ ├── StringKey.java │ │ ├── TransientKey.java │ │ ├── TreeModel.java │ │ ├── TreeModels.java │ │ └── XasCodec.java │ │ ├── tdm │ │ └── Diff.java │ │ ├── test │ │ ├── DeweyKeyedRefTree.java │ │ ├── RandomDirectoryTree.java │ │ ├── RootSuite.java │ │ ├── TestChangeTree.java │ │ ├── TestDeweyTrees.java │ │ ├── TestMutableTree.java │ │ ├── TestRefTrees.java │ │ ├── TreeUtil.java │ │ └── XasTests.java │ │ └── xas │ │ ├── DeweyKey.java │ │ ├── DeweyRefNode.java │ │ ├── DeweyXasSource.java │ │ ├── IdAttributeXasSource.java │ │ ├── MalformedXml.java │ │ ├── MutableDeweyRefTree.java │ │ ├── PeekableItemSource.java │ │ ├── RandomAccessSource.java │ │ ├── RefItem.java │ │ ├── RefNodeItem.java │ │ ├── RefTreeItem.java │ │ ├── ReferenceItemTransform.java │ │ ├── UniformXasCodec.java │ │ ├── XasRefTree.java │ │ └── XasSerialization.java ├── fuegocore │ ├── message │ │ ├── encoding │ │ │ ├── EoaMachine.java │ │ │ ├── IdentityEoaMachine.java │ │ │ ├── OutCache.java │ │ │ ├── OutTokenCache.java │ │ │ ├── SequenceCache.java │ │ │ ├── TokenCacheCodecFactory.java │ │ │ ├── XebuConstants.java │ │ │ ├── XebuSerializer.java │ │ │ ├── XebuUtil.java │ │ │ └── package.html │ │ ├── package.html │ │ └── tests │ │ │ ├── CacheTest.java │ │ │ ├── MessageSuite.java │ │ │ └── package.html │ └── util │ │ ├── Base64.java │ │ ├── ByteBuffer.java │ │ ├── ExtUtil.java │ │ ├── MagicInputStream.java │ │ ├── Queue.java │ │ ├── RootSuite.java │ │ ├── TimeMeasurer.java │ │ ├── Util.java │ │ ├── package.html │ │ ├── tests │ │ ├── Condition.java │ │ ├── QueueTest.java │ │ ├── TestConsole.java │ │ ├── UtilSuite.java │ │ ├── UtilTest.java │ │ ├── XasData.java │ │ ├── XasTest.java │ │ └── package.html │ │ └── xas │ │ ├── ChainedContentDecoder.java │ │ ├── ChainedContentEncoder.java │ │ ├── CoalescedEventSequence.java │ │ ├── CodecFactory.java │ │ ├── CodecIndustry.java │ │ ├── ContentCodecFactory.java │ │ ├── ContentDecoder.java │ │ ├── ContentEncoder.java │ │ ├── DataEventSequence.java │ │ ├── DefaultXmlParser.java │ │ ├── DefaultXmlSerializer.java │ │ ├── Event.java │ │ ├── EventList.java │ │ ├── EventSequence.java │ │ ├── EventSerializer.java │ │ ├── EventStream.java │ │ ├── ForgetfulEventStream.java │ │ ├── Qname.java │ │ ├── SaxBridge.java │ │ ├── SaxReader.java │ │ ├── SaxWriter.java │ │ ├── TransformedEventStream.java │ │ ├── TypedEventStream.java │ │ ├── TypedXmlParser.java │ │ ├── TypedXmlSerializer.java │ │ ├── XasExtUtil.java │ │ ├── XasUtil.java │ │ ├── XmlCodecFactory.java │ │ ├── XmlReader.java │ │ ├── XmlSchemaContentDecoder.java │ │ ├── XmlSchemaContentEncoder.java │ │ ├── XmlTee.java │ │ ├── XmlWriter.java │ │ ├── codec │ │ ├── DefaultCodecFactory.java │ │ ├── EventSequenceCodecFactory.java │ │ ├── EventSequenceDecoder.java │ │ ├── EventSequenceEncoder.java │ │ ├── HashtableCodecFactory.java │ │ ├── HashtableDecoder.java │ │ ├── HashtableEncoder.java │ │ ├── VectorCodecFactory.java │ │ ├── VectorDecoder.java │ │ ├── VectorEncoder.java │ │ └── package.html │ │ └── package.html ├── net │ └── iharder │ │ └── Base64.java └── org │ └── kxml2 │ └── io │ ├── KXmlParser.java │ └── KXmlSerializer.java ├── subproject.xml └── test ├── 5l.xml ├── 5r.xml ├── charset └── fi │ ├── 1.xml │ ├── 2.xml │ ├── b.xml │ └── m.xml ├── faxma └── greedy-fail │ ├── 1.xml │ ├── 2.xml │ ├── b.xml │ └── m.xml ├── ronnau-towards ├── README ├── faxma.benchmark.UseCases ├── large-base.sxw ├── large-maxdelta.sxw ├── large-meddelta.sxw ├── large-mindelta.sxw ├── medium-base.sxw ├── medium-maxdelta.sxw ├── medium-meddelta.sxw ├── medium-mindelta.sxw ├── small-base.sxw ├── small-maxdelta.sxw ├── small-meddelta.sxw └── small-mindelta.sxw ├── simple └── diff │ ├── text1 │ ├── 1.xml │ ├── README │ └── b.xml │ ├── text2 │ ├── 1.xml │ ├── README │ └── b.xml │ └── text3 │ ├── 1.xml │ ├── 1a.xml │ ├── b.xml │ └── ba.xml ├── state ├── a10.fail ├── a14.fail ├── a17.fail ├── a5.fail ├── a6.fail ├── a8.fail ├── d4.fail ├── f2.fail ├── infopage1.ok ├── infopage2.ok ├── pdaedit.fail ├── shopping2.ok └── svgdoc.ok └── usecases ├── infopage1 ├── 1.xml ├── 2.xml ├── b.xml ├── faxma.benchmark.UseCases ├── m.xml └── m1.xml ├── infopage2 ├── 1.xml ├── 2.xml ├── b.xml ├── faxma.benchmark.UseCases ├── m.xml ├── m1.xml └── m2.xml ├── pdaedit ├── 1.xml ├── 2.xml ├── b.xml ├── faxma.benchmark.UseCases └── m.xml ├── review1 ├── 1.xml ├── 2.xml ├── b.xml ├── faxma.benchmark.UseCases └── m.xml ├── review2 ├── 1.xml ├── 2.xml ├── b.xml ├── faxma.benchmark.UseCases └── m.xml ├── shopping1 ├── 1.xml ├── 2.xml ├── b.xml ├── faxma.benchmark.UseCases ├── m.xml └── m1.xml ├── shopping2 ├── 1.xml ├── 2.xml ├── b.xml ├── faxma.benchmark.UseCases └── m.xml ├── svgdoc ├── 1.xml ├── 2.xml ├── b.xml ├── faxma.benchmark.UseCases └── m.xml └── xml-shorttag-trickery ├── 1.xml ├── 2.xml ├── b.xml └── m.xml /.gitignore: -------------------------------------------------------------------------------- 1 | =build 2 | +depend 3 | +test.log 4 | +tmp-test 5 | contrib 6 | .classpath 7 | .project 8 | .settings 9 | -------------------------------------------------------------------------------- /MIT-LICENSE: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining 2 | a copy of this software and associated documentation files (the 3 | "Software"), to deal in the Software without restriction, including 4 | without limitation the rights to use, copy, modify, merge, publish, 5 | distribute, sublicense, and/or sell copies of the Software, and to 6 | permit persons to whom the Software is furnished to do so, subject to 7 | the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be 10 | included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 13 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 14 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 15 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 16 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 17 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 18 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /common-taskdefs.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 14 | 15 | 17 | -------------------------------------------------------------------------------- /depend.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /exclude: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/exclude -------------------------------------------------------------------------------- /paths/external-build-jars: -------------------------------------------------------------------------------- 1 | # List of path elements in fuego core common pool 2 | # needed by the build system 3 | # Build system stuff 4 | ${fc.contrib}/findbugs-0.9.4-ant.jar 5 | ${fc.contrib}/findbugs-0.9.4-bcel.jar 6 | ${fc.contrib}/findbugs-0.9.4-coreplugin.jar 7 | ${fc.contrib}/findbugs-0.9.4-dom4j-full.jar 8 | ${fc.contrib}/findbugs-0.9.4.jar 9 | ${fc.contrib}/proguard-3.5.jar 10 | -------------------------------------------------------------------------------- /paths/external-se-jars: -------------------------------------------------------------------------------- 1 | # List of path elements in fuego core common pool 2 | # needed to run the software 3 | ${fc.contrib}/3dm-0.1.5b1.jar 4 | ${fc.contrib}/junit-3.8.1.jar 5 | ${fc.contrib}/xmlpull-1.1.3.4a.jar 6 | -------------------------------------------------------------------------------- /project-setup.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /raxs/MIT-LICENSE: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining 2 | a copy of this software and associated documentation files (the 3 | "Software"), to deal in the Software without restriction, including 4 | without limitation the rights to use, copy, modify, merge, publish, 5 | distribute, sublicense, and/or sell copies of the Software, and to 6 | permit persons to whom the Software is furnished to do so, subject to 7 | the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be 10 | included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 13 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 14 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 15 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 16 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 17 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 18 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /raxs/scripts/exper/editcommit: -------------------------------------------------------------------------------- 1 | # Random read test 2 | 3 | createprop fc.log.level=DEBUG 4 | createprop pdf=Iidduumm 5 | 6 | 7 | create --clean buzz 8 | :buzz cdef test=fc.raxs.exper.RandomEdits.randomEditCycle 9 | 10 | # Random edits; size=vary, edits=fixed 11 | # Store 1 12 | createprop store=fc.raxs.IdStore 13 | createprop test=ec size=1000 edits=20 max=50000 step=1000 by=time 14 | 15 | :buzz test --@@{by} --file @@{test}-@@{by}-@@{store} \ 16 | --pdf @@{pdf} --seed 42 --store @@{store} \ 17 | --size @@{size} \ 18 | --edits @@{edits} --maxedits @@{edits} --step 1 \ 19 | --maxsize @@{max} --sizestep @@{step} 20 | 21 | # Store 2 22 | createprop store=fc.raxs.DeweyStore 23 | :buzz test --@@{by} --file @@{test}-@@{by}-@@{store} \ 24 | --pdf @@{pdf} --seed 42 --store @@{store} \ 25 | --size @@{size} \ 26 | --edits @@{edits} --maxedits @@{edits} --step 1 \ 27 | --maxsize @@{max} --sizestep @@{step} 28 | 29 | # Copy results if we are running in update mode 30 | if @@{fc.raxs.exper.update} echo Updating results... 31 | if @@{fc.raxs.exper.update} sys /bin/sh -c "cp -v buzz/ec* \ 32 | ../../../../docs/deliverables/result/data/raxs" 33 | 34 | # arch-tag: 6bfa7e02-1dcd-402e-9526-075e6c09e088 35 | # 36 | -------------------------------------------------------------------------------- /raxs/scripts/exper/seqread: -------------------------------------------------------------------------------- 1 | # Sequential read test 2 | 3 | createprop fc.log.level=DEBUG syxrunner.jvmargs=-Xmx512m 4 | createprop pdf=iIdduumm test=seq by=time size=1000 max=100000 step=1000 5 | 6 | create --clean buzz 7 | :buzz cdef test=fc.raxs.exper.RandomEdits.sequentialRead 8 | # Store 1 9 | createprop store=fc.raxs.IdStore 10 | :buzz test --@@{by} --file @@{test}-@@{by}-@@{store} \ 11 | --pdf @@{pdf} --seed 42 --store @@{store} \ 12 | --size @@{size} --maxsize @@{max} --sizestep @@{step} 13 | 14 | # Store 2 15 | createprop store=fc.raxs.DeweyStore 16 | :buzz test --@@{by} --file @@{test}-@@{by}-@@{store} \ 17 | --pdf @@{pdf} --seed 42 --store @@{store} \ 18 | --size @@{size} --maxsize @@{max} --sizestep @@{step} 19 | 20 | # Store 3 21 | createprop store=fc.raxs.exper.IdStore 22 | :buzz test --@@{by} --file @@{test}-@@{by}-@@{store} \ 23 | --pdf @@{pdf} --seed 42 --store @@{store} \ 24 | --size @@{size} --maxsize @@{max} --sizestep @@{step} 25 | 26 | # Store 4 27 | createprop store=fc.raxs.exper.DeweyStore 28 | :buzz test --@@{by} --file @@{test}-@@{by}-@@{store} \ 29 | --pdf @@{pdf} --seed 42 --store @@{store} \ 30 | --size @@{size} --maxsize @@{max} --sizestep @@{step} 31 | 32 | # ==== Memory tests ======== 33 | # Store 1 34 | createprop by=memory store=fc.raxs.IdStore 35 | :buzz test --@@{by} --file @@{test}-@@{by}-@@{store} \ 36 | --pdf @@{pdf} --seed 42 --store @@{store} \ 37 | --size @@{size} --maxsize @@{max} --sizestep @@{step} 38 | 39 | # Store 2 40 | createprop store=fc.raxs.DeweyStore 41 | :buzz test --@@{by} --file @@{test}-@@{by}-@@{store} \ 42 | --pdf @@{pdf} --seed 42 --store @@{store} \ 43 | --size @@{size} --maxsize @@{max} --sizestep @@{step} 44 | 45 | # Store 3 46 | createprop store=fc.raxs.exper.IdStore 47 | :buzz test --@@{by} --file @@{test}-@@{by}-@@{store} \ 48 | --pdf @@{pdf} --seed 42 --store @@{store} \ 49 | --size @@{size} --maxsize @@{max} --sizestep @@{step} 50 | 51 | # Store 4 52 | createprop store=fc.raxs.exper.DeweyStore 53 | :buzz test --@@{by} --file @@{test}-@@{by}-@@{store} \ 54 | --pdf @@{pdf} --seed 42 --store @@{store} \ 55 | --size @@{size} --maxsize @@{max} --sizestep @@{step} 56 | 57 | # Copy results if we are running in update mode 58 | if @@{fc.raxs.exper.update} sys /bin/sh -c "pwd; cp buzz/@@{test}* \ 59 | ../../../../docs/deliverables/result/data/raxs" 60 | 61 | echo Done 62 | # arch-tag: c5b18d7c-7b16-4334-8ff8-adf6bfcb252b 63 | -------------------------------------------------------------------------------- /raxs/scripts/exper/versionrecall: -------------------------------------------------------------------------------- 1 | # Version recall test 2 | 3 | createprop fc.log.level=DEBUG 4 | createprop pdf=Iidduumm 5 | 6 | 7 | create --clean buzz 8 | :buzz cdef test=fc.raxs.exper.RandomEdits.versionRecall 9 | 10 | 11 | createprop test=vr size=10000 min=0 max=110 step=5 by=time 12 | 13 | # Store 1 14 | createprop store=fc.raxs.IdStore 15 | :buzz test --@@{by} --file @@{test}-@@{by}-@@{store} \ 16 | --pdf @@{pdf} --seed 42 --store @@{store} \ 17 | --size @@{size} --versions 25 \ 18 | --edits @@{min} --maxedits @@{max} --step @@{step} 19 | 20 | # Store 2 21 | createprop store=fc.raxs.DeweyStore 22 | :buzz test --@@{by} --file @@{test}-@@{by}-@@{store} \ 23 | --pdf @@{pdf} --seed 42 --store @@{store} \ 24 | --size @@{size} --versions 25 \ 25 | --edits @@{min} --maxedits @@{max} --step @@{step} 26 | 27 | 28 | # Copy results if we are running in update mode 29 | if @@{fc.raxs.exper.update} echo Updating results... 30 | if @@{fc.raxs.exper.update} sys /bin/sh -c "cp -v buzz/vr* \ 31 | ../../../../docs/deliverables/result/data/raxs" 32 | 33 | # arch-tag: fb920520-df9d-4ef9-90c2-a839cbb41c39 34 | -------------------------------------------------------------------------------- /raxs/scripts/verify/sync-initial: -------------------------------------------------------------------------------- 1 | # Basic RAXS Sync test to verify initial sync 2 | createprop fc.log.level=WARNING syxaw.http.retries=0 3 | createprop syxaw.firstversion=1000 syxaw.uid.seed=42 SyncTest=fc.syxaw.raxs.test.SyncTest 4 | create --clean buzz 5 | createprop syxaw.firstversion=2000 syxaw.uid.seed=314 6 | create --clean rex 7 | 8 | # Setup 9 | :buzz @@{SyncTest}.registerMerger 10 | :rex @@{SyncTest}.registerMerger 11 | 12 | # Make initial store & links 13 | copy ../../raxs/test/simple/simple.xml buzz/simple.xml 14 | :buzz @@{SyncTest}.setupStore simple.xml raxs-store 15 | #:buzz lls raxs-store 16 | 17 | :rex touchf empty.xml 18 | :rex @@{SyncTest}.setupStore empty.xml raxs-store 19 | :rex ln --nolmod buzz/5DwIT0u7K_GDne5GbYUstQ raxs-store 20 | #:rex lls raxs-store 21 | 22 | # Initial sync 23 | :rex sync raxs-store 24 | :buzz lls raxs-store 25 | :rex lls raxs-store 26 | :buzz verify raxs-store 3 * -. * type=application/xml+raxs 27 | :rex verify raxs-store * 3 .- * type=application/xml+raxs 28 | copy -r buzz/raxs-store rex/buzz-raxs-store 29 | :rex @@{SyncTest}.storeComp buzz-raxs-store raxs-store 30 | 31 | # arch-tag: 53bca24c-85aa-4ebe-a9c3-3f0fc3fcadfa 32 | -------------------------------------------------------------------------------- /raxs/scripts/verify/sync-local: -------------------------------------------------------------------------------- 1 | # Basic RAXS Sync test to verify local mod sync 2 | createprop fc.log.level=WARNING syxaw.http.retries=0 3 | createprop syxaw.firstversion=1000 syxaw.uid.seed=42 SyncTest=fc.syxaw.raxs.test.SyncTest 4 | create --clean buzz 5 | createprop syxaw.firstversion=2000 syxaw.uid.seed=314 6 | create --clean rex 7 | 8 | # Setup 9 | :buzz @@{SyncTest}.registerMerger 10 | :rex @@{SyncTest}.registerMerger 11 | 12 | # Make initial store & links 13 | copy ../../raxs/test/simple/simple.xml buzz/simple.xml 14 | :buzz @@{SyncTest}.setupStore simple.xml raxs-store 15 | #:buzz lls raxs-store 16 | 17 | :rex touchf empty.xml 18 | :rex @@{SyncTest}.setupStore empty.xml raxs-store 19 | :rex ln --nolmod buzz/5DwIT0u7K_GDne5GbYUstQ raxs-store 20 | #:rex lls raxs-store 21 | 22 | # Initial sync 23 | :rex sync raxs-store 24 | :buzz verify raxs-store 3 * -. * type=application/xml+raxs 25 | :rex verify raxs-store * 3 .- * type=application/xml+raxs 26 | 27 | # Local mod. Sleep needed to trigger dir modtime change 28 | sleep 2 29 | :rex @@{SyncTest}.makeMod raxs-store mod-1 30 | #:rex lls raxs-store 31 | :rex sync raxs-store 32 | #:buzz lls raxs-store 33 | #:rex lls raxs-store 34 | 35 | :buzz verify raxs-store 5 * -. * type=application/xml+raxs 36 | :rex verify raxs-store * 5 .- * type=application/xml+raxs 37 | :buzz @@{SyncTest}.testMod raxs-store mod-1 38 | :buzz verify ok-mod-1 39 | 40 | # arch-tag: 39182b4d-923c-4e38-808f-3d02558047f3 41 | -------------------------------------------------------------------------------- /raxs/scripts/verify/sync-raxs: -------------------------------------------------------------------------------- 1 | # Basic RAXS Sync test initial, remote, local sync 2 | # NOTE: The sleep 2 commands are necessary because the store 3 | # modflags is derived from the modtime of the containing dir 4 | # which has 1 sec granularity 5 | 6 | createprop fc.log.level=DEBUG syxaw.http.retries=0 7 | createprop syxaw.firstversion=1000 syxaw.uid.seed=42 SyncTest=fc.syxaw.raxs.test.SyncTest 8 | create --clean buzz 9 | createprop syxaw.firstversion=2000 syxaw.uid.seed=314 10 | create --clean rex 11 | 12 | # Setup 13 | :buzz @@{SyncTest}.registerMerger 14 | :rex @@{SyncTest}.registerMerger 15 | 16 | # Make initial store & links 17 | sys cp ../../raxs/test/simple/simple.xml buzz/simple.xml 18 | :buzz @@{SyncTest}.setupStore simple.xml raxs-store 19 | #:buzz lls raxs-store 20 | 21 | :rex touchf empty.xml 22 | :rex @@{SyncTest}.setupStore empty.xml raxs-store 23 | :rex ln --nolmod buzz/5DwIT0u7K_GDne5GbYUstQ raxs-store 24 | #:rex lls raxs-store 25 | 26 | # Initial sync 27 | :rex sync raxs-store 28 | :buzz ls raxs-store 29 | :rex ls raxs-store 30 | 31 | # Remote mod 32 | sleep 2 33 | :buzz @@{SyncTest}.makeMod raxs-store mod-1 34 | :buzz lls //raxs-store 35 | :rex sync raxs-store 36 | :rex @@{SyncTest}.testMod raxs-store mod-1 37 | :rex verify ok-mod-1 38 | 39 | # Local mod 40 | sleep 2 41 | :rex @@{SyncTest}.makeMod raxs-store mod-2 42 | :rex lls //raxs-store 43 | 44 | :rex sync raxs-store 45 | :buzz @@{SyncTest}.testMod raxs-store mod-2 46 | :buzz verify ok-mod-2 47 | :rex lls //raxs-store 48 | 49 | # arch-tag: e7841133-990e-49d8-9580-31f17490b894 50 | -------------------------------------------------------------------------------- /raxs/scripts/verify/sync-remote: -------------------------------------------------------------------------------- 1 | # Basic RAXS Sync test to verify a remote mod sync 2 | createprop fc.log.level=WARN syxaw.http.retries=0 3 | createprop syxaw.firstversion=1000 syxaw.uid.seed=42 SyncTest=fc.syxaw.raxs.test.SyncTest 4 | create --clean buzz 5 | createprop syxaw.firstversion=2000 syxaw.uid.seed=314 6 | create --clean rex 7 | 8 | # Setup 9 | :buzz @@{SyncTest}.registerMerger 10 | :rex @@{SyncTest}.registerMerger 11 | 12 | # Make initial store & links 13 | copy ../../raxs/test/simple/simple.xml buzz/simple.xml 14 | :buzz @@{SyncTest}.setupStore simple.xml raxs-store 15 | #:buzz lls raxs-store 16 | 17 | :rex touchf empty.xml 18 | :rex @@{SyncTest}.setupStore empty.xml raxs-store 19 | :rex ln --nolmod buzz/5DwIT0u7K_GDne5GbYUstQ raxs-store 20 | #:rex lls raxs-store 21 | 22 | # Initial sync 23 | :rex sync raxs-store 24 | :buzz verify raxs-store 3 * -. * type=application/xml+raxs 25 | :rex verify raxs-store * 3 .- * type=application/xml+raxs 26 | 27 | # Do a remote mod 28 | :buzz @@{SyncTest}.makeMod raxs-store mod-1 29 | :rex sync raxs-store 30 | :buzz verify raxs-store 5 * -. * type=application/xml+raxs 31 | :rex verify raxs-store * 5 .- * type=application/xml+raxs 32 | :rex @@{SyncTest}.testMod raxs-store mod-1 33 | :rex verify ok-mod-1 34 | 35 | # arch-tag: 3d7e281b-6aff-4bba-9533-13380420483b 36 | 37 | -------------------------------------------------------------------------------- /raxs/test/ebook/images/FS-layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/FS-layout.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/abiword-taskbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/abiword-taskbar.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/brother-webinterface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/brother-webinterface.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/caution.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/caution.gif -------------------------------------------------------------------------------- /raxs/test/ebook/images/evolution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/evolution.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/fork-and-exec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/fork-and-exec.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/formatfloppy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/formatfloppy.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/home.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/home.gif -------------------------------------------------------------------------------- /raxs/test/ebook/images/important.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/important.gif -------------------------------------------------------------------------------- /raxs/test/ebook/images/itl.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/itl.jpg -------------------------------------------------------------------------------- /raxs/test/ebook/images/konqueror.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/konqueror.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/links.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/links.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/next.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/next.gif -------------------------------------------------------------------------------- /raxs/test/ebook/images/note.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/note.gif -------------------------------------------------------------------------------- /raxs/test/ebook/images/openoffice.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/openoffice.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/prev.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/prev.gif -------------------------------------------------------------------------------- /raxs/test/ebook/images/printconf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/printconf.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/redcarpet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/redcarpet.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/redhat-config-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/redhat-config-network.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/ssh_X11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/ssh_X11.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/system-monitor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/system-monitor.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/tip.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/tip.gif -------------------------------------------------------------------------------- /raxs/test/ebook/images/toc-blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/toc-blank.gif -------------------------------------------------------------------------------- /raxs/test/ebook/images/toc-minus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/toc-minus.gif -------------------------------------------------------------------------------- /raxs/test/ebook/images/toc-plus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/toc-plus.gif -------------------------------------------------------------------------------- /raxs/test/ebook/images/trappen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/trappen.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/up.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/up.gif -------------------------------------------------------------------------------- /raxs/test/ebook/images/warning.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/warning.gif -------------------------------------------------------------------------------- /raxs/test/ebook/images/xcdroast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/xcdroast.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/xchat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/xchat.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/xmms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/xmms.png -------------------------------------------------------------------------------- /raxs/test/ebook/images/xterm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/raxs/test/ebook/images/xterm.png -------------------------------------------------------------------------------- /raxs/test/ebook/simple-docbook.xsl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <xsl:value-of select="title"/> 10 | 11 | 12 |

13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |

29 |     
30 |
31 | 32 | 33 |

34 |
35 | 36 | 37 |

38 |
39 | 40 | 41 |
42 |
43 | 44 | 45 |
  • 46 |
    47 | 48 | 49 | 50 | 51 | 52 |
    53 | 55 | -------------------------------------------------------------------------------- /raxs/test/simple/simple.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | -------------------------------------------------------------------------------- /res/exper/firsts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/res/exper/firsts -------------------------------------------------------------------------------- /res/exper/lasts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/res/exper/lasts -------------------------------------------------------------------------------- /res/test/xml/rsp8.xml: -------------------------------------------------------------------------------- 1 | 2 | one11.1two22.2three33.3 3 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | deps.dot 2 | deps.dot.ps 3 | -------------------------------------------------------------------------------- /src/deps.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | """ 4 | A little script for determining dependencies between classes and/or packages. 5 | Statically analyses Java source. Not perfect, but useful a first 6 | approximation to help find obsolete code. 7 | 8 | Run this script in the source directory, writing its output to a file: 9 | 10 | python deps.py > deps.dot 11 | 12 | If you don't have Graphviz, install it from http://www.graphviz.org/ 13 | then run something like: 14 | 15 | fdp -Tps -O -Gviewport=400,100,0.06 deps.dot 16 | 17 | (If you don't have a binary called `fdp`, try creating a symlink to `dot`.) 18 | This should create a PostScript file called deps.dot.ps with the graph in it. 19 | """ 20 | 21 | import os 22 | import re 23 | 24 | CLASS_LEVEL = False # False: nodes are packages; True: nodes are classes 25 | 26 | found = [] 27 | 28 | def process(filename): 29 | qname = re.sub(r'^\.*(.*)\.java', r'\1', re.sub('/', '.', filename)) 30 | packname = re.sub(r'\.([^\.]*)$', '', qname) 31 | imports = {} 32 | file = open(filename, 'r') 33 | while True: 34 | line = file.readline() 35 | if not line: break 36 | matches = re.match(r'import ([a-z0-9\.]+)\.([A-Z][A-Za-z0-9]*);', line) 37 | if matches: 38 | imports[matches.group(2)] = "%s.%s" % (matches.group(1), matches.group(2)) 39 | unqual = '|'.join([shortname for (shortname, qualname) in imports.items()]) 40 | qual = r'[a-z0-9\.]+\.[A-Z][A-Za-z0-9]*' 41 | find_idents = qual if unqual == '' else '%s|%s' % (qual, unqual) 42 | find_idents = r'(^|[^\w\.])(%s)' % find_idents 43 | idents = [ident for (dummy, ident) in re.findall(find_idents, line)] 44 | for ident in idents: 45 | ident = imports[ident] if ident in imports else ident 46 | if ident.startswith('java'): continue 47 | pair = (qname, ident) if CLASS_LEVEL else (packname, re.sub(r'\.([^\.]*)$', '', ident)) 48 | if pair not in found: 49 | found.append(pair) 50 | print ' "%s" -> "%s";' % pair 51 | file.close() 52 | 53 | def directory(dummy, dirname, files): 54 | for file in files: 55 | if file.endswith('.java'): 56 | process(os.path.join(dirname, file)) 57 | 58 | print "digraph G {" 59 | os.path.walk('.', directory, None) 60 | print "}" 61 | -------------------------------------------------------------------------------- /src/fc/test/XmlTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.test; 11 | 12 | import java.io.FileInputStream; 13 | 14 | import org.kxml2.io.KXmlParser; 15 | import org.xmlpull.v1.XmlPullParser; 16 | 17 | import fc.xml.xas.Item; 18 | import fc.xml.xas.ItemSource; 19 | import fc.xml.xas.ItemTarget; 20 | import fc.xml.xas.XmlOutput; 21 | import fc.xml.xas.XmlPullSource; 22 | 23 | public class XmlTest { 24 | 25 | public static void main(String[] args) { 26 | try { 27 | for (String fileName : args) { 28 | XmlPullParser parser = new KXmlParser(); 29 | ItemSource is = new XmlPullSource(parser, new FileInputStream(fileName)); 30 | ItemTarget it = new XmlOutput(System.out, "ISO-8859-1"); 31 | for (Item i = is.next(); i != null; i = is.next()) { 32 | System.out.println(i); 33 | it.append(i); 34 | } 35 | System.out.println(); 36 | System.out.println(); 37 | } 38 | } catch (Exception ex) { 39 | ex.printStackTrace(); 40 | } 41 | } 42 | 43 | } 44 | 45 | // arch-tag: 33a2cb98-974c-4793-85a6-314c9a11d645 46 | -------------------------------------------------------------------------------- /src/fc/util/BaInputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fc-util-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.util; 11 | 12 | import java.io.ByteArrayInputStream; 13 | import java.io.IOException; 14 | 15 | /** 16 | * @author Jaakko Kangasharju 17 | */ 18 | public class BaInputStream extends ByteArrayInputStream implements SeekableInputStream { 19 | 20 | public BaInputStream(byte[] buf) { 21 | super(buf); 22 | } 23 | 24 | 25 | public BaInputStream(byte[] buf, int offset, int length) { 26 | super(buf, offset, length); 27 | } 28 | 29 | 30 | public void seek(long pos) throws IOException { 31 | if (pos < 0 || pos > count) { throw new IOException(String.valueOf(pos) + 32 | " not between 0 and " + count); } 33 | this.pos = (int) pos; 34 | } 35 | 36 | } 37 | 38 | // arch-tag: 5d98518f-0785-4b99-9184-825aea2e0d82 39 | -------------------------------------------------------------------------------- /src/fc/util/IOExceptionTrap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fc-util-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.util; 11 | 12 | import java.io.IOException; 13 | 14 | /** 15 | * Interface for handling "silent" I/O errors. In some cases, the implementation of some algorithm 16 | * may encounter I/O errors, which are not originally a natural part of the algorithm. For instance, 17 | * a method call shouldn't normally have to be checked for I/O errors. However, if the called 18 | * implementation has been implemented as a distributed service, this may happen. 19 | *

    20 | * In the case of an I/O error, when no one is really anticipated, we need to have a way to still 21 | * report it. One solution is make an implementation that takes one of these objects, and agrees (by 22 | * the interface contract) to call the {@link #trap(IOException)} method whenever an I/O error 23 | * occurs. 24 | * @author Tancred Lindholm 25 | */ 26 | 27 | public interface IOExceptionTrap { 28 | 29 | /** 30 | * IOException callback. Called with an exception when an I/O error occurs. 31 | * @param ex 32 | * the causing Exception 33 | */ 34 | public void trap(IOException ex); 35 | 36 | /** 37 | * Trap that throws a {@link IOExceptionTrap.RuntimeIOException}. That exception encapsulates 38 | * the IOException as the cause. 39 | */ 40 | public static final IOExceptionTrap DEFAULT_TRAP = new IOExceptionTrap() { 41 | 42 | public void trap(IOException ex) { 43 | throw new RuntimeIOException(ex); 44 | } 45 | 46 | }; 47 | 48 | public static class RuntimeIOException extends RuntimeException { 49 | 50 | public RuntimeIOException(IOException cause) { 51 | super("Unhandled trapped IOException " + cause.getMessage(), cause); 52 | } 53 | 54 | } 55 | } 56 | // arch-tag: d57087e5-f4f5-4cee-8b54-065428d11f26 57 | 58 | -------------------------------------------------------------------------------- /src/fc/util/Pair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fc-util-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.util; 11 | 12 | /** 13 | * @author Jaakko Kangasharju 14 | * @param 15 | * @param 16 | */ 17 | 18 | public class Pair { 19 | 20 | private T first; 21 | private U second; 22 | 23 | 24 | public Pair(T first, U second) { 25 | this.first = first; 26 | this.second = second; 27 | } 28 | 29 | 30 | public T getFirst() { 31 | return first; 32 | } 33 | 34 | 35 | public U getSecond() { 36 | return second; 37 | } 38 | 39 | } 40 | 41 | // arch-tag: 765d5a6d-a6b0-44a5-8501-802af728ed3f 42 | -------------------------------------------------------------------------------- /src/fc/util/SeekableInputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fc-util-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.util; 11 | 12 | import java.io.IOException; 13 | 14 | /** 15 | * @author Tancred Lindholm 16 | * @author Jaakko Kangasharju 17 | */ 18 | 19 | public interface SeekableInputStream { 20 | 21 | int read() throws IOException; 22 | 23 | 24 | int read(byte[] b) throws IOException; 25 | 26 | 27 | int read(byte[] b, int off, int len) throws IOException; 28 | 29 | 30 | long skip(long n) throws IOException; 31 | 32 | 33 | int available() throws IOException; 34 | 35 | 36 | void close() throws IOException; 37 | 38 | 39 | void mark(int readLimit); 40 | 41 | 42 | void reset() throws IOException; 43 | 44 | 45 | boolean markSupported(); 46 | 47 | 48 | void seek(long pos) throws IOException; 49 | 50 | } 51 | 52 | // arch-tag: 8e2844f8-12e9-4a54-9f90-585faca6b8e5 53 | -------------------------------------------------------------------------------- /src/fc/util/Stack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fc-util-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.util; 11 | 12 | import java.util.LinkedList; 13 | 14 | /** 15 | * A non-vector based stack. 16 | * @author Tancred Lindholm 17 | * @param 18 | */ 19 | 20 | public class Stack { 21 | 22 | LinkedList stack = new LinkedList(); 23 | 24 | 25 | public final void push(T o) { 26 | stack.addFirst(o); // BUGFIX-20061017-3: Push to wrong end of queue 27 | } 28 | 29 | 30 | public final T pop() { 31 | return stack.removeFirst(); 32 | } 33 | 34 | 35 | public final T peek() { 36 | return stack.peek(); 37 | } 38 | 39 | 40 | public final boolean isEmpty() { 41 | return stack.isEmpty(); 42 | } 43 | 44 | 45 | public final void clear() { 46 | stack.clear(); 47 | } 48 | } 49 | 50 | // arch-tag: fc15cebe-7c97-4fba-9366-76a3f1cf6548 51 | -------------------------------------------------------------------------------- /src/fc/util/log/SysoutLogger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fc-util-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.util.log; 11 | 12 | /** 13 | * A {@link Logger} implementation for logging into standard output. This class is intended for use 14 | * through the {@link Log#PROPERTY_LOGGER} setting as an externally-specified logger. 15 | * @author Jaakko Kangasharju 16 | */ 17 | public class SysoutLogger extends StreamLogger { 18 | 19 | public SysoutLogger() { 20 | super(System.out); 21 | } 22 | 23 | } 24 | 25 | // arch-tag: 4348f781-74ce-4d89-a10a-302cd580cf29 26 | -------------------------------------------------------------------------------- /src/fc/xml/diff/HashAlgorithm.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xmldiff-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | // $Id: HashAlgorithm.java,v 1.3 2005/10/12 16:46:38 ctl Exp $ 11 | package fc.xml.diff; 12 | 13 | import java.security.MessageDigest; 14 | import java.util.List; 15 | 16 | public interface HashAlgorithm { 17 | 18 | public short quickHash(E o); 19 | 20 | 21 | public void secureDigest(List o, MessageDigest md); 22 | } 23 | -------------------------------------------------------------------------------- /src/fc/xml/diff/Preamble.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xmldiff-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | // $Id: Preamble.java,v 1.1.2.1 2006/06/30 12:48:04 ctl Exp $ 11 | package fc.xml.diff; 12 | 13 | import java.util.List; 14 | 15 | import fc.xml.xas.Item; 16 | 17 | public interface Preamble { 18 | 19 | public List getPreamble(); 20 | } 21 | // arch-tag: 46f2c329-3eb5-40e2-b060-eeea728a0dfd 22 | -------------------------------------------------------------------------------- /src/fc/xml/diff/encode/DefaultPosTranformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xmldiff-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.diff.encode; 11 | 12 | public class DefaultPosTranformer implements PosTransformer { 13 | 14 | public String transform(int pos) { 15 | return pos == -1 ? "-" : String.valueOf(pos); 16 | } 17 | 18 | } 19 | // arch-tag: 204ba094-e053-4125-a429-d97ed7f4ffa2 20 | // 21 | -------------------------------------------------------------------------------- /src/fc/xml/diff/encode/DiffEncoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xmldiff-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.diff.encode; 11 | 12 | import java.io.IOException; 13 | import java.io.OutputStream; 14 | import java.util.List; 15 | 16 | import fc.xml.diff.Segment; 17 | import fc.xml.xas.Item; 18 | 19 | /** 20 | * A DiffEncoder takes the two input document and the list of matched segments, and encodes 21 | * it in a particular diff format. A variety of different formats are implemented. 22 | */ 23 | public interface DiffEncoder { 24 | 25 | public void encodeDiff(List base, List doc, List> matches, 26 | List preamble, OutputStream out) throws IOException; 27 | 28 | } 29 | // arch-tag: 3eaf5e57-ee9d-46a5-aff7-14214b9e5776 30 | // 31 | -------------------------------------------------------------------------------- /src/fc/xml/diff/encode/ListPosTransformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xmldiff-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.diff.encode; 11 | 12 | import java.util.List; 13 | 14 | class ListPosTransformer implements PosTransformer { 15 | 16 | List l = null; 17 | 18 | 19 | public ListPosTransformer(List l) { 20 | this.l = l; 21 | } 22 | 23 | 24 | public String transform(int pos) { 25 | return pos == -1 ? "-" : "" + (l.get(pos) >> 16) + "," + (l.get(pos) & 0xffff); 26 | } 27 | 28 | } 29 | // arch-tag: dcbbd5cc-2b44-44b4-a5cf-a52d0d30aae2 30 | // 31 | -------------------------------------------------------------------------------- /src/fc/xml/diff/encode/PosTransformer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xmldiff-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.diff.encode; 11 | 12 | public interface PosTransformer { 13 | 14 | public String transform(int pos); 15 | } 16 | // arch-tag: 16eab39d-eb29-4d35-925d-feede054eac6 17 | // 18 | -------------------------------------------------------------------------------- /src/fc/xml/diff/test/RootSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xmldiff-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.diff.test; 11 | 12 | import java.io.IOException; 13 | 14 | import junit.framework.Test; 15 | import junit.framework.TestCase; 16 | import junit.framework.TestSuite; 17 | import fc.util.log.Log; 18 | import fc.util.log.LogLevels; 19 | import fc.util.log.SysoutLogger; 20 | import fc.xml.diff.benchmark.SynteticDirTree; 21 | import fc.xml.diff.benchmark.UseCases; 22 | 23 | public class RootSuite extends TestCase { 24 | 25 | @Override 26 | public void setUp() throws Exception { 27 | } 28 | 29 | 30 | @Override 31 | public void tearDown() throws Exception { 32 | // 33 | } 34 | 35 | 36 | public static Test suite() throws IOException { 37 | // System.out.println("Setting logger to System.out"); 38 | // System.out.flush(); 39 | SysoutLogger l = new SysoutLogger(); 40 | Log.setLogger(l); 41 | TestSuite tests = new TestSuite(); 42 | System.setProperty("verify", "true"); 43 | tests.addTestSuite(UseCases.class); 44 | tests.addTestSuite(RootSuite.class); 45 | tests.addTestSuite(SynteticDirTree.class); 46 | return tests; 47 | } 48 | 49 | 50 | public void testFixTests() { 51 | Log.log("Fixing incompatible property setting between tests", LogLevels.WARNING); 52 | System.setProperty("basefile", "b.xml"); 53 | System.setProperty("newfile", "n.xml"); 54 | System.setProperty("deltafile", "d.xml"); 55 | } 56 | 57 | } 58 | 59 | // arch-tag: 3c223bb4-2088-445f-88c5-983229971072 60 | -------------------------------------------------------------------------------- /src/fc/xml/xas/AppendableItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.io.IOException; 13 | 14 | /** 15 | * An {@link Item} that can be appended to an {@link ItemTarget}. 16 | */ 17 | public interface AppendableItem { 18 | 19 | /** 20 | * Append this item into the provided target. This method should produce a sequence of "simpler" 21 | * items so that infinite recursion is avoided. In particular, an implementation that does 22 | * target.append(this) is incorrect, as that method call will simply reinvoke this 23 | * method. 24 | * @param target 25 | * The {@link ItemTarget} to which the produced sequence is to be appended 26 | * @throws IOException 27 | * if the sequence appending fails 28 | */ 29 | void appendTo(ItemTarget target) throws IOException; 30 | 31 | } 32 | 33 | // arch-tag: 255aa3c7-3002-4d44-ae12-00415b8822f9 34 | -------------------------------------------------------------------------------- /src/fc/xml/xas/Comment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | public class Comment extends Item { 13 | 14 | private String text; 15 | 16 | 17 | public Comment(String text) { 18 | super(COMMENT); 19 | Verifier.checkNotNull(text); 20 | this.text = text; 21 | } 22 | 23 | 24 | public String getText() { 25 | return text; 26 | } 27 | 28 | 29 | @Override 30 | public boolean equals(Object o) { 31 | if (this == o) { 32 | return true; 33 | } else if (!(o instanceof Comment)) { 34 | return false; 35 | } else { 36 | Comment c = (Comment) o; 37 | return text.equals(c.text); 38 | } 39 | } 40 | 41 | 42 | @Override 43 | public String toString() { 44 | return "C(" + text + ")"; 45 | } 46 | 47 | 48 | @Override 49 | public int hashCode() { 50 | return text == null ? 0 : 37 * text.hashCode(); 51 | } 52 | 53 | } 54 | 55 | // arch-tag: daea83f8-cdc5-4063-9f1a-4e9f42fe8063 56 | -------------------------------------------------------------------------------- /src/fc/xml/xas/EndDocument.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | public class EndDocument extends Item { 13 | 14 | private static final EndDocument instance = new EndDocument(); 15 | 16 | 17 | public static EndDocument instance() { 18 | return instance; 19 | } 20 | 21 | 22 | private EndDocument() { 23 | super(END_DOCUMENT); 24 | } 25 | 26 | 27 | @Override 28 | public String toString() { 29 | return "ED()"; 30 | } 31 | 32 | 33 | @Override 34 | public boolean equals(Object o) { 35 | return o == instance; 36 | } 37 | 38 | 39 | @Override 40 | public int hashCode() { 41 | return END_DOCUMENT; 42 | } 43 | 44 | } 45 | 46 | // arch-tag: 04768e23-9131-4225-beaf-78331bfea89a 47 | -------------------------------------------------------------------------------- /src/fc/xml/xas/EndTag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | public class EndTag extends Item { 13 | 14 | private Qname name; 15 | 16 | 17 | public EndTag(Qname name) { 18 | super(END_TAG); 19 | Verifier.checkNotNull(name); 20 | this.name = name; 21 | } 22 | 23 | 24 | public Qname getName() { 25 | return name; 26 | } 27 | 28 | 29 | @Override 30 | public boolean equals(Object o) { 31 | if (this == o) { 32 | return true; 33 | } else if (!(o instanceof EndTag)) { 34 | return false; 35 | } else { 36 | EndTag et = (EndTag) o; 37 | return name.equals(et.name); 38 | } 39 | } 40 | 41 | 42 | @Override 43 | public int hashCode() { 44 | return 37 * END_TAG + name.hashCode(); 45 | } 46 | 47 | 48 | @Override 49 | public String toString() { 50 | return "ET(" + name + ")"; 51 | } 52 | 53 | } 54 | 55 | // arch-tag: f1fe34e1-becb-40ea-bb42-0f86539f9a9a 56 | -------------------------------------------------------------------------------- /src/fc/xml/xas/EntityRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | public class EntityRef extends Item { 13 | 14 | private String name; 15 | 16 | 17 | public EntityRef(String name) { 18 | super(ENTITY_REF); 19 | Verifier.checkName(name); 20 | this.name = name; 21 | } 22 | 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | 29 | @Override 30 | public boolean equals(Object o) { 31 | if (this == o) { 32 | return true; 33 | } else if (!(o instanceof EntityRef)) { 34 | return false; 35 | } else { 36 | EntityRef e = (EntityRef) o; 37 | return name.equals(e.name); 38 | } 39 | } 40 | 41 | 42 | @Override 43 | public int hashCode() { 44 | return name == null ? 0 : 37 * name.hashCode(); 45 | } 46 | 47 | 48 | @Override 49 | public String toString() { 50 | return "ER(" + name + ")"; 51 | } 52 | 53 | } 54 | 55 | // arch-tag: 1d847bc3-3d23-43e7-9b0b-414d499cb20a 56 | -------------------------------------------------------------------------------- /src/fc/xml/xas/FormatFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.io.IOException; 13 | import java.io.InputStream; 14 | import java.io.OutputStream; 15 | 16 | public interface FormatFactory { 17 | 18 | SerializerTarget createCanonicalTarget(OutputStream out) throws IOException; 19 | 20 | 21 | ParserSource createSource(InputStream in) throws IOException; 22 | 23 | 24 | ParserSource createSource(InputStream in, StartTag context) throws IOException; 25 | 26 | 27 | SerializerTarget createTarget(OutputStream out, String encoding) throws IOException; 28 | 29 | } 30 | 31 | // arch-tag: 70b54d64-4b9b-43a4-a56f-04a3b4f4f959 32 | -------------------------------------------------------------------------------- /src/fc/xml/xas/FragmentIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.util.Iterator; 13 | import java.util.NoSuchElementException; 14 | 15 | public class FragmentIterator implements Iterator { 16 | 17 | private FragmentItem fragment; 18 | private int index; 19 | private int length; 20 | 21 | 22 | FragmentIterator(FragmentItem fragment, int index) { 23 | this(fragment, index, Integer.MAX_VALUE); 24 | } 25 | 26 | 27 | FragmentIterator(FragmentItem fragment, int index, int length) { 28 | Verifier.checkInterval(0, index, fragment.length()); 29 | Verifier.checkNotNegative(length); 30 | this.fragment = fragment; 31 | this.index = index; 32 | this.length = length; 33 | } 34 | 35 | 36 | public boolean hasNext() { 37 | return length > 0 && index < fragment.length(); 38 | } 39 | 40 | 41 | public Item next() { 42 | if (hasNext()) { 43 | Item item = fragment.get(index); 44 | // FIXME: Need to determine skipping at next run 45 | // to consider potential convert 46 | int n = 1; 47 | if (FragmentItem.isFragment(item)) { 48 | n = ((FragmentItem) item).getSize(); 49 | } 50 | index += n; 51 | length -= n; 52 | return item; 53 | } else { 54 | throw new NoSuchElementException("Fragment exhausted, index=" + index + ", length=" + 55 | length); 56 | } 57 | } 58 | 59 | 60 | public void remove() { 61 | throw new UnsupportedOperationException(); 62 | } 63 | 64 | 65 | public Pointer pointer() { 66 | return new FragmentPointer(fragment, index); 67 | } 68 | 69 | } 70 | 71 | // arch-tag: ce29e1e3-d27b-4e89-a928-02ff9730bc2c 72 | -------------------------------------------------------------------------------- /src/fc/xml/xas/ItemSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.io.IOException; 13 | 14 | /** 15 | * A source for a stream of items. An {@link ItemSource} acts as a source for the Pipes and Filters 16 | * pattern. Pull filters can be implemented by composing sources on top of each other. 17 | */ 18 | public interface ItemSource { 19 | 20 | /** 21 | * Return the next item from the source. 22 | * @return the next item in the stream or null if the stream is exhausted 23 | * @throws IOException 24 | * if acquiring the next item fails 25 | */ 26 | Item next() throws IOException; 27 | 28 | } 29 | 30 | // arch-tag: ebeafa60-711f-4f70-b55e-961926462cfb 31 | -------------------------------------------------------------------------------- /src/fc/xml/xas/ItemTarget.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.io.IOException; 13 | 14 | /** 15 | * A sink for a stream of items. An {@link ItemTarget} acts as a sink for the Pipes and Filters 16 | * pattern. Push filters can be implemented by composing targets on top of each other. 17 | */ 18 | public interface ItemTarget { 19 | 20 | /** 21 | * Add an item to the end of the stream. 22 | * @param item 23 | * the item to add to the stream 24 | * @throws IOException 25 | * if writing the item fails for some reason 26 | */ 27 | void append(Item item) throws IOException; 28 | 29 | } 30 | 31 | // arch-tag: 5951d6eb-bc2d-4a48-9636-53ebdf78bdbf 32 | -------------------------------------------------------------------------------- /src/fc/xml/xas/ItemTransform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.io.IOException; 13 | 14 | /** 15 | * A generic filter for item stream processing. On an abstract level, an {@link ItemTransform} 16 | * behaves like a queue, allowing additions at the end and removals from the front. However, the 17 | * items may be transformed arbitrarily, so the removed items do not need to be the same as the 18 | * added items. 19 | */ 20 | public interface ItemTransform extends ItemSource, ItemTarget { 21 | 22 | /** 23 | * Check whether there are items available. 24 | * @return true if it is known that a next() will return a non- 25 | * null item, false otherwise 26 | */ 27 | boolean hasItems(); 28 | 29 | 30 | Item next() throws IOException; 31 | 32 | 33 | void append(Item item) throws IOException; 34 | 35 | } 36 | 37 | // arch-tag: 0dae8ec9-93eb-4ee4-92d1-9620a76f78d0 38 | -------------------------------------------------------------------------------- /src/fc/xml/xas/NullItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | /** 13 | * An item with no content. This item simply takes up space, it has no behavior or serialized form. 14 | * It is useful in cases where an item needs to be deleted from an array without incurring a 15 | * performance penalty. 16 | */ 17 | public class NullItem extends Item implements AppendableItem { 18 | 19 | private static final NullItem instance = new NullItem(); 20 | 21 | public static final int NULL = 0x4203; 22 | 23 | 24 | private NullItem() { 25 | super(NULL); 26 | } 27 | 28 | 29 | public static boolean isNull(Item i) { 30 | return i == instance; 31 | } 32 | 33 | 34 | public static NullItem instance() { 35 | return instance; 36 | } 37 | 38 | 39 | public void appendTo(ItemTarget target) { 40 | } 41 | 42 | 43 | @Override 44 | public boolean equals(Object o) { 45 | return o == instance; 46 | } 47 | 48 | 49 | @Override 50 | public int hashCode() { 51 | return NULL; 52 | } 53 | 54 | 55 | @Override 56 | public String toString() { 57 | return "NI()"; 58 | } 59 | 60 | } 61 | 62 | // arch-tag: 57734a7d-d7a3-49a5-a2ed-e681db6503c9 63 | -------------------------------------------------------------------------------- /src/fc/xml/xas/ParserSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.io.InputStream; 13 | 14 | /** 15 | * An {@link ItemSource} that gets its items from an underlying stream. This interface permits 16 | * direct access to the underlying bytes for efficiency in certain cases. Callers need to be careful 17 | * to not change the processing context while reading. 18 | * @see SerializerTarget 19 | */ 20 | public interface ParserSource extends ItemSource { 21 | 22 | InputStream getInputStream(); 23 | 24 | 25 | /** 26 | * Get the encoding used for characters in the underlying byte stream. 27 | * @return the name of the encoding 28 | */ 29 | String getEncoding(); 30 | 31 | 32 | /** 33 | * Get the current processing context. If a user of this interface reads any bytes from the 34 | * input stream returned by {@link #getInputStream()}, the processing context after reading 35 | * those bytes must be the same as the one returned by this method before the reading. 36 | * @return the current processing context 37 | */ 38 | StartTag getContext(); 39 | 40 | } 41 | 42 | // arch-tag: d07b91ab-bb58-4f88-abdf-e1e1faf00ef0 43 | -------------------------------------------------------------------------------- /src/fc/xml/xas/Pi.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | public class Pi extends Item { 13 | 14 | private String target; 15 | private String instruction; 16 | 17 | 18 | public Pi(String target, String instruction) { 19 | super(PI); 20 | Verifier.checkName(target); 21 | Verifier.checkNotNull(instruction); 22 | this.target = target; 23 | this.instruction = instruction; 24 | } 25 | 26 | 27 | public String getTarget() { 28 | return target; 29 | } 30 | 31 | 32 | public String getInstruction() { 33 | return instruction; 34 | } 35 | 36 | 37 | @Override 38 | public boolean equals(Object o) { 39 | if (this == o) { 40 | return true; 41 | } else if (!(o instanceof Pi)) { 42 | return false; 43 | } else { 44 | Pi p = (Pi) o; 45 | return target.equals(p.target) && instruction.equals(p.instruction); 46 | } 47 | } 48 | 49 | 50 | @Override 51 | public int hashCode() { 52 | return 37 * target.hashCode() + instruction.hashCode(); 53 | } 54 | 55 | 56 | @Override 57 | public String toString() { 58 | return "PI(" + target + " " + instruction + ")"; 59 | } 60 | 61 | } 62 | 63 | // arch-tag: 492c82fd-5861-47b9-8f42-43fc2530d0cf 64 | -------------------------------------------------------------------------------- /src/fc/xml/xas/Pointer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | /** 13 | * A reference to a specific location in an XML document. A pointer may point to either a fragment 14 | * or a complete document, but its target will always be an item, called the pointed-to item. 15 | */ 16 | public interface Pointer { 17 | 18 | /** 19 | * Get the pointed-to item. 20 | */ 21 | Item get(); 22 | 23 | 24 | /** 25 | * Perform a query from the pointer's location. This method will follow a path starting from the 26 | * pointed-to item, in effect performing a relative query instead of an absolute one. 27 | * @param path 28 | * the path to follow 29 | * @return a pointer pointing to the queried location, or null if the location does 30 | * not exist 31 | */ 32 | Pointer query(int[] path); 33 | 34 | 35 | /** 36 | * 37 | * 38 | */ 39 | void canonicalize(); 40 | 41 | } 42 | 43 | // arch-tag: 18507ed8-73cb-4720-91b3-f1411b46c9e6 44 | -------------------------------------------------------------------------------- /src/fc/xml/xas/Qname.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | public final class Qname implements Comparable { 13 | 14 | private String namespace; 15 | private String name; 16 | 17 | 18 | public Qname(String namespace, String name) { 19 | Verifier.checkNamespace(namespace); 20 | Verifier.checkName(name); 21 | this.namespace = namespace.intern(); 22 | this.name = name.intern(); 23 | } 24 | 25 | 26 | public String getNamespace() { 27 | return namespace; 28 | } 29 | 30 | 31 | public String getName() { 32 | return name; 33 | } 34 | 35 | 36 | @Override 37 | public boolean equals(Object o) { 38 | if (this == o) { 39 | return true; 40 | } else if (!(o instanceof Qname)) { 41 | return false; 42 | } else { 43 | Qname q = (Qname) o; 44 | return name.equals(q.name) && namespace.equals(q.namespace); 45 | } 46 | } 47 | 48 | 49 | @Override 50 | public int hashCode() { 51 | return name.hashCode() ^ namespace.hashCode(); 52 | } 53 | 54 | 55 | public int compareTo(Qname q) { 56 | Verifier.checkNotNull(q); 57 | int c = namespace.compareTo(q.namespace); 58 | if (c == 0) { 59 | c = name.compareTo(q.name); 60 | } 61 | return c; 62 | } 63 | 64 | 65 | @Override 66 | public String toString() { 67 | return "{" + namespace + "}" + name; 68 | } 69 | 70 | } 71 | 72 | // arch-tag: 15e8b7c1-7eae-4096-ba3a-6788e4583023 73 | -------------------------------------------------------------------------------- /src/fc/xml/xas/Queryable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | /** 13 | * An interface for XAS structures that support querying. This interface should be implemented by 14 | * any class that supports tree-structured access to an XML document. The methods are a variety of 15 | * different ways to access substructures by queries. 16 | */ 17 | public interface Queryable { 18 | 19 | /** 20 | * Query structure by Dewey key. This method returns a pointer to the item located by following 21 | * the Dewey key given as an argument. The search is relative, i.e., treats the root of this 22 | * structure as the overall root. 23 | * @param path 24 | * the key to search for, represented in [@link DeweyKey} array form 25 | * @return a pointer accessed through the key, or null if the structure does not 26 | * contain the argument path 27 | */ 28 | Pointer query(int[] path); 29 | 30 | } 31 | 32 | // arch-tag: e4744354-eeb0-4ce4-85e2-970ebf44b4bb 33 | -------------------------------------------------------------------------------- /src/fc/xml/xas/SerializableItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.io.IOException; 13 | 14 | /** 15 | * An item that can serialize itself. Like {@link AppendableItem}, this interface is implemented by 16 | * extension items to define how to output them, but unlike it, a {@link SerializableItem} can 17 | * serialize itself directly as bytes. If this additional capability is not needed, it is better to 18 | * implement {@link AppendableItem}. 19 | */ 20 | public interface SerializableItem { 21 | 22 | /** 23 | * Serialize this item, possibly directly as bytes. 24 | * @param type 25 | * the MIME type of the underlying stream, usually having an "xml" suffix for XML 26 | * types 27 | * @param target 28 | * the target to use for serialization 29 | * @throws IOException 30 | * if output fails for some reason 31 | */ 32 | void serialize(String type, SerializerTarget target) throws IOException; 33 | 34 | } 35 | 36 | // arch-tag: 55592b43-ae28-496e-a82a-d4eeb5f75f7c 37 | -------------------------------------------------------------------------------- /src/fc/xml/xas/SerializerTarget.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.io.Flushable; 13 | import java.io.OutputStream; 14 | 15 | /** 16 | * An {@link ItemTarget} that outputs to a byte stream. This interface gives direct access to the 17 | * underlying stream for efficiency in certain cases. Callers need to be careful to not change the 18 | * processing context while reading. 19 | * @see ParserSource 20 | */ 21 | public interface SerializerTarget extends ItemTarget, Flushable { 22 | 23 | OutputStream getOutputStream(); 24 | 25 | 26 | /** 27 | * Get the encoding used for characters in the underlying byte stream. Any written bytes that 28 | * represent characters must be encoded according to this encoding. 29 | * @return the name of the encoding 30 | */ 31 | String getEncoding(); 32 | 33 | 34 | /** 35 | * Get the current processing context. If a user of this interface writes any bytes to the 36 | * output stream returned by {@link #getOutputStream()}, the processing context after writing 37 | * those bytes must be the same as the one returned by this method before the writing. 38 | * @return the current processing context 39 | */ 40 | StartTag getContext(); 41 | 42 | } 43 | 44 | // arch-tag: adbc7328-7d9b-4104-8f5e-c9eb5b9fc817 45 | -------------------------------------------------------------------------------- /src/fc/xml/xas/StartDocument.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | public class StartDocument extends Item { 13 | 14 | private static final StartDocument instance = new StartDocument(); 15 | 16 | 17 | public static StartDocument instance() { 18 | return instance; 19 | } 20 | 21 | 22 | private StartDocument() { 23 | super(START_DOCUMENT); 24 | } 25 | 26 | 27 | @Override 28 | public String toString() { 29 | return "SD()"; 30 | } 31 | 32 | 33 | @Override 34 | public boolean equals(Object o) { 35 | return o == instance; 36 | } 37 | 38 | 39 | @Override 40 | public int hashCode() { 41 | return START_DOCUMENT; 42 | } 43 | 44 | } 45 | 46 | // arch-tag: 57d4dcde-026f-4692-a5fc-82b5e51572c5 47 | -------------------------------------------------------------------------------- /src/fc/xml/xas/TargetOutputStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.io.FilterOutputStream; 13 | import java.io.IOException; 14 | import java.io.OutputStream; 15 | 16 | public class TargetOutputStream extends FilterOutputStream { 17 | 18 | private static final int STATE_ITEM = 0; 19 | private static final int STATE_BYTES = 1; 20 | 21 | private int state = STATE_BYTES; 22 | private SerializerTarget target; 23 | 24 | 25 | private void writingBytes() throws IOException { 26 | if (state == STATE_ITEM) { 27 | target.flush(); 28 | state = STATE_BYTES; 29 | } 30 | } 31 | 32 | 33 | public TargetOutputStream(SerializerTarget target, OutputStream out) { 34 | super(out); 35 | this.target = target; 36 | } 37 | 38 | 39 | public void wroteItem() { 40 | state = STATE_ITEM; 41 | } 42 | 43 | 44 | @Override 45 | public void write(byte[] b, int off, int len) throws IOException { 46 | writingBytes(); 47 | // BUGFIX-20061212-3: Do not use super.write methods, as these will 48 | // re-route trough n*write(int), which will completely destroy 49 | // performance 50 | out.write(b, off, len); 51 | } 52 | 53 | 54 | @Override 55 | public void write(byte[] b) throws IOException { 56 | writingBytes(); 57 | // BUGFIX-20061212-3 58 | out.write(b); 59 | } 60 | 61 | 62 | @Override 63 | public void write(int b) throws IOException { 64 | writingBytes(); 65 | out.write(b); 66 | } 67 | 68 | } 69 | 70 | // arch-tag: ab7b512c-6384-4aab-9823-983ebac9a6eb 71 | -------------------------------------------------------------------------------- /src/fc/xml/xas/Text.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | public class Text extends Item { 13 | 14 | private String data; 15 | 16 | 17 | public Text(String data) { 18 | super(TEXT); 19 | Verifier.checkText(data); 20 | this.data = data; 21 | } 22 | 23 | 24 | public String getData() { 25 | return data; 26 | } 27 | 28 | 29 | @Override 30 | public boolean equals(Object o) { 31 | if (this == o) { 32 | return true; 33 | } else if (!(o instanceof Text)) { 34 | return false; 35 | } else { 36 | Text t = (Text) o; 37 | return data.equals(t.data); 38 | } 39 | } 40 | 41 | 42 | @Override 43 | public int hashCode() { 44 | return 37 * TEXT + data.hashCode(); 45 | } 46 | 47 | 48 | @Override 49 | public String toString() { 50 | return "T(" + data + ")"; 51 | } 52 | 53 | } 54 | 55 | // arch-tag: 88732435-7f02-4c1a-995a-72369b9cd588 56 | -------------------------------------------------------------------------------- /src/fc/xml/xas/TransformSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.io.IOException; 13 | 14 | /** 15 | * A wrapper source for easy transformations. This class wraps an underlying {@link ItemSource} and 16 | * uses an {@link ItemTransform} to transform the items coming from the source. While this class 17 | * works in all transformation situations, special-purpose wrappers may provide more efficiency. 18 | */ 19 | public class TransformSource implements ItemSource { 20 | 21 | private ItemSource source; 22 | private ItemTransform transform; 23 | 24 | 25 | public TransformSource(ItemSource source, ItemTransform transform) { 26 | Verifier.checkNotNull(source); 27 | Verifier.checkNotNull(transform); 28 | this.source = source; 29 | this.transform = transform; 30 | } 31 | 32 | 33 | public Item next() throws IOException { 34 | Item item = null; 35 | while (!transform.hasItems() && ((item = source.next()) != null)) { 36 | transform.append(item); 37 | } 38 | if (transform.hasItems()) { 39 | item = transform.next(); 40 | } 41 | return item; 42 | } 43 | 44 | } 45 | 46 | // arch-tag: cbf4219f-7e70-4c5d-98fc-5daed024e00c 47 | -------------------------------------------------------------------------------- /src/fc/xml/xas/TransformTarget.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.io.IOException; 13 | 14 | /** 15 | * A wrapper target for easy transformations. This class wraps an underlying {@link ItemTarget} and 16 | * uses an {@link ItemTransform} to transform the items being output to the target. While this class 17 | * works in all transformation situations, special-purpose wrappers may provide more efficiency. 18 | */ 19 | public class TransformTarget implements ItemTarget { 20 | 21 | private ItemTarget target; 22 | private ItemTransform transform; 23 | 24 | 25 | public TransformTarget(ItemTarget target, ItemTransform transform) { 26 | Verifier.checkNotNull(target); 27 | Verifier.checkNotNull(transform); 28 | this.target = target; 29 | this.transform = transform; 30 | } 31 | 32 | 33 | public void append(Item item) throws IOException { 34 | transform.append(item); 35 | while (transform.hasItems()) { 36 | target.append(transform.next()); 37 | } 38 | } 39 | 40 | } 41 | 42 | // arch-tag: ed5aefb4-b784-47d9-83f0-2816a6a433eb 43 | -------------------------------------------------------------------------------- /src/fc/xml/xas/WrapperItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | /** 13 | * A fragment containing a single item. This wrapper is useful in cases where an existing fragment 14 | * is replaced by a single item, since the replacing item needs to inherit the replaced fragment's 15 | * size. 16 | */ 17 | public class WrapperItem extends FragmentItem { 18 | 19 | public static final int WRAPPER = 0x4202; 20 | 21 | 22 | public static boolean isWrapper(Item i) { 23 | return hasType(i, WRAPPER); 24 | } 25 | 26 | 27 | public WrapperItem(Item item) { 28 | super(WRAPPER, 1); 29 | this.firstItem = item; 30 | } 31 | 32 | 33 | @Override 34 | public String toString() { 35 | return "W(" + firstItem + ")"; 36 | } 37 | 38 | } 39 | 40 | // arch-tag: efac70cc-c790-4470-8e4f-9ff3bc9a0fc2 41 | -------------------------------------------------------------------------------- /src/fc/xml/xas/XmlFormatFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.io.IOException; 13 | import java.io.OutputStream; 14 | 15 | import org.kxml2.io.KXmlParser; 16 | import org.kxml2.io.KXmlSerializer; 17 | import org.xmlpull.v1.XmlPullParser; 18 | import org.xmlpull.v1.XmlSerializer; 19 | 20 | public class XmlFormatFactory extends XmlPullFactory { 21 | 22 | public XmlFormatFactory() { 23 | super(XasUtil.XML_MIME_TYPE); 24 | } 25 | 26 | 27 | @Override 28 | protected XmlPullParser createParser() { 29 | return new KXmlParser(); 30 | } 31 | 32 | 33 | @Override 34 | protected XmlSerializer createSerializer() { 35 | return new KXmlSerializer(); 36 | } 37 | 38 | 39 | public SerializerTarget createCanonicalTarget(OutputStream out) throws IOException { 40 | return new XmlOutput(out, "UTF-8"); 41 | } 42 | 43 | } 44 | 45 | // arch-tag: b69eaf92-4bad-444f-8401-8dfdb2020c43 46 | -------------------------------------------------------------------------------- /src/fc/xml/xas/XmlPullFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas; 11 | 12 | import java.io.IOException; 13 | import java.io.InputStream; 14 | import java.io.OutputStream; 15 | 16 | import org.xmlpull.v1.XmlPullParser; 17 | import org.xmlpull.v1.XmlSerializer; 18 | 19 | public abstract class XmlPullFactory implements FormatFactory { 20 | 21 | private String type; 22 | 23 | 24 | protected XmlPullFactory(String type) { 25 | this.type = type; 26 | } 27 | 28 | 29 | public ParserSource createSource(InputStream in) throws IOException { 30 | XmlPullParser parser = createParser(); 31 | return new XmlPullSource(parser, in); 32 | } 33 | 34 | 35 | public ParserSource createSource(InputStream in, StartTag context) throws IOException { 36 | XmlPullParser parser = createParser(); 37 | XmlPullSource source = new XmlPullSource(parser, in); 38 | source.setContext(context); 39 | return source; 40 | } 41 | 42 | 43 | public SerializerTarget createTarget(OutputStream out, String encoding) throws IOException { 44 | XmlSerializer serializer = createSerializer(); 45 | return new XmlPullTarget(serializer, type, out, encoding); 46 | } 47 | 48 | 49 | protected abstract XmlPullParser createParser(); 50 | 51 | 52 | protected abstract XmlSerializer createSerializer(); 53 | 54 | } 55 | 56 | // arch-tag: 364f3c7d-a250-4b1d-b9e6-388d859b6bb2 57 | -------------------------------------------------------------------------------- /src/fc/xml/xas/index/Document.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas.index; 11 | 12 | import fc.xml.xas.MutableFragmentPointer; 13 | import fc.xml.xas.Pointer; 14 | import fc.xml.xas.Queryable; 15 | import fc.xml.xas.XasFragment; 16 | 17 | /** 18 | * A class representing a complete document. Essentially this class is just a wrapper around a 19 | * fragment, and its benefit comes from the {@link GlobalPointer} that is used to access and mutate 20 | * it. 21 | */ 22 | public class Document implements Queryable { 23 | 24 | private XasFragment fragment; 25 | 26 | private static final int[] ROOT_PATH = new int[0]; 27 | 28 | 29 | public Document(XasFragment fragment) { 30 | this.fragment = fragment; 31 | } 32 | 33 | 34 | public XasFragment getFragment() { 35 | return fragment; 36 | } 37 | 38 | 39 | protected Pointer constructPointer(DeweyKey key, MutableFragmentPointer pointer) { 40 | return new GlobalPointer(this, key, pointer); 41 | } 42 | 43 | 44 | public GlobalPointer getRoot() { 45 | return (GlobalPointer) query(ROOT_PATH); 46 | } 47 | 48 | 49 | public Pointer query(int[] path) { 50 | Pointer pointer = fragment.query(path); 51 | if (pointer != null) { 52 | return constructPointer(DeweyKey.construct(path), (MutableFragmentPointer) pointer); 53 | } else { 54 | return null; 55 | } 56 | } 57 | 58 | } 59 | 60 | // arch-tag: a8960d97-e9b8-4eab-bd5d-d0bc8d5a3d2e 61 | -------------------------------------------------------------------------------- /src/fc/xml/xas/index/LazyPointer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas.index; 11 | 12 | import java.io.IOException; 13 | 14 | import fc.util.log.Log; 15 | import fc.xml.xas.FragmentPointer; 16 | import fc.xml.xas.Item; 17 | import fc.xml.xas.Pointer; 18 | 19 | public class LazyPointer extends FragmentPointer { 20 | 21 | private LazyFragment lazyFragment; 22 | 23 | 24 | LazyPointer(LazyFragment fragment, int index) { 25 | super(fragment, index); 26 | lazyFragment = fragment; 27 | } 28 | 29 | 30 | @Override 31 | public Item get() { 32 | return fragment.get(index); 33 | } 34 | 35 | 36 | @Override 37 | public Pointer query(int[] path) { 38 | return lazyFragment.query(new LazyPointer(lazyFragment, index), path); 39 | } 40 | 41 | 42 | @Override 43 | public void canonicalize() { 44 | Item item = get(); 45 | while (item instanceof LazyFragment) { 46 | lazyFragment = (LazyFragment) item; 47 | try { 48 | lazyFragment.force(1); 49 | } catch (IOException ex) { 50 | Log.warning("Lazy pointer canonicalization failed", ex); 51 | throw (RuntimeException) new RuntimeException(ex.getMessage()).initCause(ex); 52 | } 53 | fragment = lazyFragment; 54 | index = 0; 55 | item = get(); 56 | } 57 | } 58 | 59 | } 60 | 61 | // arch-tag: ecd10740-a044-475f-a058-ae60f632c04f 62 | -------------------------------------------------------------------------------- /src/fc/xml/xas/index/SeekableParserSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas.index; 11 | 12 | import fc.xml.xas.ParserSource; 13 | 14 | public interface SeekableParserSource extends SeekableSource, ParserSource { 15 | 16 | } 17 | 18 | // arch-tag: c1f2bccc-c8b0-488f-9fd4-906197f3d6ce 19 | // 20 | 21 | -------------------------------------------------------------------------------- /src/fc/xml/xas/index/VersionedEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas.index; 11 | 12 | public class VersionedEntry { 13 | 14 | private Index.Entry entry; 15 | private VersionNode current; 16 | 17 | 18 | VersionedEntry(VersionedDocument document, Index.Entry entry) { 19 | this.entry = entry; 20 | current = document.getVersion(); 21 | } 22 | 23 | 24 | public Index.Entry getEntry() { 25 | update(); 26 | return entry; 27 | } 28 | 29 | 30 | private boolean isValid() { 31 | directUpdate(); 32 | return entry != null; 33 | } 34 | 35 | 36 | private void update() { 37 | if (!isValid()) { throw new IllegalStateException("Entry not valid"); } 38 | directUpdate(); 39 | } 40 | 41 | 42 | private void directUpdate() { 43 | while (!current.isSentinel()) { 44 | if (entry != null) { 45 | entry = current.update(entry); 46 | } 47 | current = current.getNext(); 48 | } 49 | } 50 | 51 | } 52 | 53 | // arch-tag: 1dca6e5e-2843-4960-b4e0-33f78291cb99 54 | -------------------------------------------------------------------------------- /src/fc/xml/xas/typing/PrimitiveCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas.typing; 11 | 12 | import java.io.IOException; 13 | 14 | import fc.xml.xas.Qname; 15 | import fc.xml.xas.SerializerTarget; 16 | import fc.xml.xas.StartTag; 17 | 18 | /** 19 | * An encoder-decoder pair for primitive typed data. 20 | */ 21 | public interface PrimitiveCodec { 22 | 23 | /** 24 | * Get the MIME type that this codec understands. 25 | */ 26 | String getType(); 27 | 28 | 29 | /** 30 | * Query whether a type is understood 31 | * @param typeName 32 | * the name of the type to query 33 | * @return true if this codec understands the type typeName, 34 | * false otherwise 35 | */ 36 | boolean isKnown(Qname typeName); 37 | 38 | 39 | void encode(Qname typeName, Object value, SerializerTarget target) throws IOException; 40 | 41 | 42 | Object decode(Qname typeName, byte[] value, int offset, int length, String encoding, 43 | StartTag context) throws IOException; 44 | 45 | } 46 | 47 | // arch-tag: 2c9a18e0-a56c-4a0c-ba9e-f664c6f666ff 48 | -------------------------------------------------------------------------------- /src/fc/xml/xas/typing/ValueCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-xas-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xas.typing; 11 | 12 | import java.io.IOException; 13 | 14 | import fc.xml.xas.ItemSource; 15 | import fc.xml.xas.ItemTarget; 16 | import fc.xml.xas.Qname; 17 | import fc.xml.xas.StartTag; 18 | 19 | /** 20 | * An encoder-decoder pair for complex typed data. 21 | */ 22 | public interface ValueCodec { 23 | 24 | /** 25 | * Query whether a type is understood 26 | * @param typeName 27 | * the name of the type to query 28 | * @return true if this codec understands the type typeName, 29 | * false otherwise 30 | */ 31 | boolean isKnown(Qname typeName); 32 | 33 | 34 | void encode(Qname typeName, Object value, ItemTarget target, StartTag parent) 35 | throws IOException; 36 | 37 | 38 | Object decode(Qname typeName, ItemSource source) throws IOException; 39 | 40 | } 41 | 42 | // arch-tag: 6b77cfa1-0c7f-4e39-966e-12f927c2d26b 43 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/BatchMutable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xmlr; 11 | 12 | /** 13 | * Interface for trees that can be restructured to a reftree. 14 | */ 15 | 16 | public interface BatchMutable { 17 | 18 | /** 19 | * Applies a reftree to this tree. If successful, the tree will have the same structure and 20 | * content as t. 21 | * @param t 22 | * Tree to apply 23 | * @throws NodeNotFoundException 24 | * if a node is missing. 25 | */ 26 | 27 | public void apply(RefTree t) throws NodeNotFoundException; 28 | 29 | } 30 | 31 | // arch-tag: 5b48a083-79c9-4ba8-b71b-9992e94654af 32 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/IdAddressableRefTree.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | // $Id: IdAddressableRefTree.java,v 1.4 2004/11/22 12:45:03 ctl Exp $ 11 | package fc.xml.xmlr; 12 | 13 | import java.util.Iterator; 14 | 15 | /** 16 | * A reftree that can be accessed by node ids in a random-access fashion. The identifiers of the 17 | * nodes in this class of trees are required to be unique. An IdAddressableRefTree is typically used 18 | * to hold the common base tree to which the references in a set of reftrees point. 19 | */ 20 | 21 | public interface IdAddressableRefTree extends RefTree { 22 | 23 | /** 24 | * Get node by id. 25 | * @param id 26 | * id of node to access 27 | * @return node in the tree, or null if the tree has no such node 28 | */ 29 | 30 | public RefTreeNode getNode(Key id); 31 | 32 | 33 | /** 34 | * Returns true if this tree contains the given node. 35 | * @param id 36 | * id of node to search for 37 | * @return boolean true if the node exists in the tree 38 | */ 39 | public boolean contains(Key id); 40 | 41 | 42 | /** 43 | * Get parent id of node id. 44 | * @param nid 45 | * id of node, whose parent id is desired 46 | * @return id of parent of nid, or null if nid is root 47 | * @throws NodeNotFoundException 48 | * if nid is not in the tree. 49 | */ 50 | public Key getParent(Key nid) throws NodeNotFoundException; 51 | 52 | 53 | /** 54 | * Get child ids of node id. 55 | * @param id 56 | * id of node, whose child ids are desired 57 | * @return Iterator over the {@link java.lang.String} child ids 58 | * @throws NodeNotFoundException 59 | * if id is not in the tree. 60 | */ 61 | // Note: iterator is over child ids, not nodes! 62 | public Iterator childIterator(Key id) throws NodeNotFoundException; 63 | } 64 | // arch-tag: 9c7eadd5d076df7b4e272354cf9f013e *- 65 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/Key.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xmlr; 11 | 12 | /** 13 | * Interface for objects that are reftree node keys. 14 | */ 15 | 16 | public interface Key { 17 | 18 | // adds the semantic that this gives the serialized form of the string 19 | /** 20 | * Return string representation of key. This representation is used for serializing the key. 21 | */ 22 | 23 | public String toString(); 24 | } 25 | 26 | // arch-tag: e20bd4df-e38c-4919-b29b-4180b65f19c1 27 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/NodeNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | // $Id: NodeNotFoundException.java,v 1.4 2004/12/17 13:48:18 ctl Exp $ 11 | package fc.xml.xmlr; 12 | 13 | import java.io.IOException; 14 | 15 | /** 16 | * Exception indicating that a node was not found. Only raised by operations that requires the node 17 | * in question to exist. 18 | */ 19 | 20 | public class NodeNotFoundException extends Exception { 21 | 22 | private Key id; 23 | 24 | 25 | /** Create a new exception. */ 26 | public NodeNotFoundException() { // FIXME-W: Consider deprecating 27 | super(); 28 | } 29 | 30 | 31 | /** 32 | * Create a new exception. 33 | * @param id 34 | * id of missing node 35 | */ 36 | public NodeNotFoundException(Key id) { 37 | super("Node: " + (id == null ? "null" : id + " (type " + id.getClass() + ")")); 38 | this.id = id; 39 | } 40 | 41 | 42 | /** 43 | * Create a new exception. 44 | * @param msg 45 | * additional explanation 46 | * @param id 47 | * id of missing node 48 | */ 49 | public NodeNotFoundException(String msg, Key id) { 50 | super(msg + " " + id); 51 | this.id = id; 52 | } 53 | 54 | 55 | /** 56 | * Get id of missing node. 57 | * @return id of the missing node which caused the exception 58 | */ 59 | 60 | public Key getId() { 61 | return id; 62 | } 63 | 64 | 65 | public IOException makeIOException() { 66 | IOException ex = new IOException(getMessage()); 67 | ex.initCause(this); 68 | return ex; 69 | } 70 | } 71 | // arch-tag: b871dc488468810e3fbd101d6fee9376 *- 72 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/NodeReference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xmlr; 11 | 12 | /** 13 | * A node reference. 14 | */ 15 | public class NodeReference implements Reference { 16 | 17 | private Key target; 18 | 19 | 20 | /** 21 | * Create new instance. 22 | * @param target 23 | * reference target 24 | */ 25 | public NodeReference(Key target) { 26 | this.target = target; 27 | } 28 | 29 | 30 | /** 31 | * Create new instance. 32 | * @param k 33 | * reference target 34 | * @return instance 35 | */ 36 | public static NodeReference create(Key k) { 37 | return new NodeReference(k); 38 | } 39 | 40 | 41 | /** @inheritDoc */ 42 | public Key getTarget() { 43 | return target; 44 | } 45 | 46 | 47 | /** Returns false. */ 48 | public final boolean isTreeReference() { 49 | return false; 50 | } 51 | 52 | } 53 | 54 | // arch-tag: c916d3c2-ac53-466a-94ce-70f9391ba19c 55 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/RefTree.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | // $Id: RefTree.java,v 1.2 2004/11/22 12:45:07 ctl Exp $ 11 | package fc.xml.xmlr; 12 | 13 | /** 14 | * Base interface for a reftree, i.e. an XMLR document parse tree. RefTrees consist of nodes of 15 | * class {@link RefTreeNode RefTreeNode}. 16 | */ 17 | 18 | public interface RefTree { 19 | 20 | /** 21 | * Get root node of the reftree. 22 | * @return RefTreeNode 23 | */ 24 | public RefTreeNode getRoot(); 25 | 26 | /** Interface for trees that are selectively held in memory. */ 27 | public interface Unforceable { 28 | 29 | /** 30 | * Inform the tree that a subtree is no longer actively used. 31 | * @param k 32 | * root of the subtree. 33 | */ 34 | public void unforce(Key k); 35 | } 36 | 37 | } 38 | // arch-tag: 67f683b77de6e2955e095c62f767d462 *- 39 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/RefTreeImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | // $Id: RefTreeImpl.java,v 1.3 2004/11/22 21:18:16 ctl Exp $ 11 | package fc.xml.xmlr; 12 | 13 | /** 14 | * Default implementation of {@link RefTree}. 15 | */ 16 | 17 | public class RefTreeImpl implements RefTree { 18 | 19 | protected RefTreeNode root; 20 | 21 | 22 | /** 23 | * Create a new reftree. 24 | * @param root 25 | * root of the reftree 26 | */ 27 | public RefTreeImpl(RefTreeNode root) { 28 | this.root = root; 29 | } 30 | 31 | 32 | public RefTreeNode getRoot() { 33 | return root; 34 | } 35 | } 36 | // arch-tag: db2b79aa0b4ca2a07e645fcaa608ba50 *- 37 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/Reference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xmlr; 11 | 12 | /** A reftree reference. */ 13 | 14 | public interface Reference { 15 | 16 | /** Get target. */ 17 | public Key getTarget(); 18 | 19 | 20 | /** 21 | * Returns true if the reference is a tree reference. 22 | * @return true if the reference is a tree reference 23 | */ 24 | public boolean isTreeReference(); 25 | } 26 | 27 | // arch-tag: c50c5c13-4b73-4564-b108-2be287c29d04 28 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/TreeReference.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xmlr; 11 | 12 | /** 13 | * A tree reference. 14 | */ 15 | public class TreeReference implements Reference { 16 | 17 | private Key target; 18 | 19 | 20 | /** 21 | * Create new instance. 22 | * @param k 23 | * reference target 24 | * @return instance 25 | */ 26 | public static TreeReference create(Key k) { 27 | return new TreeReference(k); 28 | } 29 | 30 | 31 | /** 32 | * Create new instance. 33 | * @param target 34 | * reference target 35 | */ 36 | public TreeReference(Key target) { 37 | this.target = target; 38 | } 39 | 40 | 41 | /** @inheritDoc */ 42 | public Key getTarget() { 43 | return target; 44 | } 45 | 46 | 47 | /** Returns true. */ 48 | public final boolean isTreeReference() { 49 | return true; 50 | } 51 | 52 | } 53 | 54 | // arch-tag: 067d92d6-ca55-4283-be17-f610ae45ce78 55 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/model/KeyModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xmlr.model; 11 | 12 | import java.io.IOException; 13 | 14 | import fc.xml.xmlr.Key; 15 | 16 | /** 17 | * Interface for serialization and deserialization of keys. 18 | */ 19 | 20 | // What the hell a key model exactly consists of is not clear yet 21 | // We know we want to support 22 | // id attribute keys 23 | // --in this case keys are (statically?) determined during serialize/deserialize 24 | // Numeric XPath keys 25 | // --in this case the key is independent of node content, and depends on the 26 | // node position in the tree 27 | // maybe position-dependent keys really do not fit into the whole thing-- better 28 | // to use some smart key object that can tell its dynamic DeweyKey by computing 29 | // it... 30 | public interface KeyModel { 31 | 32 | // How do keys survive move and serialization? 33 | 34 | /** 35 | * Make key from object. 36 | */ 37 | public Key makeKey(Object s) throws IOException; 38 | 39 | // Not at all (i.e. memory addresses) 40 | /** Transient, i.e. non-serializable keys. */ 41 | public interface Transient extends KeyModel { 42 | 43 | } 44 | 45 | // Any change can break the key, but keys of read-only docs survive 46 | // E.g. Numeric XPath 47 | /** Keys that may change when tree is modified. */ 48 | public interface TransientOnChange extends Transient { 49 | 50 | } 51 | 52 | // Keys that survive and edits (and disappear on delete, and new keys appear 53 | // on insert. E.g. the id attribute model 54 | /** Persistent node keys. */ 55 | public interface Persistent extends KeyModel { 56 | 57 | } 58 | 59 | /** Model with string keys. */ 60 | public static final KeyModel STRINGKEY = new KeyModel() { 61 | 62 | // NOTE: null = we could not find any id data for the id in question 63 | public Key makeKey(Object s) { 64 | return s == null ? null : new StringKey(s.toString()); 65 | } 66 | 67 | }; 68 | 69 | } 70 | 71 | // arch-tag: e9d34af1-fac2-4a12-9f28-f9fe874987bc 72 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/model/NodeModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xmlr.model; 11 | 12 | import fc.xml.xmlr.Key; 13 | import fc.xml.xmlr.MutableRefTree; 14 | import fc.xml.xmlr.RefTreeNode; 15 | import fc.xml.xmlr.RefTreeNodeImpl; 16 | 17 | /** Model for adding nodes to a tree. */ 18 | public interface NodeModel { 19 | 20 | /** 21 | * Add a new node to a tree. 22 | * @param parent 23 | * parent node, or null if this is a new root 24 | * @param key 25 | * key of the node 26 | * @param content 27 | * content of the node. May be an instance of {@link fc.xml.xmlr.Reference}, in which 28 | * case the node should be a reference node 29 | * @param pos 30 | * position in the child list of parent. May be 31 | * {@link MutableRefTree#DEFAULT_POSITION}. 32 | * @return new node 33 | */ 34 | public RefTreeNode build(RefTreeNode parent, Key key, Object content, int pos); 35 | 36 | /** 37 | * Default node model. Builds {@link RefTreeNodeImpl} nodes. 38 | */ 39 | 40 | public static final NodeModel DEFAULT = new NodeModel() { 41 | 42 | public RefTreeNode build(RefTreeNode parent, Key key, Object content, int pos) { 43 | assert parent == null || parent instanceof RefTreeNodeImpl; 44 | RefTreeNodeImpl p = (RefTreeNodeImpl) parent; 45 | RefTreeNodeImpl n = new RefTreeNodeImpl(p, key, content); 46 | if (p == null) return n; // Inserting root 47 | if (pos == MutableRefTree.DEFAULT_POSITION) p.addChild(n); 48 | else p.addChild(pos, n); 49 | return n; 50 | } 51 | 52 | }; 53 | } 54 | 55 | // arch-tag: c1b243d9-7156-4599-bab2-68f8fb7ed7af 56 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/model/TransientKey.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xmlr.model; 11 | 12 | import fc.xml.xmlr.Key; 13 | 14 | /** 15 | * Key based on object identity. The toString() output may be identical for some keys, in the very 16 | * unlikely case that the VM produces non-unique System.identityHashCode()s. 17 | */ 18 | public class TransientKey implements Key { 19 | 20 | @Override 21 | public String toString() { 22 | assert false : "Tried to serialize transient key"; 23 | return null; 24 | } 25 | 26 | 27 | public String debugString() { 28 | return "t-" + Integer.toHexString(System.identityHashCode(this)); 29 | } 30 | 31 | 32 | public static TransientKey createKey() { 33 | return new TransientKey(); 34 | } 35 | } 36 | 37 | // arch-tag: 904f7f1e-ba65-4601-a27e-c20e12e0bc06 38 | 39 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/test/RootSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xmlr.test; 11 | 12 | import java.io.IOException; 13 | 14 | import junit.framework.Test; 15 | import junit.framework.TestCase; 16 | import junit.framework.TestSuite; 17 | import fc.util.log.Log; 18 | import fc.util.log.SysoutLogger; 19 | 20 | public class RootSuite extends TestCase { 21 | 22 | public static final Class[] testClasses = { TestRefTrees.class, XasTests.class, 23 | TestChangeTree.class, TestMutableTree.class, 24 | TestDeweyTrees.class }; 25 | 26 | 27 | @Override 28 | public void setUp() throws Exception { 29 | } 30 | 31 | 32 | @Override 33 | public void tearDown() throws Exception { 34 | // 35 | } 36 | 37 | 38 | /* 39 | * public void testNop() { 40 | * 41 | * } 42 | */ 43 | 44 | public static Test suite() throws IOException { 45 | // System.out.println("Setting logger to System.out"); 46 | // System.out.flush(); 47 | SysoutLogger l = new SysoutLogger(); 48 | Log.setLogger(l); 49 | TestSuite tests = new TestSuite(); 50 | fillSuite(tests); 51 | return tests; 52 | } 53 | 54 | 55 | public static void fillSuite(TestSuite tests) throws IOException { 56 | // System.out.println("Setting logger to System.out"); 57 | // System.out.flush(); 58 | String filter = System.getProperty("fc.xml.xmlr.test.classes"); 59 | for (Class c : testClasses) { 60 | if (filter != null && !c.getName().matches(filter)) { 61 | Log.debug("Filtered out class ", c); 62 | continue; 63 | } 64 | tests.addTestSuite(c); 65 | } 66 | } 67 | 68 | } 69 | 70 | // arch-tag: ebccd106-b4f5-496e-a5cc-f8d18557d9d5 71 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/test/TreeUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xmlr.test; 11 | 12 | public class TreeUtil { 13 | 14 | } 15 | // arch-tag: 284bdfa6-fca9-4523-a37f-e527aaa6decf 16 | 17 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/xas/MalformedXml.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xmlr.xas; 11 | 12 | import java.io.IOException; 13 | 14 | /** Exception indicating malformed Xml. */ 15 | public class MalformedXml extends IOException { 16 | 17 | public MalformedXml() { 18 | super(); 19 | } 20 | 21 | 22 | public MalformedXml(String s) { 23 | super(s); 24 | } 25 | 26 | } 27 | 28 | // arch-tag: 0da848b9-e327-43ac-a960-a6901639f442 29 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/xas/ReferenceItemTransform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xmlr.xas; 11 | 12 | import java.io.IOException; 13 | import java.util.LinkedList; 14 | import java.util.Queue; 15 | 16 | import fc.xml.xas.Item; 17 | import fc.xml.xas.ItemTransform; 18 | 19 | /** 20 | * Transform that decodes reference items. 21 | */ 22 | public class ReferenceItemTransform implements ItemTransform { 23 | 24 | protected Queue queue = new LinkedList(); 25 | 26 | 27 | public boolean hasItems() { 28 | return !queue.isEmpty(); 29 | } 30 | 31 | 32 | public Item next() throws IOException { 33 | return queue.poll(); 34 | } 35 | 36 | 37 | public void append(Item item) throws IOException { 38 | Item i = RefItem.decode(item); 39 | if (i != null) // BUGFIX-20070625-1: Do not emit to queue 40 | queue.offer(i); 41 | } 42 | 43 | } 44 | 45 | // arch-tag: 0d1fba1e-7093-42e7-b667-40d89d281b72 46 | -------------------------------------------------------------------------------- /src/fc/xml/xmlr/xas/UniformXasCodec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2005--2008 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-raxs-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fc.xml.xmlr.xas; 11 | 12 | import java.io.IOException; 13 | 14 | import fc.xml.xas.Item; 15 | import fc.xml.xas.ItemTarget; 16 | import fc.xml.xas.StartTag; 17 | import fc.xml.xas.typing.TypedItem; 18 | import fc.xml.xmlr.RefTreeNode; 19 | import fc.xml.xmlr.model.KeyIdentificationModel; 20 | import fc.xml.xmlr.model.XasCodec; 21 | 22 | /** 23 | * XAS Codec that translate nodes into a fixed number of XAS items. 24 | */ 25 | public interface UniformXasCodec extends XasCodec { 26 | 27 | /** 28 | * Size of content in items, if known. The method should return the uniform size in items of 29 | * content (if known). Return -1 if the size is unknown, or if it varies. Some code 30 | * using a TreeModel requires fixed size content (see the Javadoc of the class in question). 31 | * @return size in items of content, -1 if unknown 32 | */ 33 | public int size(); 34 | 35 | public static final UniformXasCodec ITEM_CODEC = new ItemCodec(); 36 | 37 | /** 38 | * Items as content. Typed items are decoded as their value. 39 | */ 40 | public static class ItemCodec implements UniformXasCodec { 41 | 42 | public Object decode(PeekableItemSource is, KeyIdentificationModel kim) throws IOException { 43 | Item i = is.next(); 44 | if (i.getType() == TypedItem.TYPED) return ((TypedItem) i).getValue(); 45 | return i; 46 | } 47 | 48 | 49 | public void encode(ItemTarget t, RefTreeNode n, StartTag context) throws IOException { 50 | assert n.getContent() instanceof Item : "Invalid content type " + 51 | n.getContent().getClass(); 52 | Item i = (Item) n.getContent(); 53 | t.append(i); 54 | } 55 | 56 | 57 | public int size() { 58 | return 1; 59 | } 60 | } 61 | } 62 | 63 | // arch-tag: 10a93354-b45f-4223-925e-d9e114a70064 64 | -------------------------------------------------------------------------------- /src/fuegocore/message/encoding/EoaMachine.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.message.encoding; 11 | 12 | import fuegocore.util.xas.Event; 13 | 14 | /** 15 | * An interface for transforming an XML output stream. The methods in this interface are used to 16 | * transform a stream of XML events into a different stream. The object is passed the events one at 17 | * a time and it will return the events to output as it is passed the input events. 18 | */ 19 | public interface EoaMachine { 20 | 21 | /** 22 | * Get the next event to output. The argument event of this method is the next event in the 23 | * stream to be transformed and the returned event is the next one to output. If the returned 24 | * event is null, no output is to be performed yet. 25 | * @param ev 26 | * the next event in the input stream 27 | * @return the next event in the output stream, or null if that cannot yet be 28 | * determined 29 | */ 30 | Event nextEvent(Event ev); 31 | 32 | 33 | /** 34 | * Return whether the current state is the initial state. When events are fed into an EOA 35 | * machine, the machine's state presumably changes to accommodate the omission of events. In 36 | * some applications it is important to know whether the machine is in the middle of some 37 | * processing or whether it is behaving normally. The caller can then adjust its own behavior 38 | * based on the machine's current state. 39 | * @return true if the machine is in its initial state, false 40 | * otherwise 41 | */ 42 | boolean isInitialState(); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/fuegocore/message/encoding/IdentityEoaMachine.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.message.encoding; 11 | 12 | import fuegocore.util.xas.Event; 13 | 14 | /** 15 | * A default EOA machine implementation. This class is used as the default {@link EoaMachine} by 16 | * {@link XebuSerializer} if no {@link EoaMachine} has been installed by the application. Like its 17 | * counterpart {@link IdentityDoaMachine}, this class is intended for use as a common superclass for 18 | * {@link EoaMachine} implementations. The useful contributions are the introduction of the 19 | * {@link #state} field and a default implementation of the {@link #isInitialState} method. 20 | */ 21 | public class IdentityEoaMachine implements EoaMachine { 22 | 23 | /** 24 | * The current state of the machine. In this implementation this field is never updated. A 25 | * subclass will want to update this in its {@link #nextEvent} method. The value 0 26 | * is the initial state. 27 | */ 28 | protected int state = 0; 29 | 30 | 31 | /** 32 | * Return the argument. Since IdentityEoaMachine does no transformation to the 33 | * input stream, the transformed event is always the input event. 34 | */ 35 | public Event nextEvent(Event ev) { 36 | return ev; 37 | } 38 | 39 | 40 | /** 41 | * Return whether the current state is the initial state. For IdentityEoaMachine, 42 | * this method always returns true, but it is written so that the same 43 | * implementation may return false for a subclass. 44 | * @return true if the value of {@link #state} is 0, 45 | * false otherwise 46 | */ 47 | public boolean isInitialState() { 48 | return state == 0; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/fuegocore/message/encoding/OutTokenCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.message.encoding; 11 | 12 | /** 13 | * A cache mapping objects to small integers. This class provides a mapping of objects to integers 14 | * in the way that an insert of a new element into a full mapping removes an existing association 15 | * and returns the integer connected to that. 16 | */ 17 | public interface OutTokenCache { 18 | 19 | /** 20 | * Insert an object into the cache. The returned value is the integer this object is mapped into 21 | * after the insertion. It is guaranteed that the returned values will be a consecutive sequence 22 | * of integers starting from 0 until the cache is full, after which no guarantees 23 | * are given. 24 | * @param key 25 | * the object to insert 26 | * @return the integer that key now maps to 27 | */ 28 | int insert(Object key); 29 | 30 | 31 | /** 32 | * Fetch an object's corresponding integer from a cache. The returned value is also used for 33 | * signaling errors; it will be -1 if key is not found in the cache. 34 | * @param key 35 | * the object to look for 36 | * @return the integer key maps to, or -1 if key has no mapping 37 | */ 38 | int fetch(Object key); 39 | 40 | 41 | /** 42 | * Fetch an object corresponding to a given value. This is the reverse of the ordinary mapping 43 | * and is useful when needing to access the non-cached form of objects. 44 | * @param value 45 | * the value to look for 46 | * @return the object that maps to value, or null if no object maps to 47 | * value. 48 | */ 49 | Object fetchReverse(int value); 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/fuegocore/message/encoding/TokenCacheCodecFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.message.encoding; 11 | 12 | import fuegocore.util.xas.CodecFactory; 13 | 14 | /** 15 | * An interface for token caching codec factories. Some XML serialization formats are able to map 16 | * names in XML documents to binary tokens. This interface provides an extension to the standard 17 | * {@link CodecFactory} interface for setting initial values for those caches, often useful when 18 | * some information on the syntax of the XML documents is available. 19 | */ 20 | public interface TokenCacheCodecFactory extends CodecFactory { 21 | 22 | /** 23 | * Set the initial output token caches for a specified token. 24 | * @param token 25 | * a token identifying the cache to set 26 | * @param caches 27 | * the initial caches to use 28 | * @return true if the caches of token were set to caches 29 | * , false otherwise 30 | */ 31 | boolean setInitialOutCache(Object token, OutTokenCache[] caches); 32 | 33 | 34 | /** 35 | * Set the initial input token caches for a specified token. 36 | * @param token 37 | * a token identifying the cache to set 38 | * @param caches 39 | * the initial caches to use 40 | * @return true if the caches of token were set to caches 41 | * , false otherwise 42 | */ 43 | boolean setInitialInCache(Object token, Object[][] caches); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/fuegocore/message/encoding/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The fuegocore.message.encoding package 5 | 6 | 7 | 8 |

    9 | Serializers and parsers for the Xebu format. This package 10 | contains everything needed to use the Xebu format for XML 11 | data in programs. 12 |

    13 | 14 |

    15 | The serializer and parser are implementations of the XmlPull 16 | APIs {@link org.xmlpull.v1.XmlSerializer} and {@link 17 | org.xmlpull.v1.XmlPullParser}, respectively, so these classes 18 | can be used as drop-in replacements in existing applications. 19 |

    20 | 21 | 22 | -------------------------------------------------------------------------------- /src/fuegocore/message/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The fuegocore.message package 5 | 6 | 7 | 8 |

    9 | The root package for the messaging system. This package is 10 | mostly to provide a hierarchy so that the messaging subsystem is 11 | compartmentalized into its own section of the directory 12 | hierarchy. However, it also collects the classes that may be 13 | used by the users of the messaging system as a simpler interface 14 | to the specific components. 15 |

    16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/fuegocore/message/tests/CacheTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.message.tests; 11 | 12 | import junit.framework.TestCase; 13 | 14 | import fuegocore.message.encoding.OutCache; 15 | 16 | /** 17 | * Test the message encoding caches. This class is a set of JUnit test cases for the various caches 18 | * used in message encoding. 19 | */ 20 | public class CacheTest extends TestCase { 21 | 22 | public CacheTest(String name) { 23 | super(name); 24 | } 25 | 26 | 27 | /** 28 | * Test that values do not linger in output caches. An actual application discovered that values 29 | * were not evicted from output caches, which caused problems if an overwritten cached string 30 | * was used later. This test ensures that it does not happen again. 31 | */ 32 | public void testCacheEviction() { 33 | OutCache cache = new OutCache(); 34 | int initialSlot = 0x00; 35 | // Fill the cache with values and overflow a little 36 | for (int i = initialSlot; i < 300; i++) { 37 | assertEquals("Value " + i + " not inserted in expected place", i % 256, 38 | cache.insert("Key" + i)); 39 | } 40 | // Not found: Key0 - Key43, found: Key44 - Key299 41 | assertEquals("Old key 0 persists in cache", -1, cache.fetch("Key0")); 42 | assertEquals("Old key 43 persists in cache", -1, cache.fetch("Key43")); 43 | assertEquals("Key 44 in a wrong place or evicted prematurely", 44, cache.fetch("Key44")); 44 | assertEquals("Key 299 in a wrong place or evicted prematurely", 43, cache.fetch("Key299")); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/fuegocore/message/tests/MessageSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.message.tests; 11 | 12 | import junit.framework.Test; 13 | import junit.framework.TestCase; 14 | import junit.framework.TestSuite; 15 | 16 | /** 17 | * The collection of tests for the messaging subsystem. This class adds all the known messaging 18 | * system unit tests into the tests to be run. 19 | */ 20 | public class MessageSuite extends TestCase { 21 | 22 | public MessageSuite(String name) { 23 | super(name); 24 | } 25 | 26 | 27 | public static Test suite() { 28 | TestSuite suite = new TestSuite(); 29 | 30 | suite.addTestSuite(CacheTest.class); 31 | 32 | return suite; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/fuegocore/message/tests/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The fuegocore.message.tests package 5 | 6 | 7 | 8 |

    9 | Unit tests for the messaging system. The classes in this 10 | package are JUnit unit tests designed to test various parts of 11 | the messaging system's functionality in isolation. 12 |

    13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/fuegocore/util/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The fuegocore.util package 5 | 6 | 7 | 8 |

    9 | General utility classes for use in the Fuego Core services. 10 | This package collects all the classes that are used by the 11 | services, but which are not specific to the services themselves, 12 | but might have wider applicability. 13 |

    14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/fuegocore/util/tests/QueueTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.tests; 11 | 12 | import junit.framework.TestCase; 13 | 14 | import fuegocore.util.Queue; 15 | 16 | /** 17 | * Test the queue implementation. This class is a collection of JUnit test cases for the 18 | * {@link Queue} class. 19 | */ 20 | public class QueueTest extends TestCase { 21 | 22 | private Queue queue; 23 | 24 | 25 | @Override 26 | protected void setUp() { 27 | queue = new Queue(); 28 | } 29 | 30 | 31 | public QueueTest(String name) { 32 | super(name); 33 | } 34 | 35 | 36 | /** 37 | * Test with separated enqueuing and dequeuing. First, insert a few items into the queue and 38 | * then remove them all. Finally, ensure that the queue is empty. 39 | */ 40 | public void testStraight() { 41 | assertTrue("Queue not empty", queue.empty()); 42 | queue.enqueue(new Integer(0)); 43 | assertTrue("Queue still empty", !queue.empty()); 44 | assertEquals("Inserted item not found", new Integer(0), queue.peek()); 45 | queue.enqueue(new Integer(1)); 46 | queue.enqueue(new Integer(2)); 47 | for (int i = 0; i < 3; i++) { 48 | assertEquals("Queue not preserving order", new Integer(i), queue.dequeue()); 49 | } 50 | assertTrue("Queue not yet empty", queue.empty()); 51 | } 52 | 53 | 54 | /** 55 | * Test intermingled enqueuing and dequeuing. In a loop, do an insertion followed immediately by 56 | * a deletion. Check that the queue's emptiness remains correct at all times. 57 | */ 58 | public void testMixed() { 59 | assertTrue("Queue not empty", queue.empty()); 60 | for (int i = 0; i < 5; i++) { 61 | queue.enqueue(new Integer(i)); 62 | assertTrue("Queue empty on round " + i, !queue.empty()); 63 | assertEquals("Incorrect item received on round " + i, new Integer(i), queue.dequeue()); 64 | assertTrue("Queue not empty on round " + i, queue.empty()); 65 | } 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /src/fuegocore/util/tests/UtilSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.tests; 11 | 12 | import junit.framework.Test; 13 | import junit.framework.TestCase; 14 | import junit.framework.TestSuite; 15 | 16 | /** 17 | * The collection of tests for the utilities. This class adds all the known utility package unit 18 | * tests into the tests to be run. 19 | */ 20 | public class UtilSuite extends TestCase { 21 | 22 | public UtilSuite(String name) { 23 | super(name); 24 | } 25 | 26 | 27 | public static Test suite() { 28 | TestSuite suite = new TestSuite(); 29 | 30 | suite.addTestSuite(UtilTest.class); 31 | suite.addTestSuite(QueueTest.class); 32 | suite.addTestSuite(XasTest.class); 33 | 34 | return suite; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/fuegocore/util/tests/UtilTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.tests; 11 | 12 | import junit.framework.TestCase; 13 | 14 | import fuegocore.util.Util; 15 | 16 | /** 17 | * Test the miscellaneous utility methods. This class implements tests for the methods in the 18 | * {@link Util} class of static methods. 19 | */ 20 | public class UtilTest extends TestCase { 21 | 22 | public UtilTest(String name) { 23 | super(name); 24 | } 25 | 26 | 27 | /** 28 | * Test that the hexadecimal encoding works correctly. The {@link Util#toPrintable} method is 29 | * defined to output printable ASCII as such and URL-escape all other characters. This method 30 | * compares the result of that method's output to a pre-calculated string with the correct 31 | * content. 32 | */ 33 | public void testToHex() { 34 | String correct = "%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F" 35 | + "%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F" + " !\"#$%&'()*+,-./" 36 | + "0123456789:;<=>?" + "@ABCDEFGHIJKLMNO" + "PQRSTUVWXYZ[\\]^_" 37 | + "`abcdefghijklmno" + "pqrstuvwxyz{|}~%7F" 38 | + "%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F" 39 | + "%90%91%92%93%94%95%96%97%98%99%9A%9B%9C%9D%9E%9F" 40 | + "%A0%A1%A2%A3%A4%A5%A6%A7%A8%A9%AA%AB%AC%AD%AE%AF" 41 | + "%B0%B1%B2%B3%B4%B5%B6%B7%B8%B9%BA%BB%BC%BD%BE%BF" 42 | + "%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF" 43 | + "%D0%D1%D2%D3%D4%D5%D6%D7%D8%D9%DA%DB%DC%DD%DE%DF" 44 | + "%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF" 45 | + "%F0%F1%F2%F3%F4%F5%F6%F7%F8%F9%FA%FB%FC%FD%FE%FF"; 46 | byte[] result = new byte[0x100]; 47 | for (int i = 0; i < 0x100; i++) { 48 | result[i] = (byte) i; 49 | } 50 | assertEquals("Incorrect result", correct, Util.toPrintable(result, 0, result.length)); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/fuegocore/util/tests/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The fuegocore.util.tests package 5 | 6 | 7 | 8 |

    9 | Unit tests for the utility classes. The classes in this package 10 | are JUnit unit tests designed to test the functionality of the 11 | utility classes in the {@link fuegocore.util} package. 12 |

    13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/ChainedContentEncoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.xas; 11 | 12 | import java.io.IOException; 13 | 14 | import fuegocore.util.xas.ContentEncoder; 15 | import fuegocore.util.xas.TypedXmlSerializer; 16 | import fuegocore.util.xas.XasUtil; 17 | 18 | /** 19 | * A content encoder implementing chaining of encoders. The typical usage pattern for 20 | * {@link ContentEncoder} implementations is to chain them, i.e. an encoder is given a pre-existing 21 | * encoder, which it delegates to if it does not recognize the type to encode. This class contains a 22 | * field for this chained encoder, as well as a method to insert the XML Schema type attribute. 23 | */ 24 | public abstract class ChainedContentEncoder implements ContentEncoder { 25 | 26 | protected ContentEncoder chain; 27 | 28 | 29 | /** 30 | * Insert an appropriate XML Schema type attribute. It is the responsibility of the 31 | * {@link ContentEncoder#encode} method to insert the type attribute for the object 32 | * to encode. Since this code is practically always the same, it is included as a common part of 33 | * this class. This method invokes the {@link TypedXmlSerializer#attribute} method with the 34 | * supplied type name and other arguments. 35 | * @param namespace 36 | * the namespace URI of the type 37 | * @param name 38 | * the local name of the type 39 | * @param ser 40 | * the serializer to use for outputting the type attribute 41 | */ 42 | protected void putTypeAttribute(String namespace, String name, TypedXmlSerializer ser) 43 | throws IOException { 44 | String prefix = ser.getPrefix(namespace, false); 45 | if (prefix != null) { 46 | ser.attribute(XasUtil.XSI_NAMESPACE, "type", prefix + ":" + name); 47 | } else { 48 | throw new IOException("Type namespace " + namespace + " not recognized"); 49 | } 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/CoalescedEventSequence.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.xas; 11 | 12 | /** 13 | * An event sequence that coalesces all content events. This {@link EventSequence} implementation 14 | * takes an underlying {@link EventSequence} and provides a view of that where there are no 15 | * consecutive {@link Event#CONTENT} events. This is useful when e.g. using the XML serialization 16 | * format and there are many escaped characters that would each be returned as separate 17 | * {@link Event#CONTENT} events. 18 | */ 19 | public class CoalescedEventSequence extends TransformedEventStream { 20 | 21 | private StringBuffer content = new StringBuffer(); 22 | 23 | 24 | @Override 25 | protected void transform(Event ev, EventList el, XmlReader xr) { 26 | if (ev != null) { 27 | if (ev.getType() == Event.CONTENT) { 28 | Event e = xr.getCurrentEvent(); 29 | boolean looped = false; 30 | while (e != null && e.getType() == Event.CONTENT) { 31 | if (!looped) { 32 | content.append((String) ev.getValue()); 33 | } 34 | looped = true; 35 | content.append((String) e.getValue()); 36 | xr.advance(); 37 | e = xr.getCurrentEvent(); 38 | } 39 | if (looped) { 40 | ev = Event.createContent(content.toString()); 41 | content.setLength(0); 42 | } 43 | } 44 | el.add(ev); 45 | } 46 | } 47 | 48 | 49 | /** 50 | * Standard constructor. 51 | * @param es 52 | * the {@link EventSequence} to wrap and provide content coalescing for 53 | */ 54 | public CoalescedEventSequence(EventSequence es) { 55 | super(es); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/DefaultXmlParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.xas; 11 | 12 | import org.xmlpull.v1.XmlPullParserException; 13 | 14 | import org.kxml2.io.KXmlParser; 15 | 16 | /** 17 | * Default parser implementation for XML. This is an implementation of the 18 | * XmlPullParser interface that recognizes the {@link XasUtil#PROPERTY_CONTENT_CODEC} 19 | * property. By default it contains the {@link XmlSchemaContentDecoder} for typed content. 20 | *

    21 | * Note that normally the parser does not care about typed content, but rather just constructs 22 | * {@link Event#CONTENT} events. However, the parser is a logical place to put the typed content 23 | * decoder, and this placement is also symmetric with respect to how typed content encoders are 24 | * handled. 25 | */ 26 | public class DefaultXmlParser extends KXmlParser implements TypedXmlParser { 27 | 28 | private ContentDecoder decoder = new XmlSchemaContentDecoder(); 29 | 30 | 31 | @Override 32 | public void setProperty(String name, Object value) throws XmlPullParserException { 33 | if (XasUtil.PROPERTY_CONTENT_CODEC.equals(name)) { 34 | if (value instanceof ContentDecoder) { 35 | decoder = (ContentDecoder) value; 36 | } else { 37 | throw new IllegalArgumentException("Not a ContentDecoder: " + value); 38 | } 39 | } else { 40 | super.setProperty(name, value); 41 | } 42 | } 43 | 44 | 45 | @Override 46 | public Object getProperty(String name) { 47 | if (XasUtil.PROPERTY_CONTENT_CODEC.equals(name)) { 48 | return decoder; 49 | } else { 50 | return super.getProperty(name); 51 | } 52 | } 53 | 54 | 55 | public Object getObject() { 56 | return getText(); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/Qname.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.xas; 11 | 12 | /** 13 | * A class for representing XML names. A name in an XML document has two parts: a namespace URI and 14 | * a local name. This class is used to hold such a pair as a single object. It differs from other 15 | * such classes in that it does not contain the namespace prefix. Objects of this class are 16 | * immutable. 17 | */ 18 | public class Qname { 19 | 20 | private String namespace; 21 | private String name; 22 | 23 | 24 | public Qname(String namespace, String name) { 25 | this.namespace = namespace; 26 | this.name = name; 27 | } 28 | 29 | 30 | public String getNamespace() { 31 | return namespace; 32 | } 33 | 34 | 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/TypedXmlParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.xas; 11 | 12 | import org.xmlpull.v1.XmlPullParser; 13 | 14 | /** 15 | * An extended interface to permit parsing of typed XML content. Typically when using typed content 16 | * an application would perform the decoding itself from the string given as element content. 17 | * However, in the presence of serialization formats that do not map directly to the event stream 18 | * model of XmlPull this application-level decoding might incur a performance penalty. Therefore 19 | * this extended interface provides for ways to decode typed element content already in the parsing 20 | * stage. 21 | */ 22 | public interface TypedXmlParser extends XmlPullParser { 23 | 24 | /** 25 | * Typed content was just read. This indicates that the character data that was just read was 26 | * typed according to XML Schema and that the parser knows how to decode it. The decoded form of 27 | * the read data is available through the new {@link #getObject} method. The namespace and local 28 | * name of the type are available through the {@link #getNamespace()} and {@link #getName} 29 | * methods. A parser is not required to generate this event type even if the parsed document is 30 | * typed. 31 | */ 32 | int OBJECT = 15; 33 | 34 | 35 | /** 36 | * Returns the typed content of the current event. If the current event type is {@link #OBJECT}, 37 | * this returns the decoded form of the object, otherwise this behaves like {@link #getText}. 38 | * @return the decoded typed content of the current event 39 | */ 40 | Object getObject(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/TypedXmlSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.xas; 11 | 12 | import java.io.IOException; 13 | 14 | import org.xmlpull.v1.XmlSerializer; 15 | 16 | /** 17 | * An extended interface to permit the output of typed XML content. Normally a legacy application 18 | * would output both typed and untyped content encoded as a text {@link String}, making it 19 | * impossible for an alternative encoder to determine whether the content should be encoded 20 | * specially or it already is. This interface is intended for use when the content has already been 21 | * encoded and must not be encoded further. The normal text() methods are to be used 22 | * when default (or no) encoding is appropriate. 23 | */ 24 | public interface TypedXmlSerializer extends XmlSerializer { 25 | 26 | /** 27 | * Output the given content as the specified type. This method will output an {@link Object} 28 | * having the given XML Schema datatype. If the datatype has no special encoding known to this 29 | * serializer, it will fall back on the toString() method of the supplied object. 30 | * @param content 31 | * the object to output 32 | * @param namespace 33 | * the namespace URI of the XML Schema type 34 | * @param name 35 | * the local name of the XML Schema type 36 | * @return this encoder for the purposes of chaining 37 | * @throws IllegalArgumentException 38 | * if the given type name was not introduced by the preceding start element event 39 | */ 40 | TypedXmlSerializer typedContent(Object content, String namespace, String name) 41 | throws IOException; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/codec/DefaultCodecFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.xas.codec; 11 | 12 | import fuegocore.util.xas.ContentCodecFactory; 13 | import fuegocore.util.xas.ContentEncoder; 14 | import fuegocore.util.xas.ContentDecoder; 15 | 16 | /** 17 | * A default factory for typed content encoders and decoders. An object of this class is suitable to 18 | * use as the default {@link ContentCodecFactory} implementation. It recognizes some standard 19 | * structured Java types. 20 | */ 21 | public class DefaultCodecFactory extends ContentCodecFactory { 22 | 23 | private static ContentCodecFactory factory = new HashtableCodecFactory( 24 | new VectorCodecFactory( 25 | new EventSequenceCodecFactory())); 26 | 27 | 28 | @Override 29 | public ContentEncoder getChainedEncoder(ContentEncoder chain) { 30 | return factory.getChainedEncoder(chain); 31 | } 32 | 33 | 34 | @Override 35 | public ContentDecoder getChainedDecoder(ContentDecoder chain) { 36 | return factory.getChainedDecoder(chain); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/codec/EventSequenceCodecFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.xas.codec; 11 | 12 | import fuegocore.util.xas.ContentCodecFactory; 13 | import fuegocore.util.xas.ContentEncoder; 14 | import fuegocore.util.xas.ContentDecoder; 15 | import fuegocore.util.xas.Qname; 16 | import fuegocore.util.xas.XasUtil; 17 | 18 | /** 19 | * A typed content codec factory for the {@link fuegocore.util.xas.EventSequence} type. This 20 | * {@link ContentCodecFactory} builds encoders and decoders recognizing the 21 | * {@link fuegocore.util.xas.EventSequence} Java type. The XML name given for this type has 22 | * namespace {@link XasUtil#XAS_NAMESPACE} and local name "XmlEventSequence". This type 23 | * mapping is registered during initialization of the class. 24 | */ 25 | public class EventSequenceCodecFactory extends ContentCodecFactory { 26 | 27 | private ContentCodecFactory factory; 28 | 29 | static { 30 | try { 31 | ContentCodecFactory.addTypeMapping(Class.forName("fuegocore.util.xas.EventSequence"), 32 | new Qname(XasUtil.XAS_NAMESPACE, "XmlEventSequence")); 33 | } catch (Exception ex) { 34 | ex.printStackTrace(); 35 | } 36 | } 37 | 38 | 39 | public EventSequenceCodecFactory() { 40 | this(null); 41 | } 42 | 43 | 44 | public EventSequenceCodecFactory(ContentCodecFactory factory) { 45 | this.factory = factory; 46 | } 47 | 48 | 49 | @Override 50 | public ContentEncoder getChainedEncoder(ContentEncoder chain) { 51 | if (factory != null) { 52 | chain = factory.getChainedEncoder(chain); 53 | } 54 | return new EventSequenceEncoder(chain); 55 | } 56 | 57 | 58 | @Override 59 | public ContentDecoder getChainedDecoder(ContentDecoder chain) { 60 | if (factory != null) { 61 | chain = factory.getChainedDecoder(chain); 62 | } 63 | return new EventSequenceDecoder(chain); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/codec/EventSequenceEncoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.xas.codec; 11 | 12 | import java.io.IOException; 13 | 14 | import fuegocore.util.xas.ContentEncoder; 15 | import fuegocore.util.xas.ChainedContentEncoder; 16 | import fuegocore.util.xas.EventSequence; 17 | import fuegocore.util.xas.TypedXmlSerializer; 18 | import fuegocore.util.xas.XasUtil; 19 | import fuegocore.util.Util; 20 | 21 | /** 22 | * A typed content encoder for the {@link EventSequence} type. This class implements the 23 | * {@link ContentEncoder} interface for encoding {@link EventSequence} objects into XML. 24 | */ 25 | public class EventSequenceEncoder extends ChainedContentEncoder { 26 | 27 | public EventSequenceEncoder(ContentEncoder chain) { 28 | this.chain = chain; 29 | } 30 | 31 | 32 | public boolean encode(Object o, String namespace, String name, TypedXmlSerializer ser) 33 | throws IOException { 34 | boolean result = false; 35 | if (Util.equals(namespace, XasUtil.XAS_NAMESPACE) && Util.equals(name, "XmlEventSequence")) { 36 | if (o instanceof EventSequence) { 37 | // System.out.println("Encoding event sequence " + o); 38 | putTypeAttribute(namespace, name, ser); 39 | EventSequence e = (EventSequence) o; 40 | XasUtil.outputSequence(e, ser); 41 | result = true; 42 | } 43 | } else if (chain != null) { 44 | result = chain.encode(o, namespace, name, ser); 45 | } 46 | return result; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/codec/HashtableCodecFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.xas.codec; 11 | 12 | import fuegocore.util.xas.ContentCodecFactory; 13 | import fuegocore.util.xas.ContentEncoder; 14 | import fuegocore.util.xas.ContentDecoder; 15 | import fuegocore.util.xas.Qname; 16 | import fuegocore.util.xas.XasUtil; 17 | 18 | /** 19 | * A typed content codec factory for the {@link java.util.Hashtable} type. This 20 | * {@link ContentCodecFactory} builds encoders and decoders recognizing the 21 | * {@link java.util.Hashtable} Java type. The XML name given for this type has namespace 22 | * {@link XasUtil#XAS_NAMESPACE} and local name "hashtable". This type mapping is 23 | * registered during initialization of the class. 24 | */ 25 | public class HashtableCodecFactory extends ContentCodecFactory { 26 | 27 | private ContentCodecFactory factory; 28 | 29 | static { 30 | try { 31 | ContentCodecFactory.addTypeMapping(Class.forName("java.util.Hashtable"), 32 | new Qname(XasUtil.XAS_NAMESPACE, "hashtable")); 33 | } catch (Exception ex) { 34 | ex.printStackTrace(); 35 | } 36 | } 37 | 38 | 39 | public HashtableCodecFactory() { 40 | this(null); 41 | } 42 | 43 | 44 | public HashtableCodecFactory(ContentCodecFactory factory) { 45 | this.factory = factory; 46 | } 47 | 48 | 49 | @Override 50 | public ContentEncoder getChainedEncoder(ContentEncoder chain) { 51 | if (factory != null) { 52 | chain = factory.getChainedEncoder(chain); 53 | } 54 | return new HashtableEncoder(chain); 55 | } 56 | 57 | 58 | @Override 59 | public ContentDecoder getChainedDecoder(ContentDecoder chain) { 60 | if (factory != null) { 61 | chain = factory.getChainedDecoder(chain); 62 | } 63 | return new HashtableDecoder(chain); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/codec/HashtableDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.xas.codec; 11 | 12 | import java.util.Hashtable; 13 | 14 | import fuegocore.util.xas.ContentDecoder; 15 | import fuegocore.util.xas.ChainedContentDecoder; 16 | import fuegocore.util.xas.XmlReader; 17 | import fuegocore.util.xas.EventList; 18 | import fuegocore.util.xas.XasUtil; 19 | import fuegocore.util.Util; 20 | 21 | /** 22 | * A typed content decoder for the {@link Hashtable} type. This class extends the 23 | * {@link ContentDecoder} abstraction for decoding {@link Hashtable} objects from XML. 24 | */ 25 | public class HashtableDecoder extends ChainedContentDecoder { 26 | 27 | public HashtableDecoder(ContentDecoder chain) { 28 | super(null); 29 | if (chain == null) { throw new IllegalArgumentException("Chained decoder must be" 30 | + " non-null"); } 31 | this.chain = chain; 32 | } 33 | 34 | 35 | @Override 36 | public Object decode(String namespace, String name, XmlReader reader, EventList attributes) { 37 | Object result = null; 38 | if (Util.equals(namespace, XasUtil.XAS_NAMESPACE) && Util.equals(name, "hashtable")) { 39 | Hashtable h = new Hashtable(); 40 | Object key; 41 | while ((key = expect(XasUtil.XAS_NAMESPACE, "key", reader)) != null) { 42 | Object value = expect(XasUtil.XAS_NAMESPACE, "value", reader); 43 | if (value != null) { 44 | h.put(key, value); 45 | } 46 | } 47 | result = h; 48 | } else if (chain != null) { 49 | result = chain.decode(namespace, name, reader, attributes); 50 | } 51 | return result; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/codec/VectorCodecFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.xas.codec; 11 | 12 | import fuegocore.util.xas.ContentCodecFactory; 13 | import fuegocore.util.xas.ContentEncoder; 14 | import fuegocore.util.xas.ContentDecoder; 15 | import fuegocore.util.xas.Qname; 16 | import fuegocore.util.xas.XasUtil; 17 | 18 | /** 19 | * A typed content codec factory for the {@link java.util.Vector} type. This 20 | * {@link ContentCodecFactory} builds encoders and decoders recognizing the {@link java.util.Vector} 21 | * Java type. The XML name given for this type has namespace {@link XasUtil#XAS_NAMESPACE} and local 22 | * name "vector". This type mapping is registered during initialization of the class. 23 | */ 24 | public class VectorCodecFactory extends ContentCodecFactory { 25 | 26 | private ContentCodecFactory factory; 27 | 28 | static { 29 | try { 30 | ContentCodecFactory.addTypeMapping(Class.forName("java.util.Vector"), 31 | new Qname(XasUtil.XAS_NAMESPACE, "vector")); 32 | } catch (Exception ex) { 33 | ex.printStackTrace(); 34 | } 35 | } 36 | 37 | 38 | public VectorCodecFactory() { 39 | this(null); 40 | } 41 | 42 | 43 | public VectorCodecFactory(ContentCodecFactory factory) { 44 | this.factory = factory; 45 | } 46 | 47 | 48 | @Override 49 | public ContentEncoder getChainedEncoder(ContentEncoder chain) { 50 | if (factory != null) { 51 | chain = factory.getChainedEncoder(chain); 52 | } 53 | return new VectorEncoder(chain); 54 | } 55 | 56 | 57 | @Override 58 | public ContentDecoder getChainedDecoder(ContentDecoder chain) { 59 | if (factory != null) { 60 | chain = factory.getChainedDecoder(chain); 61 | } 62 | return new VectorDecoder(chain); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/codec/VectorDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2006 Helsinki Institute for Information Technology 3 | * 4 | * This file is a part of Fuego middleware. Fuego middleware is free software; you can redistribute 5 | * it and/or modify it under the terms of the MIT license, included as the file MIT-LICENSE in the 6 | * Fuego middleware source distribution. If you did not receive the MIT license with the 7 | * distribution, write to the Fuego Core project at fuego-core-users@hoslab.cs.helsinki.fi. 8 | */ 9 | 10 | package fuegocore.util.xas.codec; 11 | 12 | import java.util.Vector; 13 | 14 | import fuegocore.util.xas.ContentDecoder; 15 | import fuegocore.util.xas.ChainedContentDecoder; 16 | import fuegocore.util.xas.XmlReader; 17 | import fuegocore.util.xas.EventList; 18 | import fuegocore.util.xas.XasUtil; 19 | import fuegocore.util.Util; 20 | 21 | /** 22 | * A typed content decoder for the {@link Vector} type. This class extends the 23 | * {@link ContentDecoder} abstraction for decoding {@link Vector} objects from XML. 24 | */ 25 | public class VectorDecoder extends ChainedContentDecoder { 26 | 27 | public VectorDecoder(ContentDecoder chain) { 28 | super(null); 29 | if (chain == null) { throw new IllegalArgumentException("Chained decoder must be" 30 | + " non-null"); } 31 | this.chain = chain; 32 | } 33 | 34 | 35 | @Override 36 | public Object decode(String namespace, String name, XmlReader reader, EventList attributes) { 37 | Object result = null; 38 | if (Util.equals(namespace, XasUtil.XAS_NAMESPACE) && Util.equals(name, "vector")) { 39 | Vector v = new Vector(); 40 | Object item; 41 | while ((item = expect(XasUtil.XAS_NAMESPACE, "item", reader)) != null) { 42 | v.addElement(item); 43 | } 44 | result = v; 45 | } else if (chain != null) { 46 | result = chain.decode(namespace, name, reader, attributes); 47 | } 48 | return result; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/codec/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The fuegocore.util.xas.codec package 5 | 6 | 7 | 8 |

    9 | Typed content encoders and decoders for common Java types. This 10 | package contains classes implementing the {@link 11 | fuegocore.util.xas.ContentEncoder} and {@link 12 | fuegocore.util.xas.ContentDecoder} requirements for some common 13 | types. Types specific to the Fuego Core system components are 14 | handled in packages relevant to those components. 15 |

    16 | 17 |

    18 | This package also contains the {@link 19 | fuegocore.util.xas.codec.DefaultCodecFactory} class to be used 20 | as a default {@link fuegocore.util.xas.ContentCodecFactory}. It 21 | recognizes some useful Java types. 22 |

    23 | 24 | 25 | -------------------------------------------------------------------------------- /src/fuegocore/util/xas/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The fuegocore.util.xas package 5 | 6 | 7 | 8 |

    9 | Utilities for handling XML in programs. This package contains a 10 | generic event-sequence-based framework for programmatic use of 11 | XML. The intent is to support transparently through the same 12 | interfaces both reading and writing XML Infoset documents, 13 | regardless of how they are encoded as byte sequences. 14 |

    15 | 16 |

    17 | The underlying interfaces that the framework expects are the 18 | XmlPull org.xmlpull.v1.XmlPullParser for input and 19 | org.xmlpull.v1.XmlSerializer for output. These 20 | interfaces need to be implemented by new serialization formats. 21 |

    22 | 23 |

    24 | In actuality the output interface to implement is an extension 25 | of the XmlPull one, {@link fuegocore.util.xas.TypedXmlSerializer}, 26 | which provides a method for outputting typed content. The 27 | corresponding view on the parsing side is asymmetrically the 28 | {@link fuegocore.util.xas.TypedEventStream}. The best example 29 | source of using this feature is in the XAS unit test class 30 | {@link fuegocore.util.tests.XasTest}. 31 |

    32 | 33 | 34 | -------------------------------------------------------------------------------- /subproject.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | -------------------------------------------------------------------------------- /test/5l.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello 4 | World! 5 | -------------------------------------------------------------------------------- /test/5r.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello 4 | -------------------------------------------------------------------------------- /test/charset/fi/1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Örkki 4 | Lisäys 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/charset/fi/2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Päivitety örkki 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/charset/fi/b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Örkki 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /test/charset/fi/m.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Päivitety örkki 4 | Lisäys 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/faxma/greedy-fail/1.xml: -------------------------------------------------------------------------------- 1 | 2 | foobarquup 3 | -------------------------------------------------------------------------------- /test/faxma/greedy-fail/2.xml: -------------------------------------------------------------------------------- 1 | 2 | foobarquup 3 | -------------------------------------------------------------------------------- /test/faxma/greedy-fail/b.xml: -------------------------------------------------------------------------------- 1 | 2 | foobarquup 3 | -------------------------------------------------------------------------------- /test/faxma/greedy-fail/m.xml: -------------------------------------------------------------------------------- 1 | 2 | foobarquup 3 | -------------------------------------------------------------------------------- /test/ronnau-towards/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/ronnau-towards/README -------------------------------------------------------------------------------- /test/ronnau-towards/faxma.benchmark.UseCases: -------------------------------------------------------------------------------- 1 | # $Id: faxma.benchmark.UseCases,v 1.1 2006/03/21 16:48:02 ctl Exp $ 2 | # Run ronnau-towards cases 3 | # small 4 | basec=small-base.sxw 5 | newc=small-mindelta.sxw 6 | name=ss 7 | 1.basec=small-base.sxw 8 | 1.newc=small-mindelta.sxw 9 | 1.name=sm 10 | 2.basec=small-base.sxw 11 | 2.newc=small-maxdelta.sxw 12 | 2.name=sl 13 | # med 14 | 3.basec=medium-base.sxw 15 | 3.newc=medium-mindelta.sxw 16 | 3.name=ms 17 | 4.basec=medium-base.sxw 18 | 4.newc=medium-meddelta.sxw 19 | 4.name=mm 20 | 5.basec=medium-base.sxw 21 | 5.newc=medium-maxdelta.sxw 22 | 5.name=ml 23 | # max 24 | 6.basec=large-base.sxw 25 | 6.newc=large-mindelta.sxw 26 | 6.name=ls 27 | 7.basec=large-base.sxw 28 | 7.newc=large-meddelta.sxw 29 | 7.name=lm 30 | 8.basec=large-base.sxw 31 | 8.newc=large-maxdelta.sxw 32 | 8.name=ll 33 | 34 | -------------------------------------------------------------------------------- /test/ronnau-towards/large-base.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/ronnau-towards/large-base.sxw -------------------------------------------------------------------------------- /test/ronnau-towards/large-maxdelta.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/ronnau-towards/large-maxdelta.sxw -------------------------------------------------------------------------------- /test/ronnau-towards/large-meddelta.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/ronnau-towards/large-meddelta.sxw -------------------------------------------------------------------------------- /test/ronnau-towards/large-mindelta.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/ronnau-towards/large-mindelta.sxw -------------------------------------------------------------------------------- /test/ronnau-towards/medium-base.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/ronnau-towards/medium-base.sxw -------------------------------------------------------------------------------- /test/ronnau-towards/medium-maxdelta.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/ronnau-towards/medium-maxdelta.sxw -------------------------------------------------------------------------------- /test/ronnau-towards/medium-meddelta.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/ronnau-towards/medium-meddelta.sxw -------------------------------------------------------------------------------- /test/ronnau-towards/medium-mindelta.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/ronnau-towards/medium-mindelta.sxw -------------------------------------------------------------------------------- /test/ronnau-towards/small-base.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/ronnau-towards/small-base.sxw -------------------------------------------------------------------------------- /test/ronnau-towards/small-maxdelta.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/ronnau-towards/small-maxdelta.sxw -------------------------------------------------------------------------------- /test/ronnau-towards/small-meddelta.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/ronnau-towards/small-meddelta.sxw -------------------------------------------------------------------------------- /test/ronnau-towards/small-mindelta.sxw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/ronnau-towards/small-mindelta.sxw -------------------------------------------------------------------------------- /test/simple/diff/text1/1.xml: -------------------------------------------------------------------------------- 1 | 2 | Ehlo 3 | 4 | World 5 | 6 | Yieee! 7 | 8 | Serendipitous 9 | 10 | Another_add 11 | 12 | -------------------------------------------------------------------------------- /test/simple/diff/text1/README: -------------------------------------------------------------------------------- 1 | Simple diff case with changing text nodes 2 | -------------------------------------------------------------------------------- /test/simple/diff/text1/b.xml: -------------------------------------------------------------------------------- 1 | 2 | Ehlo 3 | 4 | World 5 | 6 | ! 7 | 8 | Serendipitous 9 | 10 | -------------------------------------------------------------------------------- /test/simple/diff/text2/1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/simple/diff/text2/README: -------------------------------------------------------------------------------- 1 | Simple case to test that attribute deletion is detected by diff 2 | (Tests for bug 060313-1) 3 | -------------------------------------------------------------------------------- /test/simple/diff/text2/b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/simple/diff/text3/1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Text 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/simple/diff/text3/1a.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Text 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/simple/diff/text3/b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Text 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/simple/diff/text3/ba.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Text 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /test/state/a10.fail: -------------------------------------------------------------------------------- 1 | 3dm fails 2 | -------------------------------------------------------------------------------- /test/state/a14.fail: -------------------------------------------------------------------------------- 1 | Copy case 2 | -------------------------------------------------------------------------------- /test/state/a17.fail: -------------------------------------------------------------------------------- 1 | Copy case 2 | -------------------------------------------------------------------------------- /test/state/a5.fail: -------------------------------------------------------------------------------- 1 | Copy case 2 | -------------------------------------------------------------------------------- /test/state/a6.fail: -------------------------------------------------------------------------------- 1 | Copy case 2 | -------------------------------------------------------------------------------- /test/state/a8.fail: -------------------------------------------------------------------------------- 1 | Copy case 2 | -------------------------------------------------------------------------------- /test/state/d4.fail: -------------------------------------------------------------------------------- 1 | 3dm fails 2 | -------------------------------------------------------------------------------- /test/state/f2.fail: -------------------------------------------------------------------------------- 1 | Copy case 2 | -------------------------------------------------------------------------------- /test/state/infopage1.ok: -------------------------------------------------------------------------------- 1 | Should resolve to one of the given cases 2 | -------------------------------------------------------------------------------- /test/state/infopage2.ok: -------------------------------------------------------------------------------- 1 | Should resolve to one of the given cases -------------------------------------------------------------------------------- /test/state/pdaedit.fail: -------------------------------------------------------------------------------- 1 | Truly broken by mismatch, diff broken 2 | -------------------------------------------------------------------------------- /test/state/shopping2.ok: -------------------------------------------------------------------------------- 1 | Should resolve to one of the given cases 2 | -------------------------------------------------------------------------------- /test/state/svgdoc.ok: -------------------------------------------------------------------------------- 1 | Should resolve to one of the given cases 2 | -------------------------------------------------------------------------------- /test/usecases/infopage1/1.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/usecases/infopage1/1.xml -------------------------------------------------------------------------------- /test/usecases/infopage1/2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Welcome to the homepage of 9 | 10 | 11 | 12 | 13 |

    Welcome to the homepage 14 | of

    15 | 16 |

    Maija 18 | Mellunmaki

    19 | 20 |

    Thank you for visiting my corner 21 | of the web! This is the first home page I have ever mad, hope 22 | you like it. I will add some more later on! For now, I can say 23 | that my hobbies include reading and growing roses.

    24 | 25 |

    List of best 26 | films

    27 | 28 |
      29 |
    • Sleepless in 30 | seattle
    • 31 | 32 |
    • Gone by the Wind
    • 33 | 34 |
    • Mission Impossinble 35 | 2
    • 36 | 37 |
    • Top Gun
    • 38 |
    39 | 40 |

    List of my favourite 41 | music

    42 | 43 |
      44 |
    • Mozart
    • 45 | 46 |
    • The Rolling Stones
    • 47 | 48 |
    • Leonard Cohen
    • 49 | 50 |
    • Toto
    • 51 | 52 |
    • Eurythmics
    • 53 |
    54 | 55 |

    I work as a techer at the elmentary 57 | school in 58 | Peraseinajoki.

    59 | 60 |

    If you want to contact me, call me 61 | at +358-12-34567890 or come visit at

    62 | 63 |

    Maija Mellunmaki
    64 | Takakatu 12 B 34
    65 | 01234 Peraseinajoki
    66 | Finland

    67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /test/usecases/infopage1/b.xml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ept/fuego-diff/fa0745ec0495aa94a6cfd4d45e06270152fb90fa/test/usecases/infopage1/b.xml -------------------------------------------------------------------------------- /test/usecases/infopage1/faxma.benchmark.UseCases: -------------------------------------------------------------------------------- 1 | # $Id: faxma.benchmark.UseCases,v 1.1 2006/03/22 09:33:17 ctl Exp $ 2 | # Run ronnau-towards cases 3 | # small 4 | base=b.xml 5 | new=1.xml 6 | name=personalia-personalia2 7 | 1.base=2.xml 8 | 1.new=m.xml 9 | 1.name=homepage-homepage2 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /test/usecases/infopage1/m.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Welcome to the homepage of 8 | 9 | 10 | 11 | 12 |

    Welcome to the homepage 13 | of

    14 | 15 |

    Maija 17 | Mellunmaki

    18 | 19 |

    Thank you for visiting my corner 20 | of the web! This is the first home page I have ever mad, hope 21 | you like it. I will add some more later on! For now, I can say 22 | that my hobbies include reading and growing roses.

    23 | 24 |

    List of best 25 | films

    26 | 27 |
      28 |
    • Sleepless in 29 | seattle
    • 30 | 31 |
    • Gone by the Wind
    • 32 | 33 |
    • Mission Impossinble 34 | 2
    • 35 | 36 |
    • Top Gun
    • 37 |
    38 | 39 |

    List of my favourite 40 | music

    41 | 42 |
      43 |
    • Mozart
    • 44 | 45 |
    • The Rolling Stones
    • 46 | 47 |
    • Leonard Cohen
    • 48 | 49 |
    • Toto
    • 50 | 51 |
    • Eurythmics
    • 52 |
    53 | 54 |

    I work as a techer at the elmentary 56 | school in 57 | Takaseinajoki.

    58 | 59 |

    If you want to contact me, call me 60 | at +358-12-34567777 or come visit at

    61 | 62 |

    Maija Mellunmaki
    63 | Etukatu 34 B 12
    64 | 04321 Takaseinajoki
    65 | Finland

    66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /test/usecases/infopage2/2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Our Dear Aunty Maija 8 | 9 | 10 | 11 |

    Our Dear Aunty 12 | Maija

    13 | 14 |
      15 |
    • Her birthday is January 26th, don't 16 | forget!. She was born in 1965, so she'll be 35 in 2000.
    • 17 | 18 |
    • In 98 she gave us an awful vase, but we 19 | pretend to like it.
    • 20 |
    21 | 22 |

    Her contact information

    23 | 24 |

    Tel: +358-12-34567890

    25 | 26 |

    Addess:

    27 | 28 |

    Maija Mellunmäki
    29 | Takakatu 12 B 34
    30 | 01234 Peräseinäjoki
    31 | Finland

    32 | 33 |

    Her favourite music is (from her webpage:)

    34 | 35 |
      36 |
    • Mozart
    • 37 | 38 |
    • The Rolling Stones
    • 39 | 40 |
    • Leonard Cohen
    • 41 | 42 |
    • Toto
    • 43 | 44 |
    • Eurythmics
    • 45 |
    46 |
    47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /test/usecases/infopage2/faxma.benchmark.UseCases: -------------------------------------------------------------------------------- 1 | # $Id: faxma.benchmark.UseCases,v 1.1 2006/03/22 09:33:17 ctl Exp $ 2 | # Run ronnau-towards cases 3 | # small 4 | base=b.xml 5 | new=1.xml 6 | name=b-1 7 | 1.base=2.xml 8 | 1.new=m.xml 9 | 1.name=2-m 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /test/usecases/infopage2/m.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Our Dear Aunty Maija 7 | 8 | 9 | 10 |

    Our Dear Aunty 11 | Maija

    12 | 13 |
      14 |
    • Her birthday is January 26th, don't 15 | forget!. She was born in 1965, so she'll be 35 in 2000.
    • 16 | 17 |
    • In 98 she gave us an awful vase, but we 18 | pretend to like it.
    • 19 |
    20 | 21 |

    Her contact information

    22 | 23 |

    Tel: +358-12-34567777

    24 | 25 |

    Addess:

    26 | 27 |

    Maija Mellunmäki
    28 | Etukatu 34 B 12
    29 | 04321 Takaseinäjoki
    30 | Finland

    31 | 32 |

    Her favourite music is (from her webpage:)

    33 | 34 |
      35 |
    • Mozart
    • 36 | 37 |
    • The Rolling Stones
    • 38 | 39 |
    • Leonard Cohen
    • 40 | 41 |
    • Eurythmics
    • 42 | 43 |
    • Ultra Bra
    • 44 | 45 |
    • Beatles
    • 46 | 47 | 48 |
    49 | 50 |
    51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /test/usecases/infopage2/m1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Our Dear Aunty Maija 9 | 10 | 11 | 12 |

    Our Dear Aunty 13 | Maija

    14 | 15 |
      16 |
    • Her birthday is January 26th, don't 17 | forget!. She was born in 1965, so she'll be 35 in 2000.
    • 18 | 19 |
    • In 98 she gave us an awful vase, but we 20 | pretend to like it.
    • 21 |
    22 | 23 |

    Her contact information

    24 | 25 |

    Tel: +358-12-34567890 26 | If you want to contact me, call me at >+358-12-34567777 or come visit at

    27 | 28 |

    Addess:

    29 | 30 |

    Maija Mellunmäki
    31 | Etukatu 34 B 12
    32 | 04321 Takaseinäjoki
    33 | Finland

    34 | 35 |

    Her favourite music is (from her webpage:)

    36 | 37 |
      38 |
    • Mozart
    • 39 | 40 |
    • The Rolling Stones
    • 41 | 42 |
    • Leonard Cohen
    • 43 | 44 |
    • Eurythmics
    • 45 | 46 |
    • Ultra Bra
    • 47 | 48 |
    • Beatles
    • 49 | 50 | 51 |
    52 | 53 |
    54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /test/usecases/infopage2/m2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Our Dear Aunty Maija 7 | 8 | 9 | 10 |

    Our Dear Aunty 11 | Maija

    12 | 13 |
      14 |
    • Her birthday is January 26th, don't 15 | forget!. She was born in 1965, so she'll be 35 in 2000.
    • 16 | 17 |
    • In 98 she gave us an awful vase, but we 18 | pretend to like it.
    • 19 |
    20 | 21 |

    Her contact information

    22 | 23 |

    Tel: +358-12-34567777

    24 | 25 |

    Addess:

    26 | 27 |

    Maija Mellunmäki
    28 | Etukatu 34 B 12
    29 | 04321 Takaseinäjoki
    30 | Finland

    31 | 32 |

    Her favourite music is (from her webpage:)

    33 | 34 |
      35 |
    • Mozart
    • 36 | 37 |
    • The Rolling Stones
    • 38 | 39 |
    • Leonard Cohen
    • 40 | 41 |
    • Eurythmics
    • 42 | 43 |
    • Ultra Bra
    • 44 | 45 |
    • Beatles
    • 46 | 47 | 48 |
    49 | 50 |
    51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /test/usecases/pdaedit/faxma.benchmark.UseCases: -------------------------------------------------------------------------------- 1 | # $Id: faxma.benchmark.UseCases,v 1.1 2006/03/22 09:33:17 ctl Exp $ 2 | # Run ronnau-towards cases 3 | # small 4 | base=b.xml 5 | new=1.xml 6 | name=b-1 7 | 1.base=2.xml 8 | 1.new=m.xml 9 | 1.name=2-m 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/usecases/review1/faxma.benchmark.UseCases: -------------------------------------------------------------------------------- 1 | # $Id: faxma.benchmark.UseCases,v 1.1 2006/03/22 09:33:18 ctl Exp $ 2 | # Run ronnau-towards cases 3 | # small 4 | base=b.xml 5 | new=1.xml 6 | 1.base=b.xml 7 | 1.new=2.xml 8 | 2.base=1.xml 9 | 2.new=m.xml 10 | 3.base=2.xml 11 | 3.new=m.xml 12 | 4.base=b.xml 13 | 4.new=m.xml 14 | 5.base=1.xml 15 | 5.new=2.xml 16 | #names 17 | name=b-1 18 | 1.name=b-2 19 | 2.name=1-m 20 | 3.name=2-m 21 | 4.name=b-m 22 | 5.name=1-2 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /test/usecases/review2/faxma.benchmark.UseCases: -------------------------------------------------------------------------------- 1 | # $Id: faxma.benchmark.UseCases,v 1.1 2006/03/22 09:33:18 ctl Exp $ 2 | base=b.xml 3 | new=1.xml 4 | 1.base=b.xml 5 | 1.new=2.xml 6 | 2.base=1.xml 7 | 2.new=m.xml 8 | 3.base=2.xml 9 | 3.new=m.xml 10 | 4.base=b.xml 11 | 4.new=m.xml 12 | 5.base=1.xml 13 | 5.new=2.xml 14 | #names 15 | name=b-1 16 | 1.name=b-2 17 | 2.name=1-m 18 | 3.name=2-m 19 | 4.name=b-m 20 | 5.name=1-2 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/usecases/shopping1/1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Emmentaler Cheese 7 | 500g 8 | 9 | 10 | 11 | 12 | Wheat toast 13 | 1 packet 14 | 15 | 16 | 17 | 18 | Smoked salmon 19 | 250g 20 | 21 | 22 | 23 | 24 | Apples 25 | 3 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/usecases/shopping1/2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Emmentaler Cheese 7 | 500g 8 | 9 | 10 | 11 | 12 | Wheat toast 13 | 1 packet 14 | 15 | 16 | 17 | 18 | Smoked salmon 19 | 250g 20 | 21 | 22 | 23 | 24 | Calvin & Hobbes Comic (for Kalle's Xmas party!) 25 | 1 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /test/usecases/shopping1/b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Emmentaler Cheese 7 | 500g 8 | 9 | 10 | 11 | 12 | Wheat toast 13 | 1 packet 14 | 15 | 16 | 17 | 18 | Smoked salmon 19 | 250g 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/usecases/shopping1/faxma.benchmark.UseCases: -------------------------------------------------------------------------------- 1 | # $Id: faxma.benchmark.UseCases,v 1.1 2006/03/22 09:33:18 ctl Exp $ 2 | base=b.xml 3 | new=1.xml 4 | 1.base=b.xml 5 | 1.new=2.xml 6 | 2.base=1.xml 7 | 2.new=m.xml 8 | 3.base=2.xml 9 | 3.new=m.xml 10 | 4.base=b.xml 11 | 4.new=m.xml 12 | 5.base=1.xml 13 | 5.new=2.xml 14 | #names 15 | name=b-1 16 | 1.name=b-2 17 | 2.name=1-m 18 | 3.name=2-m 19 | 4.name=b-m 20 | 5.name=1-2 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/usecases/shopping1/m.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Emmentaler Cheese 9 | 500g 10 | 11 | 12 | 13 | 14 | Wheat toast 15 | 1 packet 16 | 17 | 18 | 19 | 20 | Smoked salmon 21 | 250g 22 | 23 | 24 | 25 | 26 | Apples 27 | 3 28 | 29 | 30 | 31 | 32 | Calvin & Hobbes Comic (for Kalle's Xmas party!) 33 | 1 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /test/usecases/shopping1/m1.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Emmentaler Cheese 9 | 500g 10 | 11 | 12 | 13 | 14 | Wheat toast 15 | 1 packet 16 | 17 | 18 | 19 | 20 | Smoked salmon 21 | 250g 22 | 23 | 24 | 25 | 26 | Calvin & Hobbes Comic (for Kalle's Xmas party!) 27 | 1 28 | 29 | 30 | 31 | 32 | Apples 33 | 3 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /test/usecases/shopping2/1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Emmentaler Cheese 7 | 500g 8 | 3.12 9 | LMart 10 | 11 | 12 | Wheat toast 13 | 1 packet 14 | 0.66 15 | LMart 16 | 17 | 18 | Smoked salmon 19 | 250g 20 | 2.55 21 | LMart 22 | 23 | 24 | Orange juice 25 | 2l 26 | 1.96 27 | LMart 28 | 29 | 30 | Toilet paper 31 | 1 packet 32 | 3.80 33 | LMart 34 | 35 | 36 | -------------------------------------------------------------------------------- /test/usecases/shopping2/2.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | Emmentaler Cheese 9 | 500g 10 | 11 | 12 | 13 | 14 | Wheat toast 15 | 1 packet 16 | 17 | 18 | 19 | 20 | Smoked salmon 21 | 250g 22 | 23 | 24 | 25 | 26 | Apples 27 | 3 28 | 29 | 30 | 31 | 32 | Calvin & Hobbes Comic (for Kalle's Xmas party!) 33 | 1 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /test/usecases/shopping2/b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Emmentaler Cheese 7 | 500g 8 | 9 | 10 | 11 | 12 | Wheat toast 13 | 1 packet 14 | 15 | 16 | 17 | 18 | Smoked salmon 19 | 250g 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/usecases/shopping2/faxma.benchmark.UseCases: -------------------------------------------------------------------------------- 1 | # $Id: faxma.benchmark.UseCases,v 1.1 2006/03/22 09:33:19 ctl Exp $ 2 | base=b.xml 3 | new=1.xml 4 | 1.base=b.xml 5 | 1.new=2.xml 6 | 2.base=1.xml 7 | 2.new=m.xml 8 | 3.base=2.xml 9 | 3.new=m.xml 10 | 4.base=b.xml 11 | 4.new=m.xml 12 | 5.base=1.xml 13 | 5.new=2.xml 14 | #names 15 | name=b-1 16 | 1.name=b-2 17 | 2.name=1-m 18 | 3.name=2-m 19 | 4.name=b-m 20 | 5.name=1-2 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/usecases/shopping2/m.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | Emmentaler Cheese 8 | 500g 9 | 3.12 10 | LMart 11 | 12 | 13 | Wheat toast 14 | 1 packet 15 | 0.66 16 | LMart 17 | 18 | 19 | Smoked salmon 20 | 250g 21 | 2.55 22 | LMart 23 | 24 | 25 | Apples 26 | 3 27 | 28 | 29 | 30 | 31 | Calvin & Hobbes Comic (for Kalle's Xmas party!) 32 | 1 33 | 34 | 35 | 36 | 37 | Orange juice 38 | 2l 39 | 1.96 40 | LMart 41 | 42 | 43 | Toilet paper 44 | 1 packet 45 | 3.80 46 | LMart 47 | 48 | 49 | -------------------------------------------------------------------------------- /test/usecases/svgdoc/faxma.benchmark.UseCases: -------------------------------------------------------------------------------- 1 | # $Id: faxma.benchmark.UseCases,v 1.1 2006/03/22 09:33:19 ctl Exp $ 2 | base=b.xml 3 | new=1.xml 4 | 1.base=b.xml 5 | 1.new=2.xml 6 | 2.base=1.xml 7 | 2.new=m.xml 8 | 3.base=2.xml 9 | 3.new=m.xml 10 | 4.base=b.xml 11 | 4.new=m.xml 12 | 5.base=1.xml 13 | 5.new=2.xml 14 | #names 15 | name=b-1 16 | 1.name=b-2 17 | 2.name=1-m 18 | 3.name=2-m 19 | 4.name=b-m 20 | 5.name=1-2 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/usecases/xml-shorttag-trickery/1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/usecases/xml-shorttag-trickery/2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/usecases/xml-shorttag-trickery/b.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/usecases/xml-shorttag-trickery/m.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | --------------------------------------------------------------------------------