Project

General

Profile

« Previous | Next » 

Revision 9294

Added by Jing Tao over 9 years ago

When the cn.notifyReplicaNodes method, if the target MN source code is a v2 mn, we will use v2 api; if it is a v1 node, we will use v1 api.

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
2092 2092
      
2093 2093
      Session session = null;
2094 2094
      List<Replica> replicaList = currentSystemMetadata.getReplicaList();
2095
      MNode mn = null;
2095
      //MNode mn = null;
2096 2096
      NodeReference replicaNodeRef = null;
2097 2097
      CNode cn = null;
2098 2098
      NodeType nodeType = null;
......
2114 2114
          
2115 2115
          // iterate through the replicas and inform  MN replica nodes
2116 2116
          for (Replica replica : replicaList) {
2117
              
2117
              String replicationVersion = null;
2118 2118
              replicaNodeRef = replica.getReplicaMemberNode();
2119 2119
              try {
2120 2120
                  if (nodeList != null) {
......
2122 2122
                      for (Node node : nodeList) {
2123 2123
                          if ( node.getIdentifier().getValue().equals(replicaNodeRef.getValue()) ) {
2124 2124
                              nodeType = node.getType();
2125
                              D1NodeVersionChecker checker = new D1NodeVersionChecker(replicaNodeRef);
2126
                              replicationVersion = checker.getVersion("MNRead");
2125 2127
                              break;
2126 2128
              
2127 2129
                          }
......
2129 2131
                  }
2130 2132
              
2131 2133
                  // notify only MNs
2132
                  if (nodeType != null && nodeType == NodeType.MN) {
2133
                      mn = D1Client.getMN(replicaNodeRef);
2134
                      mn.systemMetadataChanged(session, 
2135
                          currentSystemMetadata.getIdentifier(), 
2136
                          currentSystemMetadata.getSerialVersion().longValue(),
2137
                          currentSystemMetadata.getDateSysMetadataModified());
2134
                  if (replicationVersion != null && nodeType != null && nodeType == NodeType.MN) {
2135
                      if(replicationVersion.equalsIgnoreCase(D1NodeVersionChecker.V2)) {
2136
                          //connect to a v2 mn
2137
                          MNode mn = D1Client.getMN(replicaNodeRef);
2138
                          mn.systemMetadataChanged(session, 
2139
                              currentSystemMetadata.getIdentifier(), 
2140
                              currentSystemMetadata.getSerialVersion().longValue(),
2141
                              currentSystemMetadata.getDateSysMetadataModified());
2142
                      } else if (replicationVersion.equalsIgnoreCase(D1NodeVersionChecker.V1)) {
2143
                          //connect to a v1 mn
2144
                          org.dataone.client.v1.MNode mn = org.dataone.client.v1.itk.D1Client.getMN(replicaNodeRef);
2145
                          mn.systemMetadataChanged(session, 
2146
                                  currentSystemMetadata.getIdentifier(), 
2147
                                  currentSystemMetadata.getSerialVersion().longValue(),
2148
                                  currentSystemMetadata.getDateSysMetadataModified());
2149
                      }
2150
                      
2138 2151
                  }
2139 2152
              
2140 2153
              } catch (Exception e) { // handle BaseException and other I/O issues

Also available in: Unified diff