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-01-26 16:52:51 -0800 (Mon, 26 Jan 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.InputStream;
27
import java.sql.SQLException;
28
import java.util.Date;
29

    
30
import javax.servlet.http.HttpServletRequest;
31

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
523
	}
524

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

    
577
   
578
}
(2-2/2)