Java Code Examples for com.sun.org.apache.xml.internal.dtm.DTMManager

The following examples show how to use com.sun.org.apache.xml.internal.dtm.DTMManager. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: openjdk-jdk9   Source File: SAX2DTM.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Get a new DTM ID beginning at the specified node index.
 * @param  nodeIndex The node identity at which the new DTM ID will begin
 * addressing.
 */
protected void addNewDTMID(int nodeIndex) {
  try
  {
    if(m_mgr==null)
      throw new ClassCastException();

                            // Handle as Extended Addressing
    DTMManagerDefault mgrD=(DTMManagerDefault)m_mgr;
    int id=mgrD.getFirstFreeDTMID();
    mgrD.addDTM(this,id,nodeIndex);
    m_dtmIdent.addElement(id<<DTMManager.IDENT_DTM_NODE_BITS);
  }
  catch(ClassCastException e)
  {
    // %REVIEW% Wrong error message, but I've been told we're trying
    // not to add messages right not for I18N reasons.
    // %REVIEW% Should this be a Fatal Error?
    error(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null));//"No more DTM IDs are available";
  }
}
 
Example 2
Source Project: jdk1.8-source-analysis   Source File: MultiDOM.java    License: Apache License 2.0 6 votes vote down vote up
public void removeDOMAdapter(DOMAdapter adapter) {
    _documents.remove(adapter.getDocumentURI(0));
    DOM dom = adapter.getDOMImpl();

    if (dom instanceof DTMDefaultBase) {
        SuballocatedIntVector ids = ((DTMDefaultBase) dom).getDTMIDs();
        int idsSize = ids.size();
        for (int i = 0; i < idsSize; i++) {
            _adapters[ids.elementAt(i) >>> DTMManager.IDENT_DTM_NODE_BITS] = null;
        }
    } else {
        int id = dom.getDocument() >>> DTMManager.IDENT_DTM_NODE_BITS;
        if ((id > 0) && (id < _adapters.length) && isMatchingAdapterEntry(_adapters[id], adapter)) {
            _adapters[id] = null;
        } else {
            boolean found = false;
            for (int i = 0; i < _adapters.length; i++) {
                if (isMatchingAdapterEntry(_adapters[id], adapter)) {
                    _adapters[i] = null;
                    found = true;
                    break;
                }
            }
        }
    }
}
 
Example 3
Source Project: Bytecoder   Source File: SAX2DTM.java    License: Apache License 2.0 6 votes vote down vote up
/**
  * Migrate a DTM built with an old DTMManager to a new DTMManager.
  * After the migration, the new DTMManager will treat the DTM as
  * one that is built by itself.
  * This is used to support DTM sharing between multiple transformations.
  * @param manager the DTMManager
  */
public void migrateTo(DTMManager manager) {
  super.migrateTo(manager);

  // We have to reset the information in m_dtmIdent and
  // register the DTM with the new manager.
  int numDTMs = m_dtmIdent.size();
  int dtmId = m_mgrDefault.getFirstFreeDTMID();
  int nodeIndex = 0;
  for (int i = 0; i < numDTMs; i++)
  {
    m_dtmIdent.setElementAt(dtmId << DTMManager.IDENT_DTM_NODE_BITS, i);
    m_mgrDefault.addDTM(this, dtmId, nodeIndex);
    dtmId++;
    nodeIndex += (1 << DTMManager.IDENT_DTM_NODE_BITS);
  }
}
 
Example 4
Source Project: jdk1.8-source-analysis   Source File: SAX2DTM.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Get a new DTM ID beginning at the specified node index.
 * @param  nodeIndex The node identity at which the new DTM ID will begin
 * addressing.
 */
protected void addNewDTMID(int nodeIndex) {
  try
  {
    if(m_mgr==null)
      throw new ClassCastException();

                            // Handle as Extended Addressing
    DTMManagerDefault mgrD=(DTMManagerDefault)m_mgr;
    int id=mgrD.getFirstFreeDTMID();
    mgrD.addDTM(this,id,nodeIndex);
    m_dtmIdent.addElement(id<<DTMManager.IDENT_DTM_NODE_BITS);
  }
  catch(ClassCastException e)
  {
    // %REVIEW% Wrong error message, but I've been told we're trying
    // not to add messages right not for I18N reasons.
    // %REVIEW% Should this be a Fatal Error?
    error(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null));//"No more DTM IDs are available";
  }
}
 
Example 5
Source Project: jdk1.8-source-analysis   Source File: SAX2DTM.java    License: Apache License 2.0 6 votes vote down vote up
/**
  * Migrate a DTM built with an old DTMManager to a new DTMManager.
  * After the migration, the new DTMManager will treat the DTM as
  * one that is built by itself.
  * This is used to support DTM sharing between multiple transformations.
  * @param manager the DTMManager
  */
public void migrateTo(DTMManager manager) {
  super.migrateTo(manager);

  // We have to reset the information in m_dtmIdent and
  // register the DTM with the new manager.
  int numDTMs = m_dtmIdent.size();
  int dtmId = m_mgrDefault.getFirstFreeDTMID();
  int nodeIndex = 0;
  for (int i = 0; i < numDTMs; i++)
  {
    m_dtmIdent.setElementAt(dtmId << DTMManager.IDENT_DTM_NODE_BITS, i);
    m_mgrDefault.addDTM(this, dtmId, nodeIndex);
    dtmId++;
    nodeIndex += (1 << DTMManager.IDENT_DTM_NODE_BITS);
  }
}
 
Example 6
Source Project: TencentKona-8   Source File: LoadDocument.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
 * Create a DTMAxisIterator for the newdom. This is currently only
 * used to create an iterator for the cached stylesheet DOM.
 *
 * @param newdom the cached stylesheet DOM
 * @param translet the translet
 * @param the main dom (should be a MultiDOM)
 * @return a DTMAxisIterator from the document root
 */
private static DTMAxisIterator document(DOM newdom,
                                        AbstractTranslet translet,
                                        DOM dom)
    throws Exception
{
    DTMManager dtmManager = ((MultiDOM)dom).getDTMManager();
    // Need to migrate the cached DTM to the new DTMManager
    if (dtmManager != null && newdom instanceof DTM) {
        ((DTM)newdom).migrateTo(dtmManager);
    }

    translet.prepassDocument(newdom);

    // Wrap the DOM object in a DOM adapter and add to multiplexer
    final DOMAdapter domAdapter = translet.makeDOMAdapter(newdom);
    ((MultiDOM)dom).addDOMAdapter(domAdapter);

    // Create index for any key elements
    translet.buildKeys(domAdapter, null, null,
                       newdom.getDocument());

    // Return a singleton iterator containing the root node
    return new SingletonIterator(newdom.getDocument(), true);
}
 
Example 7
/**
 * Create a DTMAxisIterator for the newdom. This is currently only
 * used to create an iterator for the cached stylesheet DOM.
 *
 * @param newdom the cached stylesheet DOM
 * @param translet the translet
 * @param the main dom (should be a MultiDOM)
 * @return a DTMAxisIterator from the document root
 */
private static DTMAxisIterator document(DOM newdom,
                                        AbstractTranslet translet,
                                        DOM dom)
    throws Exception
{
    DTMManager dtmManager = ((MultiDOM)dom).getDTMManager();
    // Need to migrate the cached DTM to the new DTMManager
    if (dtmManager != null && newdom instanceof DTM) {
        ((DTM)newdom).migrateTo(dtmManager);
    }

    translet.prepassDocument(newdom);

    // Wrap the DOM object in a DOM adapter and add to multiplexer
    final DOMAdapter domAdapter = translet.makeDOMAdapter(newdom);
    ((MultiDOM)dom).addDOMAdapter(domAdapter);

    // Create index for any key elements
    translet.buildKeys(domAdapter, null, null,
                       newdom.getDocument());

    // Return a singleton iterator containing the root node
    return new SingletonIterator(newdom.getDocument(), true);
}
 
Example 8
Source Project: openjdk-jdk9   Source File: MultiDOM.java    License: GNU General Public License v2.0 6 votes vote down vote up
public DTMAxisIterator setStartNode(final int node) {
    if (node == DTM.NULL) {
        return this;
    }

    int dom = node >>> DTMManager.IDENT_DTM_NODE_BITS;

    // Get a new source first time and when mask changes
    if (_source == null || _dtmId != dom) {
        if (_type == NO_TYPE) {
            _source = _adapters[dom].getAxisIterator(_axis);
        } else if (_axis == Axis.CHILD) {
            _source = _adapters[dom].getTypedChildren(_type);
        } else {
            _source = _adapters[dom].getTypedAxisIterator(_axis, _type);
        }
    }

    _dtmId = dom;
    _source.setStartNode(node);
    return this;
}
 
Example 9
Source Project: JDKSourceCode1.8   Source File: MultiDOM.java    License: MIT License 6 votes vote down vote up
public DTMAxisIterator setStartNode(final int node) {
    if (node == DTM.NULL) {
        return this;
    }

    int dom = node >>> DTMManager.IDENT_DTM_NODE_BITS;

    // Get a new source first time and when mask changes
    if (_source == null || _dtmId != dom) {
        if (_type == NO_TYPE) {
            _source = _adapters[dom].getAxisIterator(_axis);
        } else if (_axis == Axis.CHILD) {
            _source = _adapters[dom].getTypedChildren(_type);
        } else {
            _source = _adapters[dom].getTypedAxisIterator(_axis, _type);
        }
    }

    _dtmId = dom;
    _source.setStartNode(node);
    return this;
}
 
Example 10
Source Project: TencentKona-8   Source File: SAX2DTM.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
  * Migrate a DTM built with an old DTMManager to a new DTMManager.
  * After the migration, the new DTMManager will treat the DTM as
  * one that is built by itself.
  * This is used to support DTM sharing between multiple transformations.
  * @param manager the DTMManager
  */
public void migrateTo(DTMManager manager) {
  super.migrateTo(manager);

  // We have to reset the information in m_dtmIdent and
  // register the DTM with the new manager.
  int numDTMs = m_dtmIdent.size();
  int dtmId = m_mgrDefault.getFirstFreeDTMID();
  int nodeIndex = 0;
  for (int i = 0; i < numDTMs; i++)
  {
    m_dtmIdent.setElementAt(dtmId << DTMManager.IDENT_DTM_NODE_BITS, i);
    m_mgrDefault.addDTM(this, dtmId, nodeIndex);
    dtmId++;
    nodeIndex += (1 << DTMManager.IDENT_DTM_NODE_BITS);
  }
}
 
Example 11
Source Project: openjdk-jdk8u-backup   Source File: SAX2DTM.java    License: GNU General Public License v2.0 6 votes vote down vote up
/**
  * Migrate a DTM built with an old DTMManager to a new DTMManager.
  * After the migration, the new DTMManager will treat the DTM as
  * one that is built by itself.
  * This is used to support DTM sharing between multiple transformations.
  * @param manager the DTMManager
  */
public void migrateTo(DTMManager manager) {
  super.migrateTo(manager);

  // We have to reset the information in m_dtmIdent and
  // register the DTM with the new manager.
  int numDTMs = m_dtmIdent.size();
  int dtmId = m_mgrDefault.getFirstFreeDTMID();
  int nodeIndex = 0;
  for (int i = 0; i < numDTMs; i++)
  {
    m_dtmIdent.setElementAt(dtmId << DTMManager.IDENT_DTM_NODE_BITS, i);
    m_mgrDefault.addDTM(this, dtmId, nodeIndex);
    dtmId++;
    nodeIndex += (1 << DTMManager.IDENT_DTM_NODE_BITS);
  }
}
 
Example 12
Source Project: openjdk-jdk8u   Source File: XNodeSetForDOM.java    License: GNU General Public License v2.0 5 votes vote down vote up
public XNodeSetForDOM(Node node, DTMManager dtmMgr)
{
  m_dtmMgr = dtmMgr;
  m_origObj = node;
  int dtmHandle = dtmMgr.getDTMHandleFromNode(node);
  setObject(new NodeSetDTM(dtmMgr));
  ((NodeSetDTM) m_obj).addNode(dtmHandle);
}
 
Example 13
Source Project: jdk1.8-source-analysis   Source File: MultiDOM.java    License: Apache License 2.0 5 votes vote down vote up
public int getExpandedTypeID(final int node) {
    if (node != DTM.NULL) {
        return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getExpandedTypeID(node);
    }
    else {
        return DTM.NULL;
    }
}
 
Example 14
Source Project: TencentKona-8   Source File: XNodeSet.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a XNodeSet object for one node.
 *
 * @param n Node to add to the new XNodeSet object
 */
public XNodeSet(int n, DTMManager dtmMgr)
{

  super(new NodeSetDTM(dtmMgr));
  m_dtmMgr = dtmMgr;

  if (DTM.NULL != n)
  {
    ((NodeSetDTM) m_obj).addNode(n);
    m_last = 1;
  }
  else
      m_last = 0;
}
 
Example 15
Source Project: hottub   Source File: MultiDOM.java    License: GNU General Public License v2.0 5 votes vote down vote up
public String shallowCopy(final int node, SerializationHandler handler)
        throws TransletException
{
    if (node == DTM.NULL) {
        return "";
    }
    return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].shallowCopy(node, handler);
}
 
Example 16
Source Project: jdk8u60   Source File: XNodeSetForDOM.java    License: GNU General Public License v2.0 5 votes vote down vote up
public XNodeSetForDOM(Node node, DTMManager dtmMgr)
{
  m_dtmMgr = dtmMgr;
  m_origObj = node;
  int dtmHandle = dtmMgr.getDTMHandleFromNode(node);
  setObject(new NodeSetDTM(dtmMgr));
  ((NodeSetDTM) m_obj).addNode(dtmHandle);
}
 
Example 17
public void copy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (node != DTM.NULL) {
        _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler);
    }
}
 
Example 18
Source Project: openjdk-jdk8u   Source File: NodeSetDTM.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a NodeSetDTM which contains the given Node.
 *
 * @param node Single node to be added to the new set.
 */
public NodeSetDTM(int node, DTMManager dtmManager)
{

  super();
  m_manager = dtmManager;

  addNode(node);
}
 
Example 19
Source Project: openjdk-jdk8u   Source File: MultiDOM.java    License: GNU General Public License v2.0 5 votes vote down vote up
public String shallowCopy(final int node, SerializationHandler handler)
        throws TransletException
{
    if (node == DTM.NULL) {
        return "";
    }
    return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].shallowCopy(node, handler);
}
 
Example 20
public String shallowCopy(final int node, SerializationHandler handler)
        throws TransletException
{
    if (node == DTM.NULL) {
        return "";
    }
    return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].shallowCopy(node, handler);
}
 
Example 21
Source Project: jdk8u60   Source File: XPathContext.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void init(boolean useServicesMechanism) {
  m_prefixResolvers.push(null);
  m_currentNodes.push(DTM.NULL);
  m_currentExpressionNodes.push(DTM.NULL);
  m_saxLocations.push(null);
  m_useServicesMechanism = useServicesMechanism;
  m_dtmManager = DTMManager.newInstance(
                 com.sun.org.apache.xpath.internal.objects.XMLStringFactoryImpl.getFactory()
                 );
}
 
Example 22
/**
 * Construct an empty XNodeSet object.  This is used to create a mutable
 * nodeset to which random nodes may be added.
 */
private NodeSequence(DTMManager dtmMgr)
{
  super(new NodeVector());
  m_last = 0;
  m_dtmMgr = dtmMgr;
}
 
Example 23
Source Project: Bytecoder   Source File: XNodeSetForDOM.java    License: Apache License 2.0 5 votes vote down vote up
public XNodeSetForDOM(Node node, DTMManager dtmMgr)
{
  m_dtmMgr = dtmMgr;
  m_origObj = node;
  int dtmHandle = dtmMgr.getDTMHandleFromNode(node);
  setObject(new NodeSetDTM(dtmMgr));
  ((NodeSetDTM) m_obj).addNode(dtmHandle);
}
 
Example 24
Source Project: hottub   Source File: NodeSequence.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct an empty XNodeSet object.  This is used to create a mutable
 * nodeset to which random nodes may be added.
 */
private NodeSequence(DTMManager dtmMgr)
{
  super(new NodeVector());
  m_last = 0;
  m_dtmMgr = dtmMgr;
}
 
Example 25
Source Project: openjdk-jdk9   Source File: XNodeSetForDOM.java    License: GNU General Public License v2.0 5 votes vote down vote up
public XNodeSetForDOM(Node node, DTMManager dtmMgr)
{
  m_dtmMgr = dtmMgr;
  m_origObj = node;
  int dtmHandle = dtmMgr.getDTMHandleFromNode(node);
  setObject(new NodeSetDTM(dtmMgr));
  ((NodeSetDTM) m_obj).addNode(dtmHandle);
}
 
Example 26
Source Project: Bytecoder   Source File: MultiDOM.java    License: Apache License 2.0 5 votes vote down vote up
public int getExpandedTypeID(final int node) {
    if (node != DTM.NULL) {
        return _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].getExpandedTypeID(node);
    }
    else {
        return DTM.NULL;
    }
}
 
Example 27
Source Project: TencentKona-8   Source File: MultiDOM.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void copy(final int node, SerializationHandler handler)
    throws TransletException
{
    if (node != DTM.NULL) {
        _adapters[node >>> DTMManager.IDENT_DTM_NODE_BITS].copy(node, handler);
    }
}
 
Example 28
Source Project: jdk8u60   Source File: NodeSetDTM.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create a NodeSetDTM which contains the given Node.
 *
 * @param node Single node to be added to the new set.
 */
public NodeSetDTM(int node, DTMManager dtmManager)
{

  super();
  m_manager = dtmManager;

  addNode(node);
}
 
Example 29
Source Project: jdk8u60   Source File: MultiDOM.java    License: GNU General Public License v2.0 5 votes vote down vote up
public void characters(final int textNode, SerializationHandler handler)
             throws TransletException
{
    if (textNode != DTM.NULL) {
        _adapters[textNode >>> DTMManager.IDENT_DTM_NODE_BITS].characters(textNode, handler);
    }
}
 
Example 30
public SAX2RTFDTM(DTMManager mgr, Source source, int dtmIdentity,
               DTMWSFilter whiteSpaceFilter,
               XMLStringFactory xstringfactory,
               boolean doIndexing)
{
  super(mgr, source, dtmIdentity, whiteSpaceFilter,
        xstringfactory, doIndexing);

  // NEVER track source locators for RTFs; they aren't meaningful. I think.
  // (If we did track them, we'd need to tail-prune these too.)
  //com.sun.org.apache.xalan.internal.processor.TransformerFactoryImpl.m_source_location;
  m_useSourceLocationProperty=false;
  m_sourceSystemId = (m_useSourceLocationProperty) ? new StringVector()
                                                   : null;
  m_sourceLine = (m_useSourceLocationProperty) ? new IntVector() : null;
  m_sourceColumn = (m_useSourceLocationProperty) ? new IntVector() : null;

  // Record initial sizes of fields that are pushed and restored
  // for RTF tail-pruning.  More entries can be popped than pushed, so
  // we need this to mark the primordial state of the DTM.
  m_emptyNodeCount = m_size;
  m_emptyNSDeclSetCount = (m_namespaceDeclSets == null)
                               ? 0 : m_namespaceDeclSets.size();
  m_emptyNSDeclSetElemsCount = (m_namespaceDeclSetElements == null)
                                    ? 0 : m_namespaceDeclSetElements.size();
  m_emptyDataCount = m_data.size();
  m_emptyCharsCount = m_chars.size();
  m_emptyDataQNCount = m_dataOrQName.size();
}