Project

General

Profile

« Previous | Next » 

Revision 5944

Added by berkley about 13 years ago

fixed replication bug where systemmetadata was not getting procssed correctly

View differences:

src/edu/ucsb/nceas/metacat/database/DBConnectionPool.java
265 265
            logMetacat.debug("DBConnectionPool.getDBConnection - The usage is " + db.getUsageCount());
266 266
            logMetacat.debug("DBConnectionPool.getDBConnection - The connection time is: " + db.getConnectionTime());
267 267
            
268
            System.out.println("DBConnectionPool.getDBConnection - The connection is checked out: " + db.getTag());
269
            System.out.println("DBConnectionPool.getDBConnection - The method for checking is: " + db.getCheckOutMethodName());
270
            System.out.println("DBConnectionPool.getDBConnection - The age is " + db.getAge());
271
            System.out.println("DBConnectionPool.getDBConnection - The usage is " + db.getUsageCount());
272
            System.out.println("DBConnectionPool.getDBConnection - The connection time is: " + db.getConnectionTime());
268
//            System.out.println("DBConnectionPool.getDBConnection - The connection is checked out: " + db.getTag());
269
//            System.out.println("DBConnectionPool.getDBConnection - The method for checking is: " + db.getCheckOutMethodName());
270
//            System.out.println("DBConnectionPool.getDBConnection - The age is " + db.getAge());
271
//            System.out.println("DBConnectionPool.getDBConnection - The usage is " + db.getUsageCount());
272
//            System.out.println("DBConnectionPool.getDBConnection - The connection time is: " + db.getConnectionTime());
273 273
            
274 274
            //set check out time
275 275
            db.setCheckOutTime(System.currentTimeMillis());
src/edu/ucsb/nceas/metacat/database/DBConnection.java
359 359
     // Load the Oracle JDBC driver
360 360
     try
361 361
     {
362
         System.out.println("db driver is " + dbDriver);
363 362
       Class.forName (dbDriver);
364 363
     }
365 364
     catch (ClassNotFoundException e)
src/edu/ucsb/nceas/metacat/IdentifierManager.java
119 119
        }
120 120
        Hashtable<String, String> h = new Hashtable<String, String>();
121 121
        String sql = "select guid, date_uploaded, rights_holder, checksum, checksum_algorithm, " +
122
          "origin_member_node, authoritive_member_node, date_modified, submitter, object_format " +
122
          "origin_member_node, authoritive_member_node, date_modified, submitter, object_format, size " +
123 123
          "from systemmetadata where docid = ?";
124 124
        DBConnection dbConn = null;
125 125
        int serialNumber = -1;
src/edu/ucsb/nceas/metacat/replication/ReplicationHandler.java
415 415
      //process guid
416 416
      logReplication.debug("Processing guid information from docinfoHash: " + docinfoHash.toString());
417 417
      String guid = docinfoHash.get("guid");
418
      String docName = docinfoHash.get("docName");
418
      String docName = docinfoHash.get("docname");
419 419
      System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%guid passed from docinfo hash: " + guid);
420 420
      IdentifierManager idman = IdentifierManager.getInstance();
421
      
422
      System.out.println("docname: " + docName);
423
      
421 424
      if(guid != null && !idman.identifierExists(guid))
422 425
      { //if the guid was passed in, put it in the identifiers table
423 426
        logReplication.debug("Creating guid/docid mapping for docid " + 
424 427
          docinfoHash.get("docid") + " and guid: " + guid);
425
        System.out.println("docname: " + docName);
426
        if(docName.trim().equals("systemMetadata"))
427
        {
428
            System.out.println("creating mapping for systemMetadata: guid: " + guid + " localId: " + docinfoHash.get("docid"));
429
            idman.createSystemMetadataMapping(guid, docinfoHash.get("docid"));
430
            Long dateUploadedLong = new Long(docinfoHash.get("date_uploaded"));
431
            Long dateModifiedLong = new Long(docinfoHash.get("modified_date"));
432
            idman.insertAdditionalSystemMetadataFields(
433
                    dateUploadedLong.longValue(), 
434
                    docinfoHash.get("rights_holder"),
435
                    docinfoHash.get("checksum"), 
436
                    docinfoHash.get("checksum_algorithm"), 
437
                    docinfoHash.get("origin_member_node"),
438
                    docinfoHash.get("authoritive_member_node"), 
439
                    dateModifiedLong.longValue(),
440
                    docinfoHash.get("submitter"),
441
                    docinfoHash.get("guid"),
442
                    docinfoHash.get("objectFormat"),
443
                    new Long(docinfoHash.get("size")).longValue());
444
        }
445
        else
446
        {
447
            System.out.println("creating mapping: guid: " + guid + " localId: " + docinfoHash.get("docid"));
448
            idman.createMapping(guid, docinfoHash.get("docid"));
449
        }
428
        
429
        
430
        System.out.println("creating mapping: guid: " + guid + " localId: " + docinfoHash.get("docid"));
431
        idman.createMapping(guid, docinfoHash.get("docid"));
450 432
      }
451 433
      else
452 434
      {
453 435
        logReplication.debug("No guid information was included with the replicated document");
454 436
      }
455 437
      
438
      //handle systemMetadata
439
      if(docName.trim().equals("systemMetadata"))
440
      {
441
          System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!creating mapping for systemMetadata: guid: " + guid + " localId: " + docinfoHash.get("docid"));
442
          idman.createSystemMetadataMapping(guid, docinfoHash.get("docid"));
443
          System.out.println("1");
444
          Long dateUploadedLong = new Long(docinfoHash.get("date_uploaded"));
445
          System.out.println("2");
446
          Long dateModifiedLong = new Long(docinfoHash.get("date_modified"));
447
          System.out.println("3");
448
          idman.insertAdditionalSystemMetadataFields(
449
                  dateUploadedLong.longValue(), 
450
                  docinfoHash.get("rights_holder"),
451
                  docinfoHash.get("checksum"), 
452
                  docinfoHash.get("checksum_algorithm"), 
453
                  docinfoHash.get("origin_member_node"),
454
                  docinfoHash.get("authoritive_member_node"), 
455
                  dateModifiedLong.longValue(),
456
                  docinfoHash.get("submitter"),
457
                  docinfoHash.get("guid"),
458
                  docinfoHash.get("objectFormat"),
459
                  new Long(docinfoHash.get("size")).longValue());
460
          System.out.println("4");
461
      }
462
      
456 463
      if(guid != null)
457 464
      {
458 465
          if(!docName.trim().equals("systemMetadata"))
src/edu/ucsb/nceas/metacat/replication/ReplicationService.java
1555 1555
		Writer out = null;
1556 1556
		try {
1557 1557
			// get writer, TODO: encoding?
1558
			response.setContentType("text/xml");
1559
			out = response.getWriter();
1560
			
1558
		    if(printFlag)
1559
		    {
1560
		        response.setContentType("text/xml");
1561
		        out = response.getWriter();
1562
		    }
1561 1563
			/*conn = MetacatReplication.getDBConnection("MetacatReplication." +
1562 1564
			                                          "handleGetCatalogRequest");*/
1563 1565
			dbConn = DBConnectionPool

Also available in: Unified diff