You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2013/09/09 13:20:05 UTC

[05/15] cut down the included source code from javolution (no more OSGi dependencies) and updated NOTICE and LICENSE files in source root

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/XMLContextImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/XMLContextImpl.java b/commons/marmotta-commons/src/ext/java/javolution/xml/internal/XMLContextImpl.java
deleted file mode 100644
index d4a3f6b..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/XMLContextImpl.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
- * Copyright (C) 2012 - Javolution (http://javolution.org/)
- * All rights reserved.
- * 
- * Permission to use, copy, modify, and distribute this software is
- * freely granted, provided that this notice is preserved.
- */
-package javolution.xml.internal;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-
-import javolution.util.FastMap;
-import javolution.xml.DefaultXMLFormat;
-import javolution.xml.XMLContext;
-import javolution.xml.XMLFormat;
-import javolution.xml.stream.XMLStreamException;
-
-/**
- * Holds the default implementation of XMLContext.
- * 
- * @author  <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @version 6.0, July 21, 2013
- */
-@SuppressWarnings("rawtypes")
-public final class XMLContextImpl extends XMLContext {
-
-    private final FastMap<Class<?>, XMLFormat<?>> formats = new FastMap<Class<?>, XMLFormat<?>>();
-
-    @Override
-    protected XMLContext inner() {
-        XMLContextImpl ctx = new XMLContextImpl();
-        ctx.formats.putAll(formats);
-        return ctx;
-    }
-
-    @SuppressWarnings("unchecked")
-    @Override
-    protected <T> XMLFormat<T> searchFormat(Class<? extends T> type) {
-        XMLFormat xml = formats.get(type);
-        if (xml != null)
-            return xml;
-        DefaultXMLFormat format = type.getAnnotation(DefaultXMLFormat.class);
-        if (format != null) {
-            Class<? extends XMLFormat> formatClass = format.value();
-            try {
-                xml = formatClass.newInstance();
-                synchronized (formats) { // Required since possible concurrent use 
-                    // (getFormatInContext is not a configuration method).
-                    formats.put(type, xml);
-                }
-                return xml;
-            } catch (Throwable ex) {
-                throw new RuntimeException(ex);
-            }
-        }
-        // Check predefined format as last resource.
-        if (Map.class.isAssignableFrom(type))
-            return MAP_XML;
-        if (Collection.class.isAssignableFrom(type))
-            return COLLECTION_XML;
-        return OBJECT_XML;
-    }
-
-    @Override
-    public <T> void setFormat(Class<? extends T> type, XMLFormat<T> format) {
-        formats.put(type, format);
-    }
-
-    /////////////////////////
-    // PREDEFINED FORMATS  //
-    /////////////////////////
-    /**
-     * Holds the static XML format for <code>java.lang.Object.class</code> instances.
-     * The XML representation consists of the text representation of the object
-     * as a "value" attribute.
-     */
-    private static final XMLFormat OBJECT_XML = new XMLFormat.Default();
-
-    /**
-     * Holds the default XML representation for <code>java.util.Collection</code>
-     * instances. This representation consists of nested XML elements one for
-     * each element of the collection. The elements' order is defined by
-     * the collection iterator order. Collections are deserialized using their
-     * default constructor.
-     */
-    private static final XMLFormat COLLECTION_XML = new XMLFormat() {
-
-        @SuppressWarnings("unchecked")
-        public void read(XMLFormat.InputElement xml, Object obj)
-                throws XMLStreamException {
-            Collection collection = (Collection) obj;
-            while (xml.hasNext()) {
-                collection.add(xml.getNext());
-            }
-        }
-
-        public void write(Object obj, XMLFormat.OutputElement xml)
-                throws XMLStreamException {
-            Collection collection = (Collection) obj;
-            for (Iterator i = collection.iterator(); i.hasNext();) {
-                xml.add(i.next());
-            }
-        }
-
-    };
-
-    /**
-     * Holds the default XML representation for <code>java.util.Map</code>
-     * instances. This representation consists of key/value pair as nested
-     * XML elements. For example:[code]
-     * <javolution.util.FastMap>
-     *     <Key class="java.lang.String" value="ONE"/>
-     *     <Value class="java.lang.Integer" value="1"/>
-     *     <Key class="java.lang.String" value="TWO"/>
-     *     <Value class="java.lang.Integer" value="2"/>
-     *     <Key class="java.lang.String" value="THREE"/>
-     *     <Value class="java.lang.Integer" value="3"/>
-     * </javolution.util.FastMap>[/code]
-     *
-     * The elements' order is defined by the map's entries iterator order.
-     * Maps are deserialized using their default constructor.
-     */
-    private static final XMLFormat MAP_XML = new XMLFormat() {
-
-        @SuppressWarnings("unchecked")
-        public void read(XMLFormat.InputElement xml, Object obj)
-                throws XMLStreamException {
-            final Map map = (Map) obj;
-            while (xml.hasNext()) {
-                Object key = xml.get("Key");
-                Object value = xml.get("Value");
-                map.put(key, value);
-            }
-        }
-
-        public void write(Object obj, XMLFormat.OutputElement xml)
-                throws XMLStreamException {
-            final Map map = (Map) obj;
-            for (Iterator it = map.entrySet().iterator(); it.hasNext();) {
-                Map.Entry entry = (Map.Entry) it.next();
-                xml.add(entry.getKey(), "Key");
-                xml.add(entry.getValue(), "Value");
-            }
-        }
-
-    };
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/AttributesImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/AttributesImpl.java b/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/AttributesImpl.java
deleted file mode 100644
index 9953441..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/AttributesImpl.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package javolution.xml.internal.stream;
-
-import javolution.text.CharArray;
-import javolution.util.FastTable;
-import javolution.xml.sax.Attributes;
-
-/**
- * This class provides the implementation of the {@link Attributes}
- * interface for the StAX parser. 
- */
-public final class AttributesImpl implements Attributes {
-
-    /**
-     * Attribute implementation.
-     */
-    private static class AttributeImpl {
-        CharArray localName;
-        CharArray prefix; // null if no namespace URI.
-        CharArray qName;
-        CharArray value;
-        public String toString() {
-            return qName + "=" + value;
-        }
-    }
-
-    private static final CharArray CDATA = new CharArray("CDATA");
-
-    private static final CharArray EMPTY = new CharArray();
-
-    /**
-     * Holds the attributes.
-     */
-    private final FastTable<AttributeImpl> attributes = new FastTable<AttributeImpl>();
-
-    /**
-     * Holds the current number of attributes set.
-     */
-    private int length;
-
-    /**
-     * Holds the namespace stack.
-     */
-    private final NamespacesImpl namespaces;
-
-    /**
-     * Creates a list of attribute using the specified namespace stack.
-     */
-    public AttributesImpl(NamespacesImpl namespaces) {
-        this.namespaces = namespaces;
-    }
-
-    /**
-     * Adds an attribute to the end of the attribute list.
-     * 
-     * @param localName the local name.
-     * @param prefix the prefix or <code>null</code> if none.
-     * @param qName the qualified (prefixed) name.
-     * @param value the attribute value.
-     */
-    public void addAttribute(CharArray localName, CharArray prefix,
-            CharArray qName, CharArray value) {
-        AttributeImpl attribute;
-        if (length >= attributes.size()) {
-            attribute = new AttributeImpl();
-            attributes.add(attribute);
-        } else {
-            attribute = attributes.get(length);
-        }
-        attribute.localName = localName;
-        attribute.prefix = prefix;
-        attribute.qName = qName;
-        attribute.value = value;
-        length++;
-    }
-
-    @Override
-    public int getIndex(CharSequence qName) {
-        for (int i = 0; i < length; i++) {
-            if (qName.equals(attributes.get(i).qName))
-                return i;
-        }
-        return -1;
-    }
-
-    @Override
-    public int getIndex(CharSequence uri, CharSequence localName) {
-        for (int i = 0; i < length; i++) {
-            AttributeImpl attribute = attributes.get(i);
-            if (localName.equals(attribute.localName)) {
-                if (attribute.prefix == null) { // No namespace URI.
-                    if (uri.length() == 0)
-                        return i;
-                } else { // Check if matching namespace URI.
-                    if (uri.equals(namespaces.getNamespaceURI(attribute.prefix)))
-                        return i;
-                }
-            }
-        }
-        return -1;
-    }
-
-    @Override
-    public int getLength() {
-        return length;
-    }
-
-    @Override
-    public CharArray getLocalName(int index) {
-        if ((index < 0) || (index >= length)) return null;
-        return attributes.get(index).localName;
-    }
-
-    public CharArray getPrefix(int index) {
-        if ((index < 0) || (index >= length)) return null;
-        return attributes.get(index).prefix;
-    }
-
-    @Override
-    public CharArray getQName(int index) {
-        if ((index < 0) || (index >= length)) return null;
-        return attributes.get(index).qName;
-    }
-
-    @Override
-    public CharArray getType(CharSequence qName) {
-        return (getIndex(qName) >= 0) ? CDATA : null;
-    }
-
-    @Override
-    public CharArray getType(CharSequence uri, CharSequence localName) {
-         return (getIndex(uri, localName) >= 0) ? CDATA : null;
-    }
-
-    @Override
-    public CharArray getType(int index) {
-        if ((index < 0) || (index >= length)) return null;
-        return CDATA;
-    }
-    @Override
-    public CharArray getURI(int index) {
-        if ((index < 0) || (index >= length)) return null;
-        CharArray prefix = attributes.get(index).prefix;
-        return (prefix == null) ? EMPTY : namespaces.getNamespaceURI(prefix);
-    }
-
-    @Override
-    public CharArray getValue(CharSequence qName) {
-        final int index = getIndex(qName);
-        return (index >= 0) ? attributes.get(index).value : null;
-    }
-
-    @Override
-    public CharArray getValue(CharSequence uri, CharSequence localName) {
-        final int index = getIndex(uri, localName);
-        return (index >= 0) ? attributes.get(index).value : null;
-    }
-
-    @Override
-    public CharArray getValue(int index) {
-        if ((index < 0) || (index >= length)) return null;
-        return attributes.get(index).value;
-    }
-
-    /**
-     * Clear the attribute list for reuse.
-     */
-    public void reset() {
-        length = 0;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/EntitiesImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/EntitiesImpl.java b/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/EntitiesImpl.java
deleted file mode 100644
index 72422d3..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/EntitiesImpl.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
- * Copyright (C) 2012 - Javolution (http://javolution.org/)
- * All rights reserved.
- * 
- * Permission to use, copy, modify, and distribute this software is
- * freely granted, provided that this notice is preserved.
- */
-package javolution.xml.internal.stream;
-
-import java.util.Map;
-
-import javolution.text.CharArray;
-import javolution.util.FastTable;
-import javolution.util.function.Function;
-import javolution.xml.stream.XMLStreamException;
-
-/**
- * Defines entities while parsing.
- *     
- * @author  <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @version 4.0, June 16, 2006
- */
-public final class EntitiesImpl {
-
-    /**
-     * Holds maximum length.
-     */
-    private int _maxLength = 1;
-
-    /**
-     * Holds the user defined entities mapping.
-     */
-    private Map<String, String> _entitiesMapping;
-
-    /**
-     * Default constructor.
-     */
-    EntitiesImpl() {}
-
-    /**
-     * Returns the length of the largest entity defined (default {@code 1}).
-     */
-    public int getMaxLength() {
-        return _maxLength;
-    }
-
-    /**
-     * Replaces the entity at the specified position. 
-     * The five predefined XML entities "&#38;lt;", "&#38;gt;", "&#38;apos;",
-     * "&#38;quot;", "&#38;amp;" as well as character refererences 
-     * (decimal or hexadecimal) are always recognized.
-     * 
-     * @param buffer the data buffer.
-     * @param start the index of entity first character (index of '&')
-     * @return the length of the replacement entity (including ';') 
-     * @throws XMLStreamException if the entity is not recognized.
-     */
-    public int replaceEntity(char[] buffer, int start, int length)
-            throws XMLStreamException {
-
-        // Checks for character references.
-        if (buffer[start + 1] == '#') {
-            char c = buffer[start + 2];
-            int base = (c == 'x') ? 16 : 10;
-            int i = (c == 'x') ? 3 : 2;
-            int charValue = 0;
-            for (; i < length - 1; i++) {
-                c = buffer[start + i];
-                charValue *= base;
-                charValue += (c <= '9') ? (c - '0') : (c <= 'Z') ? c - 'A'
-                        : c - 'a';
-            }
-            buffer[start] = (char) charValue;
-            return 1;
-        }
-
-        if ((buffer[start + 1] == 'l') && (buffer[start + 2] == 't')
-                && (buffer[start + 3] == ';')) {
-            buffer[start] = '<';
-            return 1;
-        }
-
-        if ((buffer[start + 1] == 'g') && (buffer[start + 2] == 't')
-                && (buffer[start + 3] == ';')) {
-            buffer[start] = '>';
-            return 1;
-        }
-
-        if ((buffer[start + 1] == 'a') && (buffer[start + 2] == 'p')
-                && (buffer[start + 3] == 'o') && (buffer[start + 4] == 's')
-                && (buffer[start + 5] == ';')) {
-            buffer[start] = '\'';
-            return 1;
-        }
-
-        if ((buffer[start + 1] == 'q') && (buffer[start + 2] == 'u')
-                && (buffer[start + 3] == 'o') && (buffer[start + 4] == 't')
-                && (buffer[start + 5] == ';')) {
-            buffer[start] = '"';
-            return 1;
-        }
-
-        if ((buffer[start + 1] == 'a') && (buffer[start + 2] == 'm')
-                && (buffer[start + 3] == 'p') && (buffer[start + 4] == ';')) {
-            buffer[start] = '&';
-            return 1;
-        }
-
-        // Searches user defined entities.
-        _tmp.setArray(buffer, start + 1, length - 2);
-        CharSequence replacementText = (_entitiesMapping != null) ?  _entitiesMapping
-                .get(_tmp) : null;
-        if (replacementText == null)
-            throw new XMLStreamException("Entity " + _tmp + " not recognized");
-        int replacementTextLength = replacementText.length();
-        for (int i = 0; i < replacementTextLength; i++) {
-            buffer[start + i] = replacementText.charAt(i);
-        }
-        return replacementTextLength;
-    }
-
-    private CharArray _tmp = new CharArray();
-
-    /**
-     * Sets the current custom entity mapping. For example: {@code 
-     * new FastMap().put("copy", "©")} to define the copyright entity.
-     */
-    public void setEntitiesMapping(Map<String, String> entityToReplacementText) {
-        FastTable<String> values = new FastTable<String>();
-        values.addAll(entityToReplacementText.values());
-        _maxLength = values.mapped(new Function<CharSequence, Integer>() {
-
-            @Override
-            public Integer apply(CharSequence csq) {
-                return csq.length();
-            }}).max();
-        
-          _entitiesMapping = entityToReplacementText;
-    }
-
-    /**
-     * Returns the custom entity mapping or {@code null} if none.
-     */
-    public Map<String, String> getEntitiesMapping() {
-        return _entitiesMapping;
-    }
-
-    // Implements Reusable.
-    public void reset() {
-        _maxLength = 1;
-        _entitiesMapping = null;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/NamespacesImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/NamespacesImpl.java b/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/NamespacesImpl.java
deleted file mode 100644
index 47ff23b..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/NamespacesImpl.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
- * Copyright (C) 2012 - Javolution (http://javolution.org/)
- * All rights reserved.
- * 
- * Permission to use, copy, modify, and distribute this software is
- * freely granted, provided that this notice is preserved.
- */
-package javolution.xml.internal.stream;
-
-import java.util.Iterator;
-import javolution.text.CharArray;
-import javolution.util.FastTable;
-import javolution.xml.stream.NamespaceContext;
-
-/**
- * This class represents the namespaces stack while parsing.
- *
- * @author  <a href="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
- * @version 3.2, April 2, 2005
- */
-public final class NamespacesImpl implements NamespaceContext {
-
-    /** 
-     * Holds the number of predefined namespaces.
-     */
-    static final int NBR_PREDEFINED_NAMESPACES = 3;
-
-    /** 
-     * Holds useful CharArray instances (non-static to avoid potential 
-     * inter-thread corruption).
-     */
-    final CharArray _nullNsURI = new CharArray(""); // No namespace URI.
-
-    final CharArray _defaultNsPrefix = new CharArray("");
-
-    final CharArray _xml = new CharArray("xml");
-
-    final CharArray _xmlURI = new CharArray(
-            "http://www.w3.org/XML/1998/namespace");
-
-    final CharArray _xmlns = new CharArray("xmlns");
-
-    final CharArray _xmlnsURI = new CharArray("http://www.w3.org/2000/xmlns/");
-
-    /** 
-     * Holds the current nesting level.
-     */
-    private int _nesting = 0;
-
-    /** 
-     * Holds the currently mapped prefixes.
-     */
-    CharArray[] _prefixes = new CharArray[16];
-
-    /** 
-     * Holds the currently mapped namespaces.
-     */
-    CharArray[] _namespaces = new CharArray[_prefixes.length];
-
-    /** 
-     * Indicates if the prefix has to been written (when writing).
-     */
-    boolean[] _prefixesWritten = new boolean[_prefixes.length];
-
-    /** 
-     * Holds the number of prefix/namespace association per nesting level.
-     */
-    int[] _namespacesCount = new int[16];
-
-    /** 
-     * Holds the default namespace.
-     */
-    CharArray _defaultNamespace = _nullNsURI;
-
-    /** 
-     * Holds the default namespace index.
-     */
-    int _defaultNamespaceIndex;
-
-    /**
-     * Default constructor.
-     */
-    public NamespacesImpl() {
-        _prefixes[0] = _defaultNsPrefix;
-        _namespaces[0] = _nullNsURI;
-        _prefixes[1] = _xml;
-        _namespaces[1] = _xmlURI;
-        _prefixes[2] = _xmlns;
-        _namespaces[2] = _xmlnsURI;
-        _namespacesCount[0] = NBR_PREDEFINED_NAMESPACES;
-    }
-
-    // Implements NamespaceContext
-    public CharArray getNamespaceURI(CharSequence prefix) {
-        if (prefix == null)
-            throw new IllegalArgumentException("null prefix not allowed");
-        return getNamespaceURINullAllowed(prefix);
-    }
-
-    CharArray getNamespaceURINullAllowed(CharSequence prefix) {
-        if ((prefix == null) || (prefix.length() == 0))
-            return _defaultNamespace;
-        final int count = _namespacesCount[_nesting];
-        for (int i = count; --i >= 0;) {
-            if (_prefixes[i].equals(prefix))
-                return _namespaces[i];
-        }
-        return null; // Not bound.
-    }
-
-    // Implements NamespaceContext
-    public CharArray getPrefix(CharSequence uri) {
-        if (uri == null)
-            throw new IllegalArgumentException("null namespace URI not allowed");
-        return _defaultNamespace.equals(uri) ? _defaultNsPrefix : getPrefix(
-                uri, _namespacesCount[_nesting]);
-    }
-
-    CharArray getPrefix(CharSequence uri, int count) {
-        for (int i = count; --i >= 0;) {
-            CharArray prefix = _prefixes[i];
-            CharArray namespace = _namespaces[i];
-            if (namespace.equals(uri)) { // Find matching uri.
-                // Checks that the prefix has not been overwriten after being set.
-                boolean isPrefixOverwritten = false;
-                for (int j = i + 1; j < count; j++) {
-                    if (prefix.equals(_prefixes[j])) {
-                        isPrefixOverwritten = true;
-                        break;
-                    }
-                }
-                if (!isPrefixOverwritten)
-                    return prefix;
-            }
-        }
-        return null; // Not bound.
-    }
-
-    // Implements NamespaceContext
-    public Iterator<CharArray> getPrefixes(CharSequence namespaceURI) {
-        FastTable<CharArray> prefixes = new FastTable<CharArray>();
-        for (int i = _namespacesCount[_nesting]; --i >= 0;) {
-            if (_namespaces[i].equals(namespaceURI)) {
-                prefixes.add(_prefixes[i]);
-            }
-        }
-        return prefixes.iterator();
-    }
-
-    // Null values are not allowed.
-    void setPrefix(CharArray prefix, CharArray uri) {
-        int index = _namespacesCount[_nesting];
-        _prefixes[index] = prefix;
-        _namespaces[index] = uri;
-        if (prefix.length() == 0) { // The default namespace is set.
-            _defaultNamespaceIndex = index;
-            _defaultNamespace = uri;
-        }
-        if (++_namespacesCount[_nesting] >= _prefixes.length)
-            resizePrefixStack();
-    }
-
-    // Used only by XMLStreamWriter (converts CharSequence to CharArray).
-    // Null values are not allowed.
-    void setPrefix(final CharSequence prefix, CharSequence uri,
-            boolean isWritten) {
-        final int index = _namespacesCount[_nesting];
-        _prefixesWritten[index] = isWritten;
-        final int prefixLength = prefix.length();
-        CharArray prefixTmp = _prefixesTmp[index];
-        if ((prefixTmp == null) || (prefixTmp.array().length < prefixLength)) {
-            _prefixesTmp[index] = new CharArray().setArray(
-                    new char[prefixLength + 32], 0, 0);
-            prefixTmp = _prefixesTmp[index];
-        }
-        for (int i = 0; i < prefixLength; i++) {
-            prefixTmp.array()[i] = prefix.charAt(i);
-        }
-        prefixTmp.setArray(prefixTmp.array(), 0, prefixLength);
-
-        final int uriLength = uri.length();
-        CharArray namespaceTmp = _namespacesTmp[index];
-        if ((namespaceTmp == null) || (namespaceTmp.array().length < uriLength)) {
-            _namespacesTmp[index] = new CharArray().setArray(
-                    new char[uriLength + 32], 0, 0);
-            namespaceTmp = _namespacesTmp[index];
-        }
-        for (int i = 0; i < uriLength; i++) {
-            namespaceTmp.array()[i] = uri.charAt(i);
-        }
-        namespaceTmp.setArray(namespaceTmp.array(), 0, uriLength);
-
-        // Sets the prefix using CharArray instances.
-        setPrefix(prefixTmp, namespaceTmp);
-    }
-
-    private CharArray[] _prefixesTmp = new CharArray[_prefixes.length];
-
-    private CharArray[] _namespacesTmp = new CharArray[_prefixes.length];
-
-    void pop() {
-        if (_namespacesCount[--_nesting] <= _defaultNamespaceIndex) {
-            searchDefaultNamespace();
-        }
-    }
-
-    private void searchDefaultNamespace() {
-        int count = _namespacesCount[_nesting];
-        for (int i = count; --i >= 0;) {
-            if (_prefixes[i].length() == 0) {
-                _defaultNamespaceIndex = i;
-                return;
-            }
-        }
-        throw new Error("Cannot find default namespace");
-    }
-
-    void push() {
-        _nesting++;
-        if (_nesting >= _namespacesCount.length) {
-            resizeNamespacesCount();
-        }
-        _namespacesCount[_nesting] = _namespacesCount[_nesting - 1];
-    }
-
-    public void reset() {
-        _defaultNamespace = _nullNsURI;
-        _defaultNamespaceIndex = 0;
-        _namespacesCount[0] = NBR_PREDEFINED_NAMESPACES;
-        _nesting = 0;
-    }
-
-    private void resizeNamespacesCount() {
-        final int oldLength = _namespacesCount.length;
-        final int newLength = oldLength * 2;
-
-        // Resizes namespaces counts.
-        int[] tmp = new int[newLength];
-        System.arraycopy(_namespacesCount, 0, tmp, 0, oldLength);
-        _namespacesCount = tmp;
-    }
-
-    // Resizes prefix mapping  stack.
-    private void resizePrefixStack() {
-        final int oldLength = _prefixes.length;
-        final int newLength = oldLength * 2;
-
-        // Resizes prefixes.
-        CharArray[] tmp0 = new CharArray[newLength];
-        System.arraycopy(_prefixes, 0, tmp0, 0, oldLength);
-        _prefixes = tmp0;
-
-        // Resizes namespaces uri.
-        CharArray[] tmp1 = new CharArray[newLength];
-        System.arraycopy(_namespaces, 0, tmp1, 0, oldLength);
-        _namespaces = tmp1;
-
-        // Resizes prefix sets.
-        boolean[] tmp2 = new boolean[newLength];
-        System.arraycopy(_prefixesWritten, 0, tmp2, 0, oldLength);
-        _prefixesWritten = tmp2;
-
-        // Resizes temporary prefix (CharSequence to CharArray conversion).
-        CharArray[] tmp3 = new CharArray[newLength];
-        System.arraycopy(_prefixesTmp, 0, tmp3, 0, oldLength);
-        _prefixesTmp = tmp3;
-
-        // Resizes temporary namespaces (CharSequence to CharArray conversion).
-        CharArray[] tmp4 = new CharArray[newLength];
-        System.arraycopy(_namespacesTmp, 0, tmp4, 0, oldLength);
-        _namespacesTmp = tmp4;
-
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/XMLInputFactoryImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/XMLInputFactoryImpl.java b/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/XMLInputFactoryImpl.java
deleted file mode 100644
index bd2eaa2..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/XMLInputFactoryImpl.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
- * Copyright (C) 2012 - Javolution (http://javolution.org/)
- * All rights reserved.
- * 
- * Permission to use, copy, modify, and distribute this software is
- * freely granted, provided that this notice is preserved.
- */
-package javolution.xml.internal.stream;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.util.Map;
-
-import javolution.util.FastTable;
-import javolution.xml.stream.XMLInputFactory;
-import javolution.xml.stream.XMLStreamException;
-
-/**
- * The default XML input factory implementation.
- */
-public final class XMLInputFactoryImpl implements XMLInputFactory {
-    private Map<String, String> _entities = null;
-    private FastTable<XMLStreamReaderImpl> _recycled = new FastTable<XMLStreamReaderImpl>()
-            .shared();
-
-    // Implements XMLInputFactory abstract method.
-    public XMLStreamReaderImpl createXMLStreamReader(InputStream stream)
-            throws XMLStreamException {
-        XMLStreamReaderImpl xmlReader = newReader();
-        xmlReader.setInput(stream);
-        return xmlReader;
-    }
-
-    // Implements XMLInputFactory abstract method.
-    public XMLStreamReaderImpl createXMLStreamReader(InputStream stream,
-            String encoding) throws XMLStreamException {
-        XMLStreamReaderImpl xmlReader = newReader();
-        xmlReader.setInput(stream, encoding);
-        return xmlReader;
-    }
-
-    // Implements XMLInputFactory abstract method.
-    public XMLStreamReaderImpl createXMLStreamReader(Reader reader)
-            throws XMLStreamException {
-        XMLStreamReaderImpl xmlReader = newReader();
-        xmlReader.setInput(reader);
-        return xmlReader;
-    }
-
-    // Implements XMLInputFactory abstract method.
-    public Object getProperty(String name) throws IllegalArgumentException {
-        if (name.equals(IS_COALESCING)) {
-            return Boolean.TRUE;
-        } else if (name.equals(ENTITIES)) {
-            return _entities;
-        } else {
-            throw new IllegalArgumentException("Property: " + name
-                    + " not supported");
-        }
-    }
-
-    // Implements XMLInputFactory abstract method.
-    public boolean isPropertySupported(String name) {
-        return name.equals(IS_COALESCING) || name.equals(ENTITIES);
-    }
-
-    // Implements XMLInputFactory abstract method.
-    @SuppressWarnings("unchecked")
-    public void setProperty(String name, Object value)
-            throws IllegalArgumentException {
-        if (name.equals(IS_COALESCING)) {
-            // Do nothing, always coalescing.
-        } else if (name.equals(ENTITIES)) {
-            _entities = (Map<String, String>) value;
-        } else {
-            throw new IllegalArgumentException("Property: " + name
-                    + " not supported");
-        }
-    }
-
-    /** Recycles the specified instance. */
-    void recycle(XMLStreamReaderImpl reader) {
-        _recycled.addLast(reader);
-    }
-
-    private XMLStreamReaderImpl newReader() {
-        XMLStreamReaderImpl xmlReader = _recycled.pollLast();
-        if (xmlReader == null) xmlReader = new XMLStreamReaderImpl(this);
-        if (_entities != null) {
-            xmlReader.setEntities(_entities);
-        }
-        return xmlReader;
-    }
-    
-    @Override
-    public XMLInputFactory clone() {
-        try {
-            XMLInputFactoryImpl clone = (XMLInputFactoryImpl) super.clone();
-            clone._recycled = new FastTable<XMLStreamReaderImpl>().shared();
-            return clone;
-        } catch (CloneNotSupportedException e) {
-            throw new Error();// Cannot happen since cloneable.
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/e60b1a9a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/XMLOutputFactoryImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/XMLOutputFactoryImpl.java b/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/XMLOutputFactoryImpl.java
deleted file mode 100644
index 7dfd18f..0000000
--- a/commons/marmotta-commons/src/ext/java/javolution/xml/internal/stream/XMLOutputFactoryImpl.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
- * Copyright (C) 2012 - Javolution (http://javolution.org/)
- * All rights reserved.
- * 
- * Permission to use, copy, modify, and distribute this software is
- * freely granted, provided that this notice is preserved.
- */
-package javolution.xml.internal.stream;
-
-import java.io.OutputStream;
-import java.io.Writer;
-
-import javolution.util.FastTable;
-import javolution.xml.stream.XMLOutputFactory;
-import javolution.xml.stream.XMLStreamException;
-
-/**
- * This default XML Output factory implementation.
- */
-public final class XMLOutputFactoryImpl implements XMLOutputFactory {
-
-    // Property setting.
-    private Boolean _automaticEmptyElements = Boolean.FALSE;
-
-    // Property setting.
-    private String _indentation;
-
-    // Property setting.
-    private Boolean _isRepairingNamespaces = Boolean.FALSE;
-
-    // Property setting.
-    private String _lineSeparator = "\n";
-
-    // Property setting.
-    private Boolean _noEmptyElementTag = Boolean.FALSE;
-
-    // Property setting.
-    private String _repairingPrefix = "ns";
-
-    private FastTable<XMLStreamWriterImpl> _recycled = new FastTable<XMLStreamWriterImpl>()
-            .shared();
-
-    // Implements XMLOutputFactory abstract method.
-    public XMLStreamWriterImpl createXMLStreamWriter(OutputStream stream)
-            throws XMLStreamException {
-        XMLStreamWriterImpl xmlWriter = newWriter();
-        xmlWriter.setOutput(stream);
-        return xmlWriter;
-    }
-
-    // Implements XMLOutputFactory abstract method.
-    public XMLStreamWriterImpl createXMLStreamWriter(OutputStream stream,
-            String encoding) throws XMLStreamException {
-        if ((encoding == null) || encoding.equals("UTF-8")
-                || encoding.equals("utf-8"))
-            return createXMLStreamWriter(stream);
-        XMLStreamWriterImpl xmlWriter = newWriter();
-        xmlWriter.setOutput(stream, encoding);
-        return xmlWriter;
-    }
-
-    // Implements XMLOutputFactory abstract method.
-    public XMLStreamWriterImpl createXMLStreamWriter(Writer writer)
-            throws XMLStreamException {
-        XMLStreamWriterImpl xmlWriter = newWriter();
-        xmlWriter.setOutput(writer);
-        return xmlWriter;
-    }
-
-    // Implements XMLOutputFactory abstract method.
-    public Object getProperty(String name) throws IllegalArgumentException {
-        if (name.equals(IS_REPAIRING_NAMESPACES)) {
-            return _isRepairingNamespaces;
-        } else if (name.equals(REPAIRING_PREFIX)) {
-            return _repairingPrefix;
-        } else if (name.equals(AUTOMATIC_EMPTY_ELEMENTS)) {
-            return _automaticEmptyElements;
-        } else if (name.equals(NO_EMPTY_ELEMENT_TAG)) {
-            return _noEmptyElementTag;
-        } else if (name.equals(INDENTATION)) {
-            return _indentation;
-        } else if (name.equals(LINE_SEPARATOR)) {
-            return _lineSeparator;
-        } else {
-            throw new IllegalArgumentException("Property: " + name
-                    + " not supported");
-        }
-    }
-
-    // Implements XMLOutputFactory abstract method.
-    public boolean isPropertySupported(String name) {
-        return name.equals(IS_REPAIRING_NAMESPACES)
-                || name.equals(REPAIRING_PREFIX)
-                || name.equals(AUTOMATIC_EMPTY_ELEMENTS)
-                || name.equals(NO_EMPTY_ELEMENT_TAG)
-                || name.equals(INDENTATION) || name.equals(LINE_SEPARATOR);
-    }
-
-    // Implements XMLOutputFactory abstract method.
-    public void setProperty(String name, Object value)
-            throws IllegalArgumentException {
-        if (name.equals(IS_REPAIRING_NAMESPACES)) {
-            _isRepairingNamespaces = (Boolean) value;
-        } else if (name.equals(REPAIRING_PREFIX)) {
-            _repairingPrefix = (String) value;
-        } else if (name.equals(AUTOMATIC_EMPTY_ELEMENTS)) {
-            _automaticEmptyElements = (Boolean) value;
-        } else if (name.equals(NO_EMPTY_ELEMENT_TAG)) {
-            _noEmptyElementTag = (Boolean) value;
-        } else if (name.equals(INDENTATION)) {
-            _indentation = (String) value;
-        } else if (name.equals(LINE_SEPARATOR)) {
-            _lineSeparator = (String) value;
-        } else {
-            throw new IllegalArgumentException("Property: " + name
-                    + " not supported");
-        }
-    }
-
-    /**
-     * Recycles the specified writer instance.
-     */
-    void recycle(XMLStreamWriterImpl xmlWriter) {
-        _recycled.addLast(xmlWriter);
-    }
-
-    private XMLStreamWriterImpl newWriter() {
-        XMLStreamWriterImpl xmlWriter = _recycled.pollLast();
-        if (xmlWriter == null) xmlWriter = new XMLStreamWriterImpl(this);
-        xmlWriter.setRepairingNamespaces(_isRepairingNamespaces.booleanValue());
-        xmlWriter.setRepairingPrefix(_repairingPrefix);
-        xmlWriter.setIndentation(_indentation);
-        xmlWriter.setLineSeparator(_lineSeparator);
-        xmlWriter.setAutomaticEmptyElements(_automaticEmptyElements
-                .booleanValue());
-        xmlWriter.setNoEmptyElementTag(_noEmptyElementTag.booleanValue());
-        return xmlWriter;
-    }
-    
-    @Override
-    public XMLOutputFactory clone() {
-        try {
-            XMLOutputFactoryImpl clone = (XMLOutputFactoryImpl) super.clone();
-            clone._recycled = new FastTable<XMLStreamWriterImpl>().shared();
-            return clone;
-        } catch (CloneNotSupportedException e) {
-            throw new Error();// Cannot happen since cloneable.
-        }
-    }
-}