Project

General

Profile

« Previous | Next » 

Revision 9356

Added by Jing Tao about 9 years ago

Add the constrains that v1/v2.archive only applies the object whose authoritative node is a v1 node.

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
595 595
          HazelcastService.getInstance().getSystemMetadataMap().lock(pid);
596 596
          logMetacat.debug("CNodeService.archive - lock the system metadata for "+pid.getValue());
597 597
          SystemMetadata sysMeta = HazelcastService.getInstance().getSystemMetadataMap().get(pid);
598
          D1NodeVersionChecker checker = new D1NodeVersionChecker(sysMeta.getAuthoritativeMemberNode());
599
          String version = checker.getVersion("MNStorage");
600
          if(version == null) {
601
              throw new ServiceFailure("4972", "Couldn't determine the version of the MNStorge for the "+pid.getValue());
602
          } else if (version.equalsIgnoreCase(D1NodeVersionChecker.V2)) {
603
              //we don't apply this method to an object whose authoritative node is v2
604
              throw new NotAuthorized("4970", V2V1MISSMATCH);
605
          } else if (!version.equalsIgnoreCase(D1NodeVersionChecker.V1)) {
606
              //we don't understand this version (it is not v1 or v2)
607
              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.");
608
          }
598 609
          boolean needModifyDate = true;
599 610
          archiveCNObjectWithNotificationReplica(session, pid, sysMeta, needModifyDate);
600 611
      

Also available in: Unified diff