jkesselm    01/05/14 13:52:37

  Modified:    java/src/org/apache/xml/dtm Tag: DTM_EXP DTM.java
                        DTMDefaultBase.java DTMDocumentImpl.java
               java/src/org/apache/xml/dtm/sax2dtm Tag: DTM_EXP
                        SAX2DTM.java
  Log:
  Lurching toward support for the official startup sequence
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.12  +27 -9     xml-xalan/java/src/org/apache/xml/dtm/Attic/DTM.java
  
  Index: DTM.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/DTM.java,v
  retrieving revision 1.1.2.11
  retrieving revision 1.1.2.12
  diff -u -r1.1.2.11 -r1.1.2.12
  --- DTM.java  2001/05/06 02:09:39     1.1.2.11
  +++ DTM.java  2001/05/14 20:52:14     1.1.2.12
  @@ -157,12 +157,8 @@
     
     // ========= DTM Implementation Control Functions. ==============
   
  -  /**
  -   * Set a suggested parse block size for the parser.
  -   *
  -   * @param blockSizeSuggestion Suggested size of the parse blocks, in bytes.
  -   */
  -  public void setParseBlockSize(int blockSizeSuggestion);
  +  // %TBD% RETIRED -- do via setFeature if needed. Remove from impls.
  +  // public void setParseBlockSize(int blockSizeSuggestion);
   
     /**
      * Set an implementation dependent feature.
  @@ -823,15 +819,36 @@
      *
      * @throws org.xml.sax.SAXException
      */
  -
     public void dispatchToEvents(
       int nodeHandle, org.xml.sax.ContentHandler ch)
         throws org.xml.sax.SAXException;
         
     // ==== Construction methods (may not be supported by some 
implementations!) =====
         // %REVIEW% What response occurs if not supported?
  -      // Should it be a separate interface to make that distinction explicit?
  -      // I suspect we need element and attribute factories, maybe others.
  +
  +      /** getContentHandler returns "our SAX builder" -- the thing that
  +       * someone else should send SAX events to in order to extend this
  +       * DTM model.
  +       *
  +       * @return null if this model doesn't respond to SAX events,
  +       * "this" if the DTM object has a built-in SAX ContentHandler,
  +       * the CoroutineParser if we're bound to one and should receive
  +       * the SAX stream via it for incremental build purposes...
  +       * */
  +      public org.xml.sax.ContentHandler getContentHandler();
  +
  +      /** @return true iff we're building this model incrementally (eg
  +       * we're partnered with a CoroutineParser) and thus require that the
  +       * transformation and the parse run simultaneously. Guidance to the
  +       * DTMManager.
  +       * */
  +      public boolean needsTwoThreads();
  +
  +      // %REVIEW% Do these appends make any sense, should we support a
  +      // wider set of methods (like the "append" methods in the
  +      // current DTMDocumentImpl draft), or should we just support SAX
  +      // listener interfaces?  Should it be a separate interface to
  +      // make that distinction explicit?
     
     /** Append a child to "the end of the document". Please note that
      * the node is always cloned in a base DTM, since our basic behavior
  @@ -858,6 +875,7 @@
      * @param str Non-null reference to a string.
      */
     public void appendTextChild(String str);
  +
   }
   
   
  
  
  
  1.1.2.2   +0 -7      
xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMDefaultBase.java
  
  Index: DTMDefaultBase.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMDefaultBase.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- DTMDefaultBase.java       2001/05/14 05:15:55     1.1.2.1
  +++ DTMDefaultBase.java       2001/05/14 20:52:16     1.1.2.2
  @@ -338,13 +338,6 @@
     // ========= DTM Implementation Control Functions. ==============
   
     /**
  -   * Set a suggested parse block size for the parser.
  -   *
  -   * @param blockSizeSuggestion Suggested size of the parse blocks, in bytes.
  -   */
  -  public void setParseBlockSize(int blockSizeSuggestion){}
  -
  -  /**
      * Set an implementation dependent feature.
      * <p>
      * %REVIEW% Do we really expect to set features on DTMs?
  
  
  
  1.1.2.15  +88 -7     
xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMDocumentImpl.java
  
  Index: DTMDocumentImpl.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/Attic/DTMDocumentImpl.java,v
  retrieving revision 1.1.2.14
  retrieving revision 1.1.2.15
  diff -u -r1.1.2.14 -r1.1.2.15
  --- DTMDocumentImpl.java      2001/05/11 21:28:28     1.1.2.14
  +++ DTMDocumentImpl.java      2001/05/14 20:52:18     1.1.2.15
  @@ -127,6 +127,32 @@
   
           private final boolean DEBUG = false;
   
  +  /** If we're building the model incrementally on demand, we need to
  +   * be able to tell the source when to send us more data.
  +   *
  +   * Note that if this has not been set, and you attempt to read ahead
  +   * of the current build point, we'll probably throw a null-pointer
  +   * exception. We could try to wait-and-retry instead, as a very poor
  +   * fallback, but that has all the known problems with multithreading
  +   * on multiprocessors and we Don't Want to Go There.
  +   * 
  +   * @see setCoroutineParser
  +   */
  +  private CoroutineParser m_coroutineParser=null;
  +
  +  /** If we're building the model incrementally on demand, we need to
  +   * be able to tell the source who to return the data to.
  +   *
  +   * Note that if this has not been set, and you attempt to read ahead
  +   * of the current build point, we'll probably throw a MethodNotFound
  +   * exception. We could try to wait-and-retry instead, as a very poor
  +   * fallback, but that has all the known problems with multithreading
  +   * on multiprocessors and we Don't Want to Go There.
  +   * 
  +   * @see setCoroutineParser
  +   */
  +  private int m_appCoroutineID=-1;
  +
           // ========= DTM data structure declarations. ==============
   
           // nodes array: integer array blocks to hold the first level 
reference of the nodes,
  @@ -176,6 +202,42 @@
                   initDocument(documentNumber);         // clear nodes and 
document handle
           }
   
  +  /** Bind a CoroutineParser to this DTM. If we discover we need nodes
  +   * that have not yet been built, we will ask this object to send us more
  +   * events, and it will manage interactions with its data sources.
  +   *
  +   * Note that we do not actually build the CoroutineParser, since we don't
  +   * know what source it's reading from, what thread that source will run in,
  +   * or when it will run.
  +   *
  +   * @param coroutineParser The parser that we want to recieve events from
  +   * on demand.
  +   */
  +  public void setCoroutineParser(CoroutineParser coroutineParser)
  +  {
  +    // Establish coroutine link so we can request more data
  +    //
  +    // Note: It's possible that some versions of CoroutineParser may
  +    // not actually use a CoroutineManager, and hence may not require
  +    // that we obtain an Application Coroutine ID. (This relies on the
  +    // coroutine transaction details having been encapsulated in the
  +    // CoroutineParser.do...() methods.)
  +    m_coroutineParser=coroutineParser;
  +    CoroutineManager cm=coroutineParser.getCoroutineManager();
  +    if(cm!=null)
  +      m_appCoroutineID=cm.co_joinCoroutineSet(-1);
  +
  +    // Establish SAX-stream link so we can receive the requested data
  +    coroutineParser.setContentHandler(this);
  +    coroutineParser.setLexHandler(this);
  +
  +    // Are the following really needed? coroutineParser doesn't yet
  +    // support them, and they're mostly no-ops here...
  +    //coroutineParser.setErrorHandler(this);
  +    //coroutineParser.setDTDHandler(this);
  +    //coroutineParser.setDeclHandler(this);
  +  }
  +  
           /**
            * Wrapper for ChunkedIntArray.append, to automatically update the
            * previous sibling's "next" reference (if necessary) and 
periodically
  @@ -206,13 +268,6 @@
           // ========= DTM Implementation Control Functions. ==============
   
           /**
  -         * Set a suggested parse block size for the parser.
  -         *
  -         * @param blockSizeSuggestion Suggested size of the parse blocks, in 
bytes.
  -         */
  -        public void setParseBlockSize(int blockSizeSuggestion) {};
  -
  -        /**
            * Set an implementation dependent feature.
            * <p>
            * %REVIEW% Do we really expect to set features on DTMs?
  @@ -301,6 +356,32 @@
                    return m_char;
            }
   
  +  /** getContentHandler returns "our SAX builder" -- the thing that
  +   * someone else should send SAX events to in order to extend this
  +   * DTM model.
  +   *
  +   * @return null if this model doesn't respond to SAX events,
  +   * "this" if the DTM object has a built-in SAX ContentHandler,
  +   * the CoroutineParser if we're bound to one and should receive
  +   * the SAX stream via it for incremental build purposes...
  +   * */
  +  public org.xml.sax.ContentHandler getContentHandler()
  +  {
  +    if (m_coroutineParser instanceof CoroutineSAXParser)
  +      return (ContentHandler) m_coroutineParser;
  +    else
  +      return this;
  +  }
  +  
  +  /** @return true iff we're building this model incrementally (eg
  +   * we're partnered with a CoroutineParser) and thus require that the
  +   * transformation and the parse run simultaneously. Guidance to the
  +   * DTMManager.
  +   * */
  +  public boolean needsTwoThreads()
  +  {
  +    return null!=m_coroutineParser;
  +  }
   
     //================================================================
     // ========= SAX2 ContentHandler methods =========
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +29 -0     
xml-xalan/java/src/org/apache/xml/dtm/sax2dtm/Attic/SAX2DTM.java
  
  Index: SAX2DTM.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/sax2dtm/Attic/SAX2DTM.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- SAX2DTM.java      2001/05/14 19:09:28     1.1.2.4
  +++ SAX2DTM.java      2001/05/14 20:52:31     1.1.2.5
  @@ -84,6 +84,7 @@
     /** simple DEBUG flag, for dumping diagnostics info. */
     private static final boolean DEBUG = false;
   
  +
     /** If we're building the model incrementally on demand, we need to
      * be able to tell the source when to send us more data.
      *
  @@ -268,6 +269,34 @@
       //coroutineParser.setDeclHandler(this);
     }
     
  +  /** getContentHandler returns "our SAX builder" -- the thing that
  +   * someone else should send SAX events to in order to extend this
  +   * DTM model.
  +   *
  +   * %REVIEW% Should this return null if constrution already done/begun?
  +   *
  +   * @return null if this model doesn't respond to SAX events,
  +   * "this" if the DTM object has a built-in SAX ContentHandler,
  +   * the CoroutineParser if we're bound to one and should receive
  +   * the SAX stream via it for incremental build purposes...
  +   * */
  +  public org.xml.sax.ContentHandler getContentHandler()
  +  {
  +    if (m_coroutineParser instanceof CoroutineSAXParser)
  +      return (ContentHandler) m_coroutineParser;
  +    else
  +      return this;
  +  }
  +
  +  /** @return true iff we're building this model incrementally (eg
  +   * we're partnered with a CoroutineParser) and thus require that the
  +   * transformation and the parse run simultaneously. Guidance to the
  +   * DTMManager.
  +   * */
  +  public boolean needsTwoThreads()
  +  {
  +    return null!=m_coroutineParser;
  +  }
   
     /**
      * Directly call the
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to