Revision 9032
Added by Jing Tao over 9 years ago
CNodeService.java | ||
---|---|---|
24 | 24 |
package edu.ucsb.nceas.metacat.dataone.v1; |
25 | 25 |
|
26 | 26 |
import java.io.InputStream; |
27 |
import java.sql.SQLException; |
|
27 | 28 |
import java.util.Date; |
28 | 29 |
|
29 | 30 |
import javax.servlet.http.HttpServletRequest; |
... | ... | |
70 | 71 |
import org.dataone.service.types.v1_1.QueryEngineList; |
71 | 72 |
import org.dataone.service.util.TypeMarshaller; |
72 | 73 |
|
74 |
import edu.ucsb.nceas.metacat.IdentifierManager; |
|
75 |
|
|
73 | 76 |
/** |
74 | 77 |
* Represents Metacat's implementation of the DataONE Coordinating Node service |
75 | 78 |
* API. Methods implement the various CN* interfaces, and methods common to both |
... | ... | |
205 | 208 |
@Override |
206 | 209 |
public InputStream get(Identifier pid) throws InvalidToken, |
207 | 210 |
ServiceFailure, NotAuthorized, NotFound, NotImplemented { |
211 |
boolean exists = false; |
|
212 |
try { |
|
213 |
exists = IdentifierManager.getInstance().systemMetadataPIDExists(pid); |
|
214 |
} catch (SQLException e) { |
|
215 |
throw new ServiceFailure("1030", "The object specified by "+ pid.getValue()+ |
|
216 |
" couldn't be identified if it exists at this node since "+e.getMessage()); |
|
217 |
} |
|
218 |
if(!exists) { |
|
219 |
//the v1 method only handles a pid. |
|
220 |
throw new NotFound("1020", "The object specified by "+pid.getValue()+" does not exist at this node"); |
|
221 |
} |
|
208 | 222 |
return impl.get(null, pid); |
209 | 223 |
} |
210 | 224 |
|
... | ... | |
212 | 226 |
@Deprecated |
213 | 227 |
public InputStream get(Session session, Identifier pid) throws InvalidToken, |
214 | 228 |
ServiceFailure, NotAuthorized, NotFound, NotImplemented { |
229 |
boolean exists = false; |
|
230 |
try { |
|
231 |
exists = IdentifierManager.getInstance().systemMetadataPIDExists(pid); |
|
232 |
} catch (SQLException e) { |
|
233 |
throw new ServiceFailure("1030", "The object specified by "+ pid.getValue()+ |
|
234 |
" couldn't be identified if it exists at this node since "+e.getMessage()); |
|
235 |
} |
|
236 |
if(!exists) { |
|
237 |
//the v1 method only handles a pid. |
|
238 |
throw new NotFound("1020", "The object specified by "+pid.getValue()+" does not exist at this node"); |
|
239 |
} |
|
215 | 240 |
return impl.get(session, pid); |
216 | 241 |
} |
217 | 242 |
|
Also available in: Unified diff
Modified the get method to handle the sid in the v2 api.