Project

General

Profile

« Previous | Next » 

Revision 10380

Added by Jing Tao over 7 years ago

Add the methods submitting the update and delete tasks.

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
139 139
  /*
140 140
   * Submit a index task to the message broker.
141 141
   */
142
  private void submitIndexTask(SystemMetadata sysmeta, String objectURI) throws ServiceFailure, InvalidSystemMetadata, InstantiationException, IllegalAccessException, ClassNotFoundException {
142
  private void submitAddIndexTask(SystemMetadata sysmeta, String objectURI) throws ServiceFailure, InvalidSystemMetadata, InstantiationException, IllegalAccessException, ClassNotFoundException {
143 143
      if(indexTaskClient == null) {
144 144
          indexTaskClient = IndexTaskMessagingClientManager.getInstance().getMessagingClient();
145 145
      }
......
148 148
      indexTaskClient.submit(task);
149 149

  
150 150
  }
151
  
152
  /*
153
   * Submit an update index task to the message broker.
154
   */
155
  private void submitUpdateIndexTask(SystemMetadata sysmeta, String objectURI) throws ServiceFailure, InvalidSystemMetadata, InstantiationException, IllegalAccessException, ClassNotFoundException {
156
      if(indexTaskClient == null) {
157
          indexTaskClient = IndexTaskMessagingClientManager.getInstance().getMessagingClient();
158
      }
159
      IndexTaskGenerator generator = new IndexTaskGenerator();
160
      IndexTask task = generator.generateUpdateTask(sysmeta, objectURI);
161
      indexTaskClient.submit(task);
162
  }
163
  
164
  /*
165
   * Submit a delete index task to the message broker.
166
   */
167
  private void submitDeleteIndexTask(SystemMetadata sysmeta) throws ServiceFailure, InvalidSystemMetadata, InstantiationException, IllegalAccessException, ClassNotFoundException {
168
      if(indexTaskClient == null) {
169
          indexTaskClient = IndexTaskMessagingClientManager.getInstance().getMessagingClient();
170
      }
171
      IndexTaskGenerator generator = new IndexTaskGenerator();
172
      IndexTask task = generator.generateDeleteTask(sysmeta);
173
      indexTaskClient.submit(task);
174
  }
151 175
    
152 176
  /**
153 177
   * Set the replication policy for an object given the object identifier
......
1896 1920
              try {
1897 1921
                  String localId = IdentifierManager.getInstance().getLocalId(pid.getValue());
1898 1922
                  String objectURI = IdentifierManager.getInstance().getObjectFilePath(localId, isScienceMetadata(sysmeta));
1899
                  submitIndexTask(sysmeta, objectURI);
1923
                  submitAddIndexTask(sysmeta, objectURI);
1900 1924
                  logMetacat.info("CNodeService.create - Metacat successfully submitted the index task for the object "+sysmeta.getIdentifier().getValue()+" to the message broker. But it is NOT guarranteed that the broker can get it.");
1901 1925
              } catch (Exception e) {
1902 1926
                  logMetacat.warn("CNodeService.create - the index task for the object "+sysmeta.getIdentifier().getValue()+" failed to be submitted to the message broker since "+e.getMessage(), e);

Also available in: Unified diff