Project

General

Profile

1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2000-2011 Regents of the University of California and the
4
 *              National Center for Ecological Analysis and Synthesis
5
 *
6
 *   '$Author: tao $'
7
 *     '$Date: 2015-11-03 11:27:52 -0800 (Tue, 03 Nov 2015) $'
8
 *
9
 * This program is free software; you can redistribute it and/or modify
10
 * it under the terms of the GNU General Public License as published by
11
 * the Free Software Foundation; either version 2 of the License, or
12
 * (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
 */
23

    
24
package edu.ucsb.nceas.metacat.dataone.v1;
25

    
26
import java.io.IOException;
27
import java.io.InputStream;
28
import java.sql.SQLException;
29
import java.util.Date;
30

    
31
import javax.servlet.http.HttpServletRequest;
32

    
33
import org.apache.log4j.Logger;
34
import org.dataone.service.exceptions.IdentifierNotUnique;
35
import org.dataone.service.exceptions.InsufficientResources;
36
import org.dataone.service.exceptions.InvalidRequest;
37
import org.dataone.service.exceptions.InvalidSystemMetadata;
38
import org.dataone.service.exceptions.InvalidToken;
39
import org.dataone.service.exceptions.NotAuthorized;
40
import org.dataone.service.exceptions.NotFound;
41
import org.dataone.service.exceptions.NotImplemented;
42
import org.dataone.service.exceptions.ServiceFailure;
43
import org.dataone.service.exceptions.SynchronizationFailed;
44
import org.dataone.service.exceptions.UnsupportedType;
45
import org.dataone.service.mn.tier1.v1.MNCore;
46
import org.dataone.service.mn.tier1.v1.MNRead;
47
import org.dataone.service.mn.tier2.v1.MNAuthorization;
48
import org.dataone.service.mn.tier3.v1.MNStorage;
49
import org.dataone.service.mn.tier4.v1.MNReplication;
50
import org.dataone.service.mn.v1.MNQuery;
51
import org.dataone.service.types.v1.Checksum;
52
import org.dataone.service.types.v1.DescribeResponse;
53
import org.dataone.service.types.v1.Event;
54
import org.dataone.service.types.v1.Identifier;
55
import org.dataone.service.types.v1.Log;
56
import org.dataone.service.types.v1.Node;
57
import org.dataone.service.types.v1.NodeReference;
58
import org.dataone.service.types.v1.ObjectFormatIdentifier;
59
import org.dataone.service.types.v1.ObjectList;
60
import org.dataone.service.types.v1.Permission;
61
import org.dataone.service.types.v1.Session;
62
import org.dataone.service.types.v1.SystemMetadata;
63
import org.dataone.service.types.v1_1.QueryEngineDescription;
64
import org.dataone.service.types.v1_1.QueryEngineList;
65
import org.dataone.service.types.v2.TypeFactory;
66

    
67
import edu.ucsb.nceas.metacat.IdentifierManager;
68
import edu.ucsb.nceas.metacat.dataone.convert.LogV2toV1Converter;
69

    
70
/**
71
 * Represents Metacat's implementation of the DataONE Member Node 
72
 * service API, v1. Methods typically pass through to the current 
73
 * version implementation performing type conversion as needed.
74
 * 
75
 */
76
public class MNodeService 
77
    implements MNAuthorization, MNCore, MNRead, MNReplication, MNStorage, MNQuery {
78

    
79
	/**
80
	 * current version implementation
81
	 */
82
	edu.ucsb.nceas.metacat.dataone.MNodeService impl = null;
83
	
84
	/* the logger instance */
85
    private Logger logMetacat = null;
86

    
87
    /**
88
     * Singleton accessor to get an instance of MNodeService.
89
     * 
90
     * @return instance - the instance of MNodeService
91
     */
92
    public static MNodeService getInstance(HttpServletRequest request) {
93
        return new MNodeService(request);
94
    }
95

    
96
    /**
97
     * Constructor, private for singleton access
98
     */
99
    private MNodeService(HttpServletRequest request) {
100
        logMetacat = Logger.getLogger(MNodeService.class);
101
        impl = edu.ucsb.nceas.metacat.dataone.MNodeService.getInstance(request);
102
    }
103
    
104
    public void setSession(Session session) {
105
    	impl.setSession(session);
106
    }
107
    
108
    public boolean isAdminAuthorized(Session session) throws ServiceFailure, InvalidToken, NotAuthorized, NotImplemented {
109
    	return impl.isAdminAuthorized(session);
110
    }
111

    
112
	@Override
113
	public QueryEngineDescription getQueryEngineDescription(String engine)
114
			throws InvalidToken, ServiceFailure, NotAuthorized, NotImplemented,
115
			NotFound {
116
		return impl.getQueryEngineDescription(null, engine);
117
	}
118

    
119
	@Override
120
	public QueryEngineList listQueryEngines() throws InvalidToken,
121
			ServiceFailure, NotAuthorized, NotImplemented {
122
		return impl.listQueryEngines(null);
123
	}
124

    
125
	@Override
126
	public InputStream query(String engine, String query) throws InvalidToken,
127
			ServiceFailure, NotAuthorized, InvalidRequest, NotImplemented,
128
			NotFound {
129
		return impl.query(null, engine, query);
130
	}
131

    
132
	@Override
133
	public Identifier archive(Identifier pid) throws InvalidToken,
134
			ServiceFailure, NotAuthorized, NotFound, NotImplemented {
135
	    String serviceFailure = "2912";
136
        String notFound = "2911";
137
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
138
                "The object specified by "+pid.getValue()+" does not exist at this node.");
139
		return impl.archive(null, pid);
140
	}
141

    
142
	@Override
143
	@Deprecated
144
	public Identifier archive(Session session, Identifier pid)
145
			throws InvalidToken, ServiceFailure, NotAuthorized, NotFound,
146
			NotImplemented {
147
	    String serviceFailure = "2912";
148
        String notFound = "2911";
149
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
150
                "The object specified by "+pid.getValue()+" does not exist at this node.");
151
		return impl.archive(session, pid);
152
	}
153

    
154
	@Override
155
	public Identifier create(Identifier pid, InputStream object,
156
			SystemMetadata sysmeta) throws IdentifierNotUnique,
157
			InsufficientResources, InvalidRequest, InvalidSystemMetadata,
158
			InvalidToken, NotAuthorized, NotImplemented, ServiceFailure,
159
			UnsupportedType {
160
		return this.create(null, pid, object, sysmeta);
161
	}
162

    
163
	@Override
164
	@Deprecated
165
	public Identifier create(Session session, Identifier pid, InputStream object,
166
			SystemMetadata sysmeta) throws IdentifierNotUnique,
167
			InsufficientResources, InvalidRequest, InvalidSystemMetadata,
168
			InvalidToken, NotAuthorized, NotImplemented, ServiceFailure,
169
			UnsupportedType {
170
		//convert sysmeta to newer version
171
		org.dataone.service.types.v2.SystemMetadata v2Sysmeta = null;
172
		try {
173
			v2Sysmeta = TypeFactory.convertTypeFromType(sysmeta, org.dataone.service.types.v2.SystemMetadata.class);
174
		} catch (Exception e) {
175
			// report as service failure
176
			ServiceFailure sf = new ServiceFailure("1190", e.getMessage());
177
			sf.initCause(e);
178
			throw sf;
179
		}
180
		
181
		return impl.create(session, pid, object, v2Sysmeta);
182
	}
183

    
184
	@Override
185
	public Identifier delete(Identifier pid) throws InvalidToken,
186
			ServiceFailure, NotAuthorized, NotFound, NotImplemented {
187
	    String serviceFailure = "2902";
188
        String notFound = "2901";
189
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
190
                "The object specified by "+pid.getValue()+" does not exist at this node.");
191
		return impl.delete(null, pid);
192
	}
193

    
194
	@Override
195
	@Deprecated
196
	public Identifier delete(Session session, Identifier pid)
197
			throws InvalidToken, ServiceFailure, NotAuthorized, NotFound,
198
			NotImplemented {
199
	    String serviceFailure = "2902";
200
        String notFound = "2901";
201
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
202
                "The object specified by "+pid.getValue()+" does not exist at this node.");
203
		return impl.delete(session, pid);
204
	}
205

    
206
	@Override
207
	public Identifier generateIdentifier(String scheme, String fragment)
208
			throws InvalidToken, ServiceFailure, NotAuthorized, NotImplemented,
209
			InvalidRequest {
210
		return impl.generateIdentifier(null, scheme, fragment);
211
	}
212

    
213
	@Override
214
	@Deprecated
215
	public Identifier generateIdentifier(Session session, String scheme, String fragment)
216
			throws InvalidToken, ServiceFailure, NotAuthorized, NotImplemented,
217
			InvalidRequest {
218
		return impl.generateIdentifier(session, scheme, fragment);
219
	}
220

    
221
	@Override
222
	public Identifier update(Identifier pid, InputStream object,
223
			Identifier newPid, SystemMetadata sysmeta) throws IdentifierNotUnique,
224
			InsufficientResources, InvalidRequest, InvalidSystemMetadata,
225
			InvalidToken, NotAuthorized, NotImplemented, ServiceFailure,
226
			UnsupportedType, NotFound {
227
		return this.update(null, pid, object, newPid, sysmeta);
228
	}
229

    
230
	@Override
231
	@Deprecated
232
	public Identifier update(Session session, Identifier pid, InputStream object,
233
			Identifier newPid, SystemMetadata sysmeta) throws IdentifierNotUnique,
234
			InsufficientResources, InvalidRequest, InvalidSystemMetadata,
235
			InvalidToken, NotAuthorized, NotImplemented, ServiceFailure,
236
			UnsupportedType, NotFound {
237
	    //check if the pid exists and not a sid
238
	    String serviceFailure = "1310";
239
        String notFound = "1280";
240
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
241
                "The object specified by "+pid.getValue()+" does not exist at this node.");
242
		//convert sysmeta to newer version
243
		org.dataone.service.types.v2.SystemMetadata v2Sysmeta = null;
244
		try {
245
			v2Sysmeta = TypeFactory.convertTypeFromType(sysmeta, org.dataone.service.types.v2.SystemMetadata.class);
246
		} catch (Exception e) {
247
			// report as service failure
248
			ServiceFailure sf = new ServiceFailure("1030", e.getMessage());
249
			sf.initCause(e);
250
			throw sf;
251
		}
252
		return impl.update(session, pid, object, newPid, v2Sysmeta);
253
	}
254

    
255
	@Override
256
	public boolean replicate(SystemMetadata sysmeta, NodeReference sourceNode)
257
			throws NotImplemented, ServiceFailure, NotAuthorized,
258
			InvalidRequest, InvalidToken, InsufficientResources,
259
			UnsupportedType {
260
		return this.replicate(null, sysmeta, sourceNode);
261
	}
262

    
263
	@Override
264
	@Deprecated
265
	public boolean replicate(Session session, SystemMetadata sysmeta,
266
			NodeReference sourceNode) throws NotImplemented, ServiceFailure,
267
			NotAuthorized, InvalidRequest, InvalidToken, InsufficientResources,
268
			UnsupportedType {
269
		//convert sysmeta to newer version
270
		org.dataone.service.types.v2.SystemMetadata v2Sysmeta = null;
271
		try {
272
			v2Sysmeta = TypeFactory.convertTypeFromType(sysmeta, org.dataone.service.types.v2.SystemMetadata.class);
273
		} catch (Exception e) {
274
			// report as service failure
275
			ServiceFailure sf = new ServiceFailure("1030", e.getMessage());
276
			sf.initCause(e);
277
			throw sf;
278
		}
279
		return impl.replicate(session, v2Sysmeta, sourceNode);
280
	}
281

    
282
	@Override
283
	public DescribeResponse describe(Identifier pid) throws InvalidToken,
284
			NotAuthorized, NotImplemented, ServiceFailure, NotFound {
285
	    String serviceFailure = "1030";
286
        String notFound = "1020";
287
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The system metadata for given PID "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
288
                "No system metadata could be found for given PID: "+pid.getValue());
289
		return impl.describe(null, pid);
290
	}
291

    
292
	@Override
293
	@Deprecated
294
	public DescribeResponse describe(Session session, Identifier pid)
295
			throws InvalidToken, NotAuthorized, NotImplemented, ServiceFailure,
296
			NotFound {
297
	    String serviceFailure = "1030";
298
        String notFound = "1020";
299
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The system metadata for given PID "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
300
                "No system metadata could be found for given PID: "+pid.getValue());
301
		return impl.describe(session, pid);
302
	}
303

    
304
	@Override
305
	public InputStream get(Identifier pid) throws InvalidToken, NotAuthorized,
306
			NotImplemented, ServiceFailure, NotFound, InsufficientResources {
307
	    String serviceFailure = "1030";
308
        String notFound = "1020";
309
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
310
                "The object specified by "+pid.getValue()+" does not exist at this node.");
311
		return impl.get(null, pid);
312
	}
313

    
314
	@Override
315
	@Deprecated
316
	public InputStream get(Session session, Identifier pid) throws InvalidToken,
317
			NotAuthorized, NotImplemented, ServiceFailure, NotFound,
318
			InsufficientResources {
319
	    String serviceFailure = "1030";
320
        String notFound = "1020";
321
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
322
                "The object specified by "+pid.getValue()+" does not exist at this node.");
323
		return impl.get(session, pid);
324
	}
325

    
326
	@Override
327
	public Checksum getChecksum(Identifier pid, String algorithm)
328
			throws InvalidRequest, InvalidToken, NotAuthorized, NotImplemented,
329
			ServiceFailure, NotFound {
330
		return impl.getChecksum(null, pid, algorithm);
331
	}
332

    
333
	@Override
334
	@Deprecated
335
	public Checksum getChecksum(Session session, Identifier pid, String algorithm)
336
			throws InvalidRequest, InvalidToken, NotAuthorized, NotImplemented,
337
			ServiceFailure, NotFound {
338
		return impl.getChecksum(session, pid, algorithm);
339
	}
340

    
341
	@Override
342
	public InputStream getReplica(Identifier pid) throws InvalidToken,
343
			NotAuthorized, NotImplemented, ServiceFailure, NotFound,
344
			InsufficientResources {
345
		return impl.getReplica(null, pid);
346
	}
347

    
348
	@Override
349
	@Deprecated
350
	public InputStream getReplica(Session session, Identifier pid)
351
			throws InvalidToken, NotAuthorized, NotImplemented, ServiceFailure,
352
			NotFound, InsufficientResources {
353
		return impl.getReplica(session, pid);
354
	}
355

    
356
	@Override
357
	public SystemMetadata getSystemMetadata(Identifier pid)
358
			throws InvalidToken, NotAuthorized, NotImplemented, ServiceFailure,
359
			NotFound {
360
		
361
		return this.getSystemMetadata(null, pid);
362
		
363
	}
364

    
365
	@Override
366
	@Deprecated
367
	public SystemMetadata getSystemMetadata(Session session, Identifier pid)
368
			throws InvalidToken, NotAuthorized, NotImplemented, ServiceFailure,
369
			NotFound {
370
	    String serviceFailure = "1090";
371
        String notFound = "1060";
372
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The system metadata for given PID "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
373
                "No system metadata could be found for given PID: "+pid.getValue());
374
		org.dataone.service.types.v2.SystemMetadata sysMeta = impl.getSystemMetadata(session, pid);
375
		SystemMetadata retSysMeta = null;
376
		try {
377
			retSysMeta = TypeFactory.convertTypeFromType(sysMeta, SystemMetadata.class);
378
		} catch (Exception e) {
379
			// report as service failure
380
			ServiceFailure sf = new ServiceFailure("4801", e.getMessage());
381
			sf.initCause(e);
382
			throw sf;
383
		}
384
		return retSysMeta;
385
	}
386

    
387
	@Override
388
	public ObjectList listObjects(Date startTime, Date endTime,
389
			ObjectFormatIdentifier objectFormatId, Boolean replicaStatus, Integer start,
390
			Integer count) throws InvalidRequest, InvalidToken, NotAuthorized,
391
			NotImplemented, ServiceFailure {
392
		return this.listObjects(null, startTime, endTime, objectFormatId, replicaStatus, start, count);
393
	}
394

    
395
	@Override
396
	@Deprecated
397
	public ObjectList listObjects(Session session, Date startTime, Date endTime,
398
			ObjectFormatIdentifier objectFormatId, Boolean replicaStatus, Integer start,
399
			Integer count) throws InvalidRequest, InvalidToken, NotAuthorized,
400
			NotImplemented, ServiceFailure {
401
		return impl.listObjects(session, startTime, endTime, objectFormatId, null, replicaStatus, start, count);
402
	}
403

    
404
	@Override
405
	public boolean synchronizationFailed(SynchronizationFailed syncFailed)
406
			throws InvalidToken, NotAuthorized, NotImplemented, ServiceFailure {
407
		return impl.synchronizationFailed(null, syncFailed);
408
	}
409

    
410
	@Override
411
	@Deprecated
412
	public boolean synchronizationFailed(Session session,
413
			SynchronizationFailed syncFailed) throws InvalidToken, NotAuthorized,
414
			NotImplemented, ServiceFailure {
415
		return impl.synchronizationFailed(session, syncFailed);
416
	}
417

    
418
	@Override
419
	public Node getCapabilities() throws NotImplemented, ServiceFailure {
420
		org.dataone.service.types.v2.Node node = impl.getCapabilities();
421
		Node retNode = null;
422
		try {
423
			retNode = TypeFactory.convertTypeFromType(node, Node.class);
424
		} catch (Exception e) {
425
			// report as service failure
426
			ServiceFailure sf = new ServiceFailure("4801", e.getMessage());
427
			sf.initCause(e);
428
			throw sf;
429
		}
430
		return retNode;
431
	}
432

    
433
	@Override
434
	public Log getLogRecords(Date fromDate, Date toDate, Event event,
435
			String pidFilter, Integer start, Integer count) throws InvalidRequest, InvalidToken,
436
			NotAuthorized, NotImplemented, ServiceFailure {
437
		return this.getLogRecords(null, fromDate, toDate, event, pidFilter, start, count);
438
	}
439

    
440
	@Override
441
	@Deprecated
442
	public Log getLogRecords(Session session, Date fromDate, Date toDate, Event event,
443
			String pidFilter, Integer start, Integer count) throws InvalidRequest, InvalidToken,
444
			NotAuthorized, NotImplemented, ServiceFailure {
445
	    Log retLog = new Log();
446
	    if(pidFilter != null && !pidFilter.trim().equals("")) {
447
	        String serviceFailure = "1490";
448
	        String notFound = "1020";
449
	        Identifier pid = new Identifier();
450
	        pid.setValue(pidFilter);
451
	        try {
452
	            impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object for given PID "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
453
	                    "The given PID: "+pid.getValue()+" doesn't exist in this node");
454
	        } catch (NotFound e) {
455
	            //return 0 record since the pid doesn't exist
456
	            logMetacat.info(e.getMessage());
457
	            return retLog;
458
	        }
459
	        
460
	    }
461
	   
462
	    String eventValue = null;
463
	    if(event != null) {
464
	        eventValue = event.xmlValue();
465
	    }
466
		org.dataone.service.types.v2.Log log = impl.getLogRecords(session, fromDate, toDate, eventValue, pidFilter, start, count);
467
		
468
		try {
469
			retLog = TypeFactory.convertTypeFromType(log, Log.class);
470
		    //LogV2toV1Converter converter = new LogV2toV1Converter();
471
		   // retLog = converter.convert(log);
472
		} catch (Exception e) {
473
			// report as service failure
474
			ServiceFailure sf = new ServiceFailure("1490", e.getMessage());
475
			sf.initCause(e);
476
			throw sf;
477
		}
478
		return retLog;
479
	}
480

    
481
	@Override
482
	public Date ping() throws NotImplemented, ServiceFailure,
483
			InsufficientResources {
484
		return impl.ping();
485
	}
486

    
487
	@Override
488
	public boolean isAuthorized(Identifier pid, Permission permission)
489
			throws ServiceFailure, InvalidRequest, InvalidToken, NotFound,
490
			NotAuthorized, NotImplemented {
491
	    String serviceFailure = "1760";
492
        String notFound = "1800";
493
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
494
                "The object specified by "+pid.getValue()+" does not exist at this node.");
495
		return impl.isAuthorized(null, pid, permission);
496
	}
497

    
498
	@Override
499
	@Deprecated
500
	public boolean isAuthorized(Session session, Identifier pid, Permission permission)
501
			throws ServiceFailure, InvalidRequest, InvalidToken, NotFound,
502
			NotAuthorized, NotImplemented {
503
	    String serviceFailure = "1760";
504
        String notFound = "1800";
505
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
506
                "The object specified by "+pid.getValue()+" does not exist at this node.");
507
		return impl.isAuthorized(session, pid, permission);
508
	}
509

    
510
	@Override
511
	public boolean systemMetadataChanged(Identifier pid, long serialVersion, Date dateSysMetaLastModified)
512
			throws InvalidToken, ServiceFailure, NotAuthorized, NotImplemented,
513
			InvalidRequest {
514
	    String serviceFailure = "1333";
515
        String notFound = "1800";
516
        try {
517
            impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The system metadata of the object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
518
                    "The system metadata of the object specified by "+pid.getValue()+" does not exist at this node.");
519
        } catch (NotFound e) {
520
            throw new ServiceFailure(serviceFailure, e.getMessage());
521
        }
522
        boolean needCheckAuthoriativeNode = false; 
523
		return impl.systemMetadataChanged(needCheckAuthoriativeNode, null, pid, serialVersion, dateSysMetaLastModified);
524

    
525
	}
526

    
527
	@Override
528
	@Deprecated
529
	public boolean systemMetadataChanged(Session session, Identifier pid,
530
			long serialVersion, Date dateSysMetaLastModified) throws InvalidToken, ServiceFailure,
531
			NotAuthorized, NotImplemented, InvalidRequest {
532
	    String serviceFailure = "1333";
533
        String notFound = "1800";
534
        try {
535
            impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The system metadata of the object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
536
                    "The system metadata of the object specified by "+pid.getValue()+" does not exist at this node.");
537
        } catch (NotFound e) {
538
            throw new ServiceFailure(serviceFailure, e.getMessage());
539
        }
540
        boolean needCheckAuthoriativeNode = false; 
541
		return impl.systemMetadataChanged(needCheckAuthoriativeNode,session, pid, serialVersion, dateSysMetaLastModified);
542
	}
543
    
544
	// methods not defined in v1, but implemented in metacat pre-v2 release
545
	
546
	public Identifier publish(Session session, Identifier originalIdentifier) 
547
			throws InvalidToken, ServiceFailure, NotAuthorized, NotImplemented, InvalidRequest, NotFound, IdentifierNotUnique, UnsupportedType, InsufficientResources, InvalidSystemMetadata, IOException {
548
	    String serviceFailure = "1030";
549
        String notFound = "1020";
550
        impl.checkV1SystemMetaPidExist(originalIdentifier, serviceFailure, "The system metadata of the object specified by "+originalIdentifier.getValue()+" couldn't be identified if it exists",  notFound, 
551
                    "The system metadata of the object specified by "+originalIdentifier.getValue()+" does not exist at this node.");
552
		return impl.publish(session, originalIdentifier);
553
		
554
	}
555
	
556
	public InputStream view(Session session, String format, Identifier pid)
557
			throws InvalidToken, ServiceFailure, NotAuthorized, InvalidRequest,
558
			NotImplemented, NotFound {
559
	    String serviceFailure = "2831";
560
        String notFound = "2835";
561
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The system metadata of the object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
562
                    "The system metadata of the object specified by "+pid.getValue()+" does not exist at this node.");
563
       
564
		return impl.view(session, format, pid);
565
	}
566
	
567
	public InputStream getPackage(Session session, ObjectFormatIdentifier formatId,
568
			Identifier pid) throws InvalidToken, ServiceFailure,
569
			NotAuthorized, InvalidRequest, NotImplemented, NotFound {
570
	    String serviceFailure = "2871";
571
        String notFound = "2875";
572
        impl.checkV1SystemMetaPidExist(pid, serviceFailure, "The system metadata of the object specified by "+pid.getValue()+" couldn't be identified if it exists",  notFound, 
573
                    "The system metadata of the object specified by "+pid.getValue()+" does not exist at this node.");
574
        
575
		return impl.getPackage(session, formatId, pid);
576
	}
577
	
578
    
579

    
580
   
581
}
(2-2/2)