Question
I have created a bare object in Fedora and I am trying to add in a dataStream via the REST API. However, I get the following error (in fedora.log) even though it looks like the datastream was added (which it was not). This is Fedora 3.3.
INFO 2010-02-07 16:06:35.417 http-8080-4 (DefaultManagement) Completed addDatastream(pid: eureka:22, dsID: Source, altIDs: , dsLabel: Source file, versionable: true, MIMEType: application/pdf, formatURI: null, dsLocation: file:///Users/test.pdf
, controlGroup: M, dsState: A, checksumType: null, checksum: null, logMessage: Added source)
ERROR 2010-02-07 16:06:35.418 http-8080-4 (DatastreamResource) Unexpected error fulfilling REST API request
fedora.server.errors.HttpServiceNotFoundException: DefaultExternalContentManager returned an error. The underlying error was a fedora.server.errors.HttpServiceNotFoundException
The message was "Policy blocked datastream resolution" .
at fedora.server.storage.DefaultExternalContentManager.getExternalContent(DefaultExternalContentManager.java:145)
at fedora.server.storage.DefaultDOManager.doCommit(DefaultDOManager.java:1198)
at fedora.server.storage.SimpleDOWriter.commit(SimpleDOWriter.java:498)
at fedora.server.management.DefaultManagement.addDatastream(DefaultManagement.java:527)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
...
I've been trying to find the right place where the policy is defined but cannot locate it.
Answer
The policy which is responsible for blocking the resolution of this datastream URI is located in deny-unallowed-file-resolution.xml (see fedora.fcfg for the repository policies directory).
The file also contains an example rule how to selectively enable file:// URIs. If you remove the comments and adapt the regex to your file's location the addDatastream operation should work.
The "Completed addDatastream(..)" log message you are referring to is probably a bit misleading in this context. What it intends to say is that the code block was executed successfully independent of the
operation's outcome (there's an issue for that: http://fedora-commons.org/jira/browse/FCREPO-629).