Project

General

Profile

« Previous | Next » 

Revision 10041

Added by Jing Tao about 8 years ago

Use the "MNRead" to replace "MNStorage" to determine the version of the MN.

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
197 197
                  
198 198
              }
199 199
              D1NodeVersionChecker checker = new D1NodeVersionChecker(systemMetadata.getAuthoritativeMemberNode());
200
              String version = checker.getVersion("MNStorage");
200
              String version = checker.getVersion("MNRead");
201 201
              if(version == null) {
202
                  throw new ServiceFailure("4882", "Couldn't determine the authoritative member node storage version for the pid "+pid.getValue());
202
                  throw new ServiceFailure("4882", "Couldn't determine the MNRead version of the authoritative member node for the pid "+pid.getValue());
203 203
              } else if (version.equalsIgnoreCase(D1NodeVersionChecker.V2)) {
204 204
                  //we don't apply this method to an object whose authoritative node is v2
205 205
                  throw new NotAuthorized("4881", V2V1MISSMATCH);
206 206
              } else if (!version.equalsIgnoreCase(D1NodeVersionChecker.V1)) {
207 207
                  //we don't understand this version (it is not v1 or v2)
208
                  throw new InvalidRequest("4883", "The version of the MNStorage is "+version+" for the authoritative member node of the object "+pid.getValue()+". We don't support it.");
208
                  throw new InvalidRequest("4883", "The version of the MNRead is "+version+" for the authoritative member node of the object "+pid.getValue()+". We don't support it.");
209 209
              }
210 210
              // does the request have the most current system metadata?
211 211
              if ( systemMetadata.getSerialVersion().longValue() != serialVersion ) {
......
598 598
          logMetacat.debug("CNodeService.archive - lock the system metadata for "+pid.getValue());
599 599
          SystemMetadata sysMeta = HazelcastService.getInstance().getSystemMetadataMap().get(pid);
600 600
          D1NodeVersionChecker checker = new D1NodeVersionChecker(sysMeta.getAuthoritativeMemberNode());
601
          String version = checker.getVersion("MNStorage");
601
          String version = checker.getVersion("MNRead");
602 602
          if(version == null) {
603
              throw new ServiceFailure("4972", "Couldn't determine the authoritative member node storage version for the pid "+pid.getValue());
603
              throw new ServiceFailure("4972", "Couldn't determine the MNRead version of the authoritative member node for the pid "+pid.getValue());
604 604
          } else if (version.equalsIgnoreCase(D1NodeVersionChecker.V2)) {
605 605
              //we don't apply this method to an object whose authoritative node is v2
606 606
              throw new NotAuthorized("4970", V2V1MISSMATCH);
607 607
          } else if (!version.equalsIgnoreCase(D1NodeVersionChecker.V1)) {
608 608
              //we don't understand this version (it is not v1 or v2)
609
              throw new NotImplemented("4974", "The version of the MNStorage is "+version+" for the authoritative member node of the object "+pid.getValue()+". We don't support it.");
609
              throw new NotImplemented("4974", "The version of the MNRead is "+version+" for the authoritative member node of the object "+pid.getValue()+". We don't support it.");
610 610
          }
611 611
          boolean needModifyDate = true;
612 612
          archiveCNObjectWithNotificationReplica(session, pid, sysMeta, needModifyDate);
......
738 738
				
739 739
				 //only apply to the object whose authoritative member node is v1.
740 740
	              D1NodeVersionChecker checker = new D1NodeVersionChecker(systemMetadata.getAuthoritativeMemberNode());
741
	              String version = checker.getVersion("MNStorage");
741
	              String version = checker.getVersion("MNRead");
742 742
	              if(version == null) {
743
	                  throw new ServiceFailure("4941", "Couldn't determine the authoritative member node storage version for the pid "+pid.getValue());
743
	                  throw new ServiceFailure("4941", "Couldn't determine the MNRead version of the authoritative member node for the pid "+pid.getValue());
744 744
	              } else if (version.equalsIgnoreCase(D1NodeVersionChecker.V2)) {
745 745
	                  //we don't apply this method to an object whose authoritative node is v2
746 746
	                  throw new NotAuthorized("4945", V2V1MISSMATCH);
747 747
	              } else if (!version.equalsIgnoreCase(D1NodeVersionChecker.V1)) {
748 748
	                  //we don't understand this version (it is not v1 or v2)
749
	                  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.");
749
	                  throw new InvalidRequest("4942", "The version of the MNRead is "+version+" for the authoritative member node of the object "+pid.getValue()+". We don't support it.");
750 750
	              }
751 751

  
752 752
			} catch (RuntimeException e) { // Catch is generic since HZ throws RuntimeException
......
1423 1423
              //for the object whose authoriative mn is v1. we need reset the modification date.
1424 1424
              //d1-sync already set the serial version. so we don't need do again.
1425 1425
              D1NodeVersionChecker checker = new D1NodeVersionChecker(sysmeta.getAuthoritativeMemberNode());
1426
              String version = checker.getVersion("MNStorage");
1426
              String version = checker.getVersion("MNRead");
1427 1427
              if(version != null && version.equalsIgnoreCase(D1NodeVersionChecker.V1)) {
1428 1428
                  sysmeta.setDateSysMetadataModified(Calendar.getInstance().getTime());
1429 1429
              }
......
1604 1604
              
1605 1605
              //only apply to the object whose authoritative member node is v1.
1606 1606
              D1NodeVersionChecker checker = new D1NodeVersionChecker(systemMetadata.getAuthoritativeMemberNode());
1607
              String version = checker.getVersion("MNStorage");
1607
              String version = checker.getVersion("MNRead");
1608 1608
              if(version == null) {
1609
                  throw new ServiceFailure("4490", "Couldn't determine the authoritative member node storage version for the pid "+pid.getValue());
1609
                  throw new ServiceFailure("4490", "Couldn't determine the MNRead version of the authoritative member node storage version for the pid "+pid.getValue());
1610 1610
              } else if (version.equalsIgnoreCase(D1NodeVersionChecker.V2)) {
1611 1611
                  //we don't apply this method to an object whose authoritative node is v2
1612 1612
                  throw new NotAuthorized("4440", V2V1MISSMATCH);
1613 1613
              } else if (!version.equalsIgnoreCase(D1NodeVersionChecker.V1)) {
1614 1614
                  //we don't understand this version (it is not v1 or v2)
1615
                  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.");
1615
                  throw new InvalidRequest("4442", "The version of the MNRead is "+version+" for the authoritative member node of the object "+pid.getValue()+". We don't support it.");
1616 1616
              }
1617 1617
              
1618 1618
              
......
1842 1842
              //for the object whose authoritative mn is v1. we need reset the modification date.
1843 1843
              //for the object whose authoritative mn is v2. we just accept the modification date.
1844 1844
              D1NodeVersionChecker checker = new D1NodeVersionChecker(sysmeta.getAuthoritativeMemberNode());
1845
              String version = checker.getVersion("MNStorage");
1845
              String version = checker.getVersion("MNRead");
1846 1846
              if(version != null && version.equalsIgnoreCase(D1NodeVersionChecker.V1)) {
1847 1847
                  sysmeta.setDateSysMetadataModified(Calendar.getInstance().getTime());
1848 1848
              }
......
1956 1956
              }
1957 1957
              
1958 1958
              D1NodeVersionChecker checker = new D1NodeVersionChecker(systemMetadata.getAuthoritativeMemberNode());
1959
              String version = checker.getVersion("MNStorage");
1959
              String version = checker.getVersion("MNRead");
1960 1960
              if(version == null) {
1961
                  throw new ServiceFailure("4430", "Couldn't determine the authoritative member node storage version for the pid "+pid.getValue());
1961
                  throw new ServiceFailure("4430", "Couldn't determine the version of MNRead of the authoritative member node for the pid "+pid.getValue());
1962 1962
              } else if (version.equalsIgnoreCase(D1NodeVersionChecker.V2)) {
1963 1963
                  //we don't apply this method to an object whose authoritative node is v2
1964 1964
                  throw new NotAuthorized("4420", V2V1MISSMATCH);
1965 1965
              } else if (!version.equalsIgnoreCase(D1NodeVersionChecker.V1)) {
1966 1966
                  //we don't understand this version (it is not v1 or v2)
1967
                  throw new InvalidRequest("4402", "The version of the MNStorage is "+version+" for the authoritative member node of the object "+pid.getValue()+". We don't support it.");
1967
                  throw new InvalidRequest("4402", "The version of the MNRead is "+version+" for the authoritative member node of the object "+pid.getValue()+". We don't support it.");
1968 1968
              }
1969 1969
              
1970 1970
          } catch (RuntimeException e) {
src/edu/ucsb/nceas/metacat/dataone/v1/CNodeService.java
646 646
		}
647 647
		//this method will apply to the objects whose authoritative mn is v1.
648 648
        D1NodeVersionChecker checker = new D1NodeVersionChecker(v2Sysmeta.getAuthoritativeMemberNode());
649
        String version = checker.getVersion("MNStorage");
649
        String version = checker.getVersion("MNRead");
650 650
        if(version == null) {
651
            throw new ServiceFailure("4862", "Couldn't determine the authoritative member node storage version for the pid "+pid.getValue());
651
            throw new ServiceFailure("4862", "Couldn't determine the MNRead version of the authoritative member node for the pid "+pid.getValue());
652 652
        } else if (version.equalsIgnoreCase(D1NodeVersionChecker.V2)) {
653 653
            //we don't apply this method to an object whose authoritative node is v2
654 654
            throw new NotAuthorized("4861", edu.ucsb.nceas.metacat.dataone.CNodeService.V2V1MISSMATCH);
655 655
        } else if (!version.equalsIgnoreCase(D1NodeVersionChecker.V1)) {
656 656
            //we don't understand this version (it is not v1 or v2)
657
            throw new InvalidRequest("4863", "The version of the MNStorage is "+version+" for the authoritative member node of the object "+pid.getValue()+". We don't support it.");
657
            throw new InvalidRequest("4863", "The version of the MNRead is "+version+" for the authoritative member node of the object "+pid.getValue()+". We don't support it.");
658 658
        }
659 659
        //set the serial version to one
660 660
        v2Sysmeta.setSerialVersion(BigInteger.ONE);

Also available in: Unified diff