Revision 9036
Added by Jing Tao over 9 years ago
D1NodeService.java | ||
---|---|---|
169 | 169 |
*/ |
170 | 170 |
public DescribeResponse describe(Session session, Identifier pid) |
171 | 171 |
throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented { |
172 |
|
|
173 |
String serviceFailureCode = "4931"; |
|
174 |
Identifier sid = getPIDForSID(pid, serviceFailureCode); |
|
175 |
if(sid != null) { |
|
176 |
pid = sid; |
|
177 |
} |
|
172 | 178 |
|
173 | 179 |
// get system metadata and construct the describe response |
174 | 180 |
SystemMetadata sysmeta = getSystemMetadata(session, pid); |
... | ... | |
1674 | 1680 |
* @throws ServiceFailure |
1675 | 1681 |
* @throws NotFound |
1676 | 1682 |
*/ |
1677 |
public void checkV1SystemMetaPidExist(Identifier identifier, String serviceFailureCode, String noFoundCode) throws ServiceFailure, NotFound { |
|
1683 |
public void checkV1SystemMetaPidExist(Identifier identifier, String serviceFailureCode, String serviceFailureMessage, |
|
1684 |
String noFoundCode, String notFoundMessage) throws ServiceFailure, NotFound { |
|
1678 | 1685 |
boolean exists = false; |
1679 | 1686 |
try { |
1680 | 1687 |
exists = IdentifierManager.getInstance().systemMetadataPIDExists(identifier); |
1681 | 1688 |
} catch (SQLException e) { |
1682 |
throw new ServiceFailure(serviceFailureCode, "The object specified by "+ identifier.getValue()+ |
|
1683 |
" couldn't be identified if it exists at this node since "+e.getMessage()); |
|
1689 |
throw new ServiceFailure(serviceFailureCode, serviceFailureMessage+" since "+e.getMessage()); |
|
1684 | 1690 |
} |
1685 | 1691 |
if(!exists) { |
1686 | 1692 |
//the v1 method only handles a pid. |
1687 |
throw new NotFound(noFoundCode, "The object specified by "+identifier.getValue()+" does not exist at this node");
|
|
1693 |
throw new NotFound(noFoundCode, notFoundMessage);
|
|
1688 | 1694 |
} |
1689 | 1695 |
} |
1690 | 1696 |
|
... | ... | |
1698 | 1704 |
*/ |
1699 | 1705 |
protected Identifier getPIDForSID(Identifier sid, String serviceFailureCode) throws ServiceFailure { |
1700 | 1706 |
Identifier id = null; |
1707 |
String serviceFailureMessage = "The PID "+" couldn't be identified for the sid " + sid.getValue(); |
|
1701 | 1708 |
try { |
1702 | 1709 |
//determine if the given pid is a sid or not. |
1703 | 1710 |
if(IdentifierManager.getInstance().systemMetadataSIDExists(sid)) { |
... | ... | |
1705 | 1712 |
//set the header pid for the sid if the identifier is a sid. |
1706 | 1713 |
id = IdentifierManager.getInstance().getHeadPID(sid); |
1707 | 1714 |
} catch (SQLException sqle) { |
1708 |
throw new ServiceFailure(serviceFailureCode, "The current pid associated with the sid "+ sid.getValue()+ |
|
1709 |
" couldn't be identified at this node since "+sqle.getMessage()); |
|
1715 |
throw new ServiceFailure(serviceFailureCode, serviceFailureMessage+" since "+sqle.getMessage()); |
|
1710 | 1716 |
} |
1711 | 1717 |
|
1712 | 1718 |
} |
1713 | 1719 |
} catch (SQLException e) { |
1714 |
throw new ServiceFailure(serviceFailureCode, "The object specified by "+ sid.getValue()+ |
|
1715 |
" couldn't be identified at this node since "+e.getMessage()); |
|
1720 |
throw new ServiceFailure(serviceFailureCode, serviceFailureMessage + " since "+e.getMessage()); |
|
1716 | 1721 |
} |
1717 | 1722 |
return id; |
1718 | 1723 |
} |
Also available in: Unified diff
Looking for sid for the method describe.