Project

General

Profile

« Previous | Next » 

Revision 1574

Added by Jing Tao over 21 years ago

Get rid of access and relationa runner from run() method.

View differences:

src/edu/ucsb/nceas/metacat/DBSAXHandler.java
422 422
      dbConn.commit();
423 423

  
424 424
      //if this is a package file
425
      String packagedoctype = MetaCatUtil.getOption("packagedoctype");
426
      Vector packagedoctypes = new Vector();
427

  
428
      packagedoctypes = MetaCatUtil.getOptionList(packagedoctype);
429

  
430
      if ( packagedoctypes.contains(doctype) )
431
      {
432
        // write the package info to xml_relation table
433
        RelationHandler rth = new RelationHandler(docid, dbConn);
434
        // from the relations get the access file id for that package
435
        String aclid = rth.getAccessFileID(docid);
436
        // if there are access file, write ACL for that package
437
        if ( aclid != null ) {
438
          runAccessControlList(dbConn, aclid);
439
        }
440

  
441
      }
442
        // if it is an access file
443
      else if ( MetaCatUtil.getOptionList(
444
                     MetaCatUtil.getOption("accessdoctype")).contains(doctype) )
445
      {
446
        // write ACL for the package
447
        runAccessControlList(dbConn, docid);
448
        
449
      }
425
    
450 426
   
451 427

  
452 428
    } catch (Exception e) {
......
464 440
    }//finally
465 441
  }
466 442

  
467
  // It runs in xmlIndex thread. It writes ACL for a package.
468
  private void runAccessControlList (DBConnection conn, String aclid)
469
                                                throws Exception
470
  {
471
    // read the access file from xml_nodes
472
    // parse the access file and store the access info into xml_access
473
    AccessControlList aclobj =
474
    new AccessControlList(conn, aclid, //new StringReader(xml),
475
                          user, groups, serverCode);
476
    conn.commit();
477
  }
478

  
479

  
480 443
  /** SAX Handler that is called for each XML text node */
481 444
  public void characters(char[] cbuf, int start, int len) throws SAXException 
482 445
  {

Also available in: Unified diff