Project

General

Profile

« Previous | Next » 

Revision 9357

Added by Jing Tao about 9 years ago

For the v1/v2 setObsoletedBy and setRightsHolder method, they only apply the objects whose authoriative member node is v1.

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
732 732
					throw new VersionMismatch("4886", msg);
733 733

  
734 734
				}
735
				
736
				 //only apply to the object whose authoritative member node is v1.
737
	              D1NodeVersionChecker checker = new D1NodeVersionChecker(systemMetadata.getAuthoritativeMemberNode());
738
	              String version = checker.getVersion("MNStorage");
739
	              if(version == null) {
740
	                  throw new ServiceFailure("4941", "Couldn't determine the version of the MNStorge for the "+pid.getValue());
741
	              } else if (version.equalsIgnoreCase(D1NodeVersionChecker.V2)) {
742
	                  //we don't apply this method to an object whose authoritative node is v2
743
	                  throw new NotAuthorized("4945", V2V1MISSMATCH);
744
	              } else if (!version.equalsIgnoreCase(D1NodeVersionChecker.V1)) {
745
	                  //we don't understand this version (it is not v1 or v2)
746
	                  throw new InvalidRequest("4942", "The version of the MNStorage is "+version+" for the authoritative member node of the object "+pid.getValue()+". We don't support it.");
747
	              }
735 748

  
736 749
			} catch (RuntimeException e) { // Catch is generic since HZ throws RuntimeException
737 750
				throw new NotFound("4884", "No record found for: " + pid.getValue());
......
1536 1549
      
1537 1550
      // The lock to be used for this identifier
1538 1551
      Lock lock = null;
1552
      
1553
      // do we have a valid pid?
1554
      if (pid == null || pid.getValue().trim().equals("")) {
1555
          throw new InvalidRequest("4442", "The provided identifier was invalid.");
1556
          
1557
      }
1539 1558

  
1540 1559
      // get the subject
1541 1560
      Subject subject = session.getSubject();
......
1562 1581
          try {
1563 1582
              systemMetadata = HazelcastService.getInstance().getSystemMetadataMap().get(pid);
1564 1583
              
1584
              if(systemMetadata == null) {
1585
                  throw new NotFound("4460", "The object "+pid.getValue()+" doesn't exist in the node.");
1586
              }
1565 1587
              // does the request have the most current system metadata?
1566 1588
              if ( systemMetadata.getSerialVersion().longValue() != serialVersion ) {
1567 1589
                 String msg = "The requested system metadata version number " + 
......
1571 1593
                 throw new VersionMismatch("4443", msg);
1572 1594
              }
1573 1595
              
1596
              //only apply to the object whose authoritative member node is v1.
1597
              D1NodeVersionChecker checker = new D1NodeVersionChecker(systemMetadata.getAuthoritativeMemberNode());
1598
              String version = checker.getVersion("MNStorage");
1599
              if(version == null) {
1600
                  throw new ServiceFailure("4490", "Couldn't determine the version of the MNStorge for the "+pid.getValue());
1601
              } else if (version.equalsIgnoreCase(D1NodeVersionChecker.V2)) {
1602
                  //we don't apply this method to an object whose authoritative node is v2
1603
                  throw new NotAuthorized("4440", V2V1MISSMATCH);
1604
              } else if (!version.equalsIgnoreCase(D1NodeVersionChecker.V1)) {
1605
                  //we don't understand this version (it is not v1 or v2)
1606
                  throw new InvalidRequest("4442", "The version of the MNStorage is "+version+" for the authoritative member node of the object "+pid.getValue()+". We don't support it.");
1607
              }
1608
              
1609
              
1574 1610
          } catch (RuntimeException e) { // Catch is generic since HZ throws RuntimeException
1575 1611
              throw new NotFound("4460", "No record found for: " + pid.getValue());
1576 1612
              

Also available in: Unified diff