vgritsenko    2003/08/08 15:47:14

  Modified:    java/src/org/apache/xindice/core SystemCollection.java
               java/src/org/apache/xindice/xml SymbolTableSymbols.java
  Log:
  Move system collection definition into static constant (same as in 
SymbolTableSymbols)
  
  Revision  Changes    Path
  1.19      +24 -20    
xml-xindice/java/src/org/apache/xindice/core/SystemCollection.java
  
  Index: SystemCollection.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/core/SystemCollection.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- SystemCollection.java     7 Aug 2003 20:13:21 -0000       1.18
  +++ SystemCollection.java     8 Aug 2003 22:47:14 -0000       1.19
  @@ -87,6 +87,23 @@
       public static final String GROUPS = "SysGroups";
       public static final String ACCESS = "SysAccess";
   
  +    private static String SYSCOL_DEFINITION
  +            = "<collection name=\"" + SYSCOL + "\">"
  +            // System Collections
  +            + "   <collections>"
  +            //       Symbol Tables Collection
  +            + "      <collection name=\"" + SYMBOLS + "\" 
compressed=\"true\">"
  +            + "         <filer 
class=\"org.apache.xindice.core.filer.BTreeFiler\" />"
  +            //          Textual Representation of Hard-coded Symbol Table
  +            +           SymbolTableSymbols.getDefinition()
  +            + "      </collection>"
  +            //       System Configuration Collection
  +            + "      <collection name=\"" + CONFIGS + "\" 
compressed=\"false\">"
  +            + "         <filer 
class=\"org.apache.xindice.core.filer.BTreeFiler\" />"
  +            + "      </collection>"
  +            + "   </collections>"
  +            + "</collection>";
  +
       /**
        * @param db
        */
  @@ -96,25 +113,8 @@
   
       void init() throws DBException {
           // Bootstrap the System Collection
  -
  -        String SysCol = "<collection name=\"" + SYSCOL + "\">"
  -                // System Collections
  -                + "   <collections>"
  -                // Symbol Tables Collection
  -                + "      <collection name=\"" + SYMBOLS + "\" 
compressed=\"true\">" + "         <filer 
class=\"org.apache.xindice.core.filer.BTreeFiler\" />"
  -                // Textual Representation of Hard-coded Symbol Table
  -                + SymbolTableSymbols.getDefinition() + "      </collection>"
  -                // System Configuration Collection
  -                + "      <collection name=\""
  -                + CONFIGS
  -                + "\" compressed=\"false\">"
  -                + "         <filer 
class=\"org.apache.xindice.core.filer.BTreeFiler\" />"
  -                + "      </collection>"
  -                + "   </collections>"
  -                + "</collection>";
  -
           try {
  -            Document sysDoc = DOMParser.toDocument(SysCol);
  +            Document sysDoc = DOMParser.toDocument(SYSCOL_DEFINITION);
               Configuration sysCfg = new Configuration(sysDoc, false);
               setConfig(sysCfg);
           } catch (Exception e) {
  @@ -168,5 +168,9 @@
               symCol.setObject(name, symbols);
               symbols.setDirty(false);
           }
  +    }
  +
  +    public static String getDefinition() {
  +        return SYSCOL_DEFINITION;
       }
   }
  
  
  
  1.5       +9 -8      
xml-xindice/java/src/org/apache/xindice/xml/SymbolTableSymbols.java
  
  Index: SymbolTableSymbols.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xindice/java/src/org/apache/xindice/xml/SymbolTableSymbols.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SymbolTableSymbols.java   7 Aug 2003 20:13:25 -0000       1.4
  +++ SymbolTableSymbols.java   8 Aug 2003 22:47:14 -0000       1.5
  @@ -70,8 +70,9 @@
    * @version CVS $Revision$, $Date$
    */
   public final class SymbolTableSymbols extends SymbolTable {
  -    private static String XMLDef =
  -            "<symbols>"
  +
  +    private static String SYMBOLS_DEFINITION
  +            = "<symbols>"
               + "   <symbol name=\"" + SYMBOLS + "\" id=\"0\" />"
               + "   <symbol name=\"" + SYMBOL + "\" id=\"1\" />"
               + "   <symbol name=\"" + NAME + "\" id=\"2\" />"
  @@ -79,18 +80,18 @@
               + "   <symbol name=\"" + NSURI + "\" id=\"4\" />"
               + "</symbols>";
   
  -    private Element elem;
  +    private Element symbolsElem;
   
       private SymbolTableSymbols() {
           try {
  -            elem = DOMParser.toDocument(XMLDef).getDocumentElement();
  +            symbolsElem = 
DOMParser.toDocument(SYMBOLS_DEFINITION).getDocumentElement();
           } catch (Exception e) {
           }
  -        streamFromXML(elem);
  +        streamFromXML(symbolsElem);
       }
   
       public static String getDefinition() {
  -        return XMLDef;
  +        return SYMBOLS_DEFINITION;
       }
   
       public static SymbolTableSymbols getInstance() {
  
  
  

Reply via email to