Revision 9347
Added by Jing Tao about 9 years ago
src/edu/ucsb/nceas/metacat/dataone/CNodeService.java | ||
---|---|---|
1836 | 1836 |
/** |
1837 | 1837 |
* Set access for a given object using the object identifier and a Subject |
1838 | 1838 |
* under a given Session. |
1839 |
* |
|
1839 |
* This method only applies the objects whose authoritative mn is a v1 node.
|
|
1840 | 1840 |
* @param session - the Session object containing the credentials for the Subject |
1841 | 1841 |
* @param pid - the object identifier for the given object to apply the policy |
1842 | 1842 |
* @param policy - the access policy to be applied |
... | ... | |
1902 | 1902 |
|
1903 | 1903 |
} |
1904 | 1904 |
|
1905 |
D1NodeVersionChecker checker = new D1NodeVersionChecker(systemMetadata.getAuthoritativeMemberNode()); |
|
1906 |
String version = checker.getVersion("MNStorage"); |
|
1907 |
if(version == null) { |
|
1908 |
throw new ServiceFailure("4430", "Couldn't determine the version of the MNStorge for the "+pid.getValue()); |
|
1909 |
} else if (version.equalsIgnoreCase(D1NodeVersionChecker.V2)) { |
|
1910 |
//we don't apply this method to an object whose authoritative node is v2 |
|
1911 |
throw new NotAuthorized("4420", V2V1MISSMATCH); |
|
1912 |
} else if (!version.equalsIgnoreCase(D1NodeVersionChecker.V1)) { |
|
1913 |
//we don't understand this version (it is not v1 or v2) |
|
1914 |
throw new InvalidRequest("4402", "The version of the MNStorage is "+version+" for the authoritative member node of the object "+pid.getValue()+". We don't support it."); |
|
1915 |
} |
|
1916 |
|
|
1905 | 1917 |
} catch (RuntimeException e) { |
1906 | 1918 |
// convert Hazelcast RuntimeException to NotFound |
1907 | 1919 |
throw new NotFound("4400", "No record found for: " + pid); |
Also available in: Unified diff
Only applies the setAccessPolicy method to objects whose authoritative mn is v1.