Bug 33441

Summary: creating multiple collections(hierarchy) fails
Product: Xindice Reporter: sanjay <sanjay.dahiya>
Component: DB EngineAssignee: Xindice Developers <xindice-dev>
Status: CLOSED DUPLICATE    
Severity: blocker    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description sanjay 2005-02-08 11:17:09 UTC
I need to programmatically create a collection hierarchy. On the disk it creates
all the child directories in db. Also it doesnt give any error while creating. 
Any subsequent call to access the child collections fails, but parent collection
is accessible. 

I am using xidice embedded in servlet ...
here is code snippet 
---------------------------------

     Collection prjCol = createCollection(col, projectName);
     if( null == prjCol ){
           throw new Exception("");
     }
     Collection iformsCol = createCollection(prjCol, "forms");
     if( null ==  iformsCol){
           throw new Exception("");
                    }
     iformsCol.flushSymbolTable();
     iformsCol.close();
                                                                               
                                                              
     Collection dataCol = createCollection(prjCol, "data");
     if( null == dataCol ){
       throw new Exception();
      }
      dataCol.flushSymbolTable();
      dataCol.close();
                                                                               
                                                              
     Collection reportsCol = createCollection(prjCol, "reports");
     if( null == reportsCol ){
         throw new Exception("");
     }
     reportsCol.flushSymbolTable();
     reportsCol.close();
                                                                               
                                                              
     prjCol.flushSymbolTable();
     prjCol.close();
                                                                               
                                                              
     col.close();
----- create collection method ----------

public Collection createCollection(Collection parent, String name) throws
DBException{

        Document doc = new DocumentImpl();
                                                                               
                                                                      Element
colEle = doc.createElement("collection");
        colEle.setAttribute("compressed", "true");
        colEle.setAttribute("name", name);
        doc.appendChild(colEle);
                                                                               
                                                              
        Element filEle = doc.createElement("filer");
        filEle.setAttribute("class", "org.apache.xindice.core.filer.BTreeFiler");
        colEle.appendChild(filEle);
                                                                               
                                                              
        Configuration cfg = new Configuration ( doc, false );
        Collection newCol =     parent.createCollection(name , cfg);
                                                                               
                                                              
        return newCol ;
                                                                               
                                                                  }
Comment 1 Vadim Gritsenko 2005-02-15 00:38:05 UTC
config has not been always saved properly; fixed in cvs

*** This bug has been marked as a duplicate of 28783 ***