Package nz.org.riskscape.engine.resource
Class CreateHandle
java.lang.Object
nz.org.riskscape.engine.resource.CreateHandle
A sort of transaction handle for saving resources to allow various housekeeping to be applied by various protocols
that allow storage. Overkill for a filesystem API, but will be helpful/necessary for more sophisticated backends
and gives us a place to extend the API without requiring the ResourceFactory.create(CreateRequest)
method to
change.
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
abstract OutputStream
The original request made to save a resourceint
hashCode()
abstract URI
store()
Store data written to the handle, returning the URI it is now available at.store
(CreateHandle.Callback callback) Provide a callback that will store bytes associated with the resource.toString()
-
Constructor Details
-
CreateHandle
-
-
Method Details
-
store
Provide a callback that will store bytes associated with the resource.
- Returns:
- URI a location where the successfully stored data can be accessed
- Throws:
CreateException
- if something unforseen happened when trying to store bytes. Typically this is going to be out of the user's hands here, e.g. no space, connectivity error, etc
-
getOutputStream
- Returns:
- an
OutputStream
to use for writing data. - Throws:
CreateException
-
store
Store data written to the handle, returning the URI it is now available at. If getOutputStream hasn't been written too, strange things might happen when you call this (wowoooooo, spooky)
- Throws:
CreateException
-
getRequest
The original request made to save a resource
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-