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-22 06:12:57 -0700 (Wed, 22 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
	/* End methods common to CNRead and MNRead APIs */
119

    
120
	/* Methods common to CNAuthorization and MNAuthorization APIs */
121
  
122
	/**
123
   * Determine if a particular operation can be performed on an object given
124
   * by the Subject identified in the Session.
125
   * 	 
126
   * @param session - the Session object containing the credentials for the Subject
127
	 * @param pid - the object identifier for the given object to determine authorization
128
	 * @param operation - the permission to check for authorization
129
	 * 
130
   * @return true or false
131
	 * @throws InvalidToken
132
	 * @throws ServiceFailure
133
	 * @throws NotFound
134
	 * @throws NotAuthorized
135
	 * @throws NotImplemented
136
	 * @throws InvalidRequest
137
   */
138
	public boolean isAuthorized(Session session, Identifier pid, Permission operation)
139
	  throws ServiceFailure, InvalidRequest, InvalidToken, NotFound,
140
	  NotAuthorized, NotImplemented {
141
    
142
		return false;
143
	}
144

    
145
	/**
146
	 * Set access for a given object using the object identifier and a Subject
147
	 * under a given Session.
148
	 * 
149
	 * @param session - the Session object containing the credentials for the Subject
150
	 * @param pid - the object identifier for the given object to apply the policy
151
	 * @param policy - the access policy to be applied
152
	 * 
153
	 * @return true or false
154
	 * @throws InvalidToken
155
	 * @throws ServiceFailure
156
	 * @throws NotFound
157
	 * @throws NotAuthorized
158
	 * @throws NotImplemented
159
	 * @throws InvalidRequest
160
	 */
161
	public boolean setAccessPolicy(Session session, Identifier pid, 
162
    AccessPolicy policy) 
163
	  throws InvalidToken, ServiceFailure, NotFound, NotAuthorized, 
164
	  NotImplemented, InvalidRequest {
165

    
166
		return false;
167
	}
168

    
169
	/* End methods common to CNAuthorization and MNAuthorization APIs */
170

    
171
}
(3-3/6)