Project

General

Profile

« Previous | Next » 

Revision 3229

Added by Jing Tao about 17 years ago

This commit is for branch. In this commit the correct ip and user name will be stored in access_log table in replication event. However, it only for Forcereplication. And the test isn't completed yet. This commit is only for future use.

View differences:

DocumentImpl.java
537 537
    public static void writeDataFileInReplication(InputStream input,
538 538
            String filePath, String docname, String doctype, String accnum,
539 539
            String user, String docHomeServer, String notificationServer, 
540
            String tableName, boolean timedReplication, String createDate, String updateDate)
540
            String tableName, boolean timedReplication, String createDate, String updateDate, String ipAddress)
541 541
            throws SQLException, AccessionNumberException, Exception
542 542
    {
543 543
        int serverCode = -2;
......
595 595
        if (!timedReplication)
596 596
        {
597 597
          ForceReplicationHandler forceReplication = new ForceReplicationHandler(
598
                accnum, false, notificationServer);
598
                accnum, false, notificationServer, user, ipAddress);
599 599
        }
600 600
    }
601 601
    
......
2236 2236

  
2237 2237
    public static String write(DBConnection conn, Reader xml, String pub,
2238 2238
            Reader dtd, String action, String docid, String user,
2239
            String[] groups, String ruleBase, boolean needValidation)
2239
            String[] groups, String ruleBase, boolean needValidation, String ipAddress)
2240 2240
            throws Exception
2241 2241
    {
2242 2242
        //this method will be called in handleUpdateOrInsert method
......
2244 2244
        // get server location for this doc
2245 2245
        int serverLocation = getServerLocationNumber(docid);
2246 2246
        return write(conn, xml, pub, dtd, action, docid, user, groups,
2247
                serverLocation, false, ruleBase, needValidation);
2247
                serverLocation, false, ruleBase, needValidation, ipAddress);
2248 2248
    }
2249 2249

  
2250 2250
    /**
......
2280 2280
    public static String write(DBConnection conn, Reader xml, String pub,
2281 2281
            Reader dtd, String action, String accnum, String user,
2282 2282
            String[] groups, int serverCode, boolean override, String ruleBase,
2283
            boolean needValidation) throws Exception
2283
            boolean needValidation, String ipAddress) throws Exception
2284 2284
    {
2285 2285
        // NEW - WHEN CLIENT ALWAYS PROVIDE ACCESSION NUMBER INCLUDING REV IN IT
2286 2286
        //MetaCatUtil util = new MetaCatUtil();
......
2365 2365

  
2366 2366
                // Force replication the docid
2367 2367
                ForceReplicationHandler frh = new ForceReplicationHandler(
2368
                        accnum, true, null);
2368
                        accnum, true, null, user, ipAddress);
2369 2369
                return (accnum);
2370 2370

  
2371 2371
            }
......
2464 2464
        // other servers true mean it is xml document null is because no
2465 2465
        // metacat notify the force replication.
2466 2466
        ForceReplicationHandler frh = new ForceReplicationHandler(accnum,
2467
                action, true, null);
2467
                action, true, null, user, ipAddress);
2468 2468

  
2469 2469
        logMetacat.info("Conn Usage count after writting: "
2470 2470
                + conn.getUsageCount());
......
2511 2511
            String pub, Reader dtd, String action, String accnum, String user,
2512 2512
            String[] groups, String homeServer, String notifyServer,
2513 2513
            String ruleBase, boolean needValidation, String tableName, 
2514
            boolean timedReplication, String createDate, String updateDate) throws Exception
2514
            boolean timedReplication, String createDate, String updateDate, String ipAddress) throws Exception
2515 2515
    {
2516 2516
        long rootId;
2517 2517
        String docType = null;
......
2642 2642
        if (!timedReplication)
2643 2643
        {
2644 2644
          ForceReplicationHandler forceReplication = new ForceReplicationHandler(
2645
                accnum, action, true, notifyServer);
2645
                accnum, action, true, notifyServer, user, ipAddress);
2646 2646
        }
2647 2647
        return (accnum);
2648 2648
    }
......
2778 2778
     * @param docid
2779 2779
     *            the ID of the document to be deleted from the database
2780 2780
     */
2781
    public static void delete(String accnum, String user, String[] groups, String notifyServer)
2781
    public static void delete(String accnum, String user, String[] groups, String notifyServer, String ipAddress)
2782 2782
            throws Exception
2783 2783
    {
2784 2784

  
......
2926 2926

  
2927 2927
            conn.commit();
2928 2928
            conn.setAutoCommit(true);
2929
            //add force delete replcation document here.
2930
            ForceReplicationHandler frh = new ForceReplicationHandler(
2931
                             accnum, ForceReplicationHandler.DELETE, isXML, notifyServer, user, ipAddress);
2929 2932

  
2930 2933
        } catch (Exception e) {
2931 2934
            logMetacat.error("error in DocumentImpl.delete: "
......
2944 2947
                DBConnectionPool.returnDBConnection(conn, serialNumber);
2945 2948
            }
2946 2949
        }
2947
       // add force delete replcation document here.
2948
       ForceReplicationHandler frh = new ForceReplicationHandler(
2949
                        accnum, ForceReplicationHandler.DELETE, isXML, notifyServer);
2950
       
2950 2951

  
2951 2952
    }
2952 2953

  
......
3646 3647
                    xmldoc.toXml(new PrintWriter(System.out), null, null, true);
3647 3648
                }
3648 3649
            } else if (action.equals("DELETE")) {
3649
                DocumentImpl.delete(docid, null, null,null);
3650
                DocumentImpl.delete(docid, null, null,null, null);
3650 3651
                //System.out.println("Document deleted: " + docid);
3651 3652
            } else {
3652 3653
                /*

Also available in: Unified diff