Project

General

Profile

« Previous | Next » 

Revision 1591

Added by Jing Tao over 21 years ago

Move the code that writes triple to db to DBSAXHandler class.

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
1675 1675
          conn.setAutoCommit(true);
1676 1676
          throw e;
1677 1677
        }
1678
        // run write into relational db and access db       
1679
        RunRelationHandlerAndAccessHandler(accnum, user, groups, serverCode);
1678
        // run write into access db base one relation table and access object 
1679
        runRelationAndAccessHandler(accnum, user, groups, serverCode);
1680 1680
        
1681 1681
        // Force replication the docid
1682 1682
        ForceReplicationHandler frh = new ForceReplicationHandler
......
1737 1737
      throw e;
1738 1738
    }
1739 1739
    
1740
    // run write into relational db and access db       
1741
    RunRelationHandlerAndAccessHandler(accnum, user, groups, serverCode);
1740
    // run access db base on relation table and access object       
1741
    runRelationAndAccessHandler(accnum, user, groups, serverCode);
1742 1742
    
1743 1743
    // Force replicate out the new document to each server in our server list.
1744 1744
    // Start the thread to replicate this new document out to the other servers
......
1855 1855
      throw e;
1856 1856
    }
1857 1857
    
1858
    // run write into relational db and access db       
1859
    RunRelationHandlerAndAccessHandler(accnum, user, groups, serverCode);
1858
    // run write into access db base on relation table and access rule
1859
    try
1860
    {       
1861
      runRelationAndAccessHandler(accnum, user, groups, serverCode);
1862
    }
1863
    catch (Exception ee)
1864
    {
1865
      MetacatReplication.replErrorLog("Failed to " + 
1866
                                       "create access " + 
1867
                                       "rule for package: " + accnum +
1868
                                       " because " +ee.getMessage());
1869
      MetaCatUtil.debugMessage("Failed to  " + 
1870
                                       "create access " + 
1871
                                       "rule for package: "+ accnum +
1872
                                       " because " +ee.getMessage(), 30);
1873
    }
1860 1874
    //Force replication to other server
1861 1875
    ForceReplicationHandler forceReplication = new ForceReplicationHandler
1862 1876
                                  (accnum, action, true, notifyServer);
......
1866 1880
  }
1867 1881
  
1868 1882
  /* Running write record to xml_relation and xml_access*/
1869
  private static void RunRelationHandlerAndAccessHandler(String accnumber, 
1883
  private static void runRelationAndAccessHandler(String accnumber, 
1870 1884
                                                  String userName, 
1871 1885
                                                  String[]group, int servercode) 
1872 1886
                                                   throws Exception
......
1884 1898
      if (documenttype != null && packagedoctypes.contains(documenttype) )
1885 1899
      {
1886 1900
        dbconn=DBConnectionPool.
1887
           getDBConnection("DocumentImpl.RunRelationHandelerAndAccessHandeler");
1901
           getDBConnection("DocumentImpl.runRelationAndAccessHandeler");
1888 1902
        serialNumber=dbconn.getCheckOutSerialNumber();
1889 1903
        dbconn.setAutoCommit(false);
1890
        // write the package info to xml_relation table
1891
        RelationHandler rth = new RelationHandler(docIdWithoutRev, dbconn);
1892
        dbconn.commit();
1893 1904
        // from the relations get the access file id for that package
1894
        String aclid = rth.getAccessFileID(docIdWithoutRev);
1905
        String aclid = RelationHandler.getAccessFileID(docIdWithoutRev);
1895 1906
        // if there are access file, write ACL for that package
1896 1907
        if ( aclid != null ) 
1897 1908
        {
......
1905 1916
                 MetaCatUtil.getOption("accessdoctype")).contains(documenttype))
1906 1917
      {
1907 1918
        dbconn=DBConnectionPool.
1908
           getDBConnection("DocumentImpl.RunRelationHandelerAndAccessHandeler");
1919
           getDBConnection("DocumentImpl.runRelationAndAccessHandeler");
1909 1920
        serialNumber=dbconn.getCheckOutSerialNumber();
1910 1921
        dbconn.setAutoCommit(false);
1911 1922
        // write ACL for the package
......
1924 1935
        dbconn.rollback();
1925 1936
        dbconn.setAutoCommit(true);
1926 1937
      }
1927
      MetaCatUtil.debugMessage("Error in RunRelationHandlerAndAccessHandler " +
1938
      MetaCatUtil.debugMessage("Error in DocumentImple.runRelationAndAccessHandler " +
1928 1939
                                e.getMessage(), 30);
1929 1940
      throw e;
1930 1941
    }

Also available in: Unified diff