Project

General

Profile

« Previous | Next » 

Revision 6341

check reservation before create/update

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
267 267
    throws InvalidToken, ServiceFailure, NotAuthorized, IdentifierNotUnique, 
268 268
    UnsupportedType, InsufficientResources, NotFound, InvalidSystemMetadata, 
269 269
    NotImplemented, InvalidRequest {
270
	  
271
	// check if the pid has been reserved
272
	try {
273
		boolean hasReservation = D1Client.getCN().hasReservation(session, pid);
274
		if (!hasReservation) {
275
			throw new NotAuthorized("", "No reservation for pid: " + pid.getValue());
276
		}
277
	} catch (NotFound e) {
278
		// okay to continue
279
	}
270 280

  
271 281
    String localId = null;
272 282
    boolean allowed = false;
......
360 370
    
361 371
    return pid;
362 372
  }
373
  
374
  public Identifier create(Session session, Identifier pid,
375
			InputStream object, SystemMetadata sysmeta) throws InvalidToken,
376
			ServiceFailure, NotAuthorized, IdentifierNotUnique,
377
			UnsupportedType, InsufficientResources, InvalidSystemMetadata,
378
			NotImplemented, InvalidRequest {
363 379

  
380
		// check if the pid has been reserved
381
		try {
382
			boolean hasReservation = D1Client.getCN().hasReservation(session, pid);
383
			if (!hasReservation) {
384
				throw new NotAuthorized("", "No reservation for pid: " + pid.getValue());
385
			}
386
		} catch (NotFound e) {
387
			// okay to continue
388
		}
389

  
390
		return super.create(session, pid, object, sysmeta);
391
	}
392

  
364 393
  /**
365 394
   * Called by a Coordinating Node to request that the Member Node create a 
366 395
   * copy of the specified object by retrieving it from another Member 

Also available in: Unified diff