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: cjones $'
7
 *     '$Date: 2011-06-21 15:42:23 -0700 (Tue, 21 Jun 2011) $'
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;
25

    
26
import java.io.InputStream;
27
import java.util.Date;
28

    
29
import org.dataone.service.exceptions.InvalidRequest;
30
import org.dataone.service.exceptions.InvalidToken;
31
import org.dataone.service.exceptions.NotAuthorized;
32
import org.dataone.service.exceptions.NotFound;
33
import org.dataone.service.exceptions.NotImplemented;
34
import org.dataone.service.exceptions.ServiceFailure;
35
import org.dataone.service.types.AccessPolicy;
36
import org.dataone.service.types.Checksum;
37
import org.dataone.service.types.Event;
38
import org.dataone.service.types.Identifier;
39
import org.dataone.service.types.Log;
40
import org.dataone.service.types.Permission;
41
import org.dataone.service.types.Session;
42
import org.dataone.service.types.SystemMetadata;
43

    
44
public abstract class D1NodeService {
45
  
46
	/* Methods common to CNCore and MNCore APIs */
47

    
48
	/**
49
	 * Return the log records associated with a given event between the start and 
50
	 * end dates listed given a particular Subject listed in the Session
51
	 * 
52
	 * @param session - the Session object containing the credentials for the Subject
53
	 * @param fromDate - the start date of the desired log records
54
	 * @param toDate - the end date of the desired log records
55
	 * 
56
	 * @return the desired log records
57
	 * 
58
	 * @throws InvalidToken
59
	 * @throws ServiceFailure
60
	 * @throws NotAuthorized
61
	 * @throws InvalidRequest
62
	 * @throws NotImplemented
63
	 */
64
	public Log getLogRecords(Session session, Date fromDate, Date toDate, 
65
      Event event) throws InvalidToken, ServiceFailure,
66
	    NotAuthorized, InvalidRequest, NotImplemented {
67

    
68
		return null;
69
	}
70
	
71
	/* End methods common to CNCore and MNCore APIs */
72

    
73
	/* Methods common to CNRead and MNRead APIs */
74
	
75
	/**
76
	 * Return the object identified by the given object identifier
77
	 * 
78
	 * @param session - the Session object containing the credentials for the Subject
79
	 * @param pid - the object identifier for the given object
80
	 * 
81
	 * @return inputStream - the input stream of the given object
82
	 * 
83
	 * @throws InvalidToken
84
	 * @throws ServiceFailure
85
	 * @throws NotAuthorized
86
	 * @throws InvalidRequest
87
	 * @throws NotImplemented
88
	 */
89
	public InputStream get(Session session, Identifier pid) 
90
	  throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, 
91
	  NotImplemented, InvalidRequest {
92

    
93
		return null;
94
	}
95

    
96
	/**
97
	 * Return the system metadata for a given object
98
	 * 
99
	 * @param session - the Session object containing the credentials for the Subject
100
	 * @param pid - the object identifier for the given object
101
	 * 
102
	 * @return inputStream - the input stream of the given system metadata object
103
	 * 
104
	 * @throws InvalidToken
105
	 * @throws ServiceFailure
106
	 * @throws NotAuthorized
107
	 * @throws NotFound
108
	 * @throws InvalidRequest
109
	 * @throws NotImplemented
110
	 */
111
	public SystemMetadata getSystemMetadata(Session session, Identifier pid)
112
    throws InvalidToken, ServiceFailure, NotAuthorized, NotFound,
113
    InvalidRequest, NotImplemented {
114

    
115
		return null;
116
  }
117

    
118
	/**
119
	 * Return a checksum of the object given the object identifier and the name
120
	 * of the checksum algorithm (the default being SHA-1)
121
	 * 
122
	 * @param session - the Session object containing the credentials for the Subject
123
	 * @param pid - the object identifier for the given object
124
	 * @param algorithm - the name of the checksum algorithm to be used
125
	 * @return
126
	 * @throws InvalidToken
127
	 * @throws ServiceFailure
128
	 * @throws NotAuthorized
129
	 * @throws NotFound
130
	 * @throws InvalidRequest
131
	 * @throws NotImplemented
132
	 */
133
	/* TODO: CNRead and MNRead have different getChecksum() signatures. Reconcile this first.
134
	public Checksum getChecksum(Session session, Identifier pid, String algorithm)
135
    throws InvalidToken, ServiceFailure, NotAuthorized, NotFound,
136
    InvalidRequest, NotImplemented {
137

    
138
		return null;
139
  
140
  }
141
  */
142
	
143
	/* End methods common to CNRead and MNRead APIs */
144

    
145
	/* Methods common to CNAuthorization and MNAuthorization APIs */
146
  
147
	/**
148
   * Determine if a particular operation can be performed on an object given
149
   * by the Subject identified in the Session.
150
   * 	 
151
   * @param session - the Session object containing the credentials for the Subject
152
	 * @param pid - the object identifier for the given object to determine authorization
153
	 * @param operation - the permission to check for authorization
154
	 * 
155
   * @return true or false
156
	 * @throws InvalidToken
157
	 * @throws ServiceFailure
158
	 * @throws NotFound
159
	 * @throws NotAuthorized
160
	 * @throws NotImplemented
161
	 * @throws InvalidRequest
162
   */
163
	public boolean isAuthorized(Session session, Identifier pid, Permission operation)
164
	  throws ServiceFailure, InvalidRequest, InvalidToken, NotFound,
165
	  NotAuthorized, NotImplemented {
166
    
167
		return false;
168
	}
169

    
170
	/**
171
	 * Set access for a given object using the object identifier and a Subject
172
	 * under a given Session.
173
	 * 
174
	 * @param session - the Session object containing the credentials for the Subject
175
	 * @param pid - the object identifier for the given object to apply the policy
176
	 * @param policy - the access policy to be applied
177
	 * 
178
	 * @return true or false
179
	 * @throws InvalidToken
180
	 * @throws ServiceFailure
181
	 * @throws NotFound
182
	 * @throws NotAuthorized
183
	 * @throws NotImplemented
184
	 * @throws InvalidRequest
185
	 */
186
	public boolean setAccessPolicy(Session session, Identifier pid, 
187
    AccessPolicy policy) 
188
	  throws InvalidToken, ServiceFailure, NotFound, NotAuthorized, 
189
	  NotImplemented, InvalidRequest {
190

    
191
		return false;
192
	}
193

    
194
	/* End methods common to CNAuthorization and MNAuthorization APIs */
195

    
196
}
(3-3/6)