|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.sswap.ontologies.data.impl.AbstractData
info.sswap.ontologies.data.impl.ResourceData
public class ResourceData
Support for reading and writing resource data (data at the URL of an
individual; usually a SSWAPSubject
or SSWAPObject
).
Field Summary | |
---|---|
protected java.net.URLConnection |
urlConnection
|
Fields inherited from class info.sswap.ontologies.data.impl.AbstractData |
---|
DataFormatType, sswapDocument, sswapIndividual |
Constructor Summary | |
---|---|
ResourceData(SSWAPIndividual sswapIndividual)
Constructs an individual suitable for reading/writing data |
Method Summary | |
---|---|
java.net.URLConnection |
access(java.net.URLConnection urlConnection)
Default implementation just passes urlConnection untouched. |
void |
close()
Closes the URL connection and sets it to null. |
protected void |
finalize()
|
java.net.URLConnection |
getConnection()
Get the underlying URL connection. |
protected java.net.URL |
getURLConnection()
Return the first, valid Accessor URL, or the individual's URL if there are no accessors. |
java.io.InputStream |
readData()
Accesses, parses, and validates the data from the URL of the data individual. |
void |
writeData(java.io.InputStream inputStream)
Accesses, validates, and serializes the data to the URL of the data individual. |
Methods inherited from class info.sswap.ontologies.data.impl.AbstractData |
---|
getAccessors, getFormats, getIndividual, getParsers, getSerializers, getValidators, hasValue, inputStreamToString, parse, serialize, setValue, stringToInputStream, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.net.URLConnection urlConnection
Constructor Detail |
---|
public ResourceData(SSWAPIndividual sswapIndividual) throws DataException
sswapIndividual
- the subject data individual
DataException
- on any error establishing resource data supportMethod Detail |
---|
public java.io.InputStream readData() throws java.io.IOException, DataException
access
,
parse
, and validate
methods, any of which may
be overridden.
The data source must be of type data:DataFormat
for any
meaningful read; otherwise a read immediately "succeeds" with trivial
empty content.
readData
in interface Data
java.io.IOException
- on any read error
DataException
- on data error such as parsing, validating, etc.public void writeData(java.io.InputStream inputStream) throws java.io.IOException, DataException
access
,
validate
, and serialize
methods, any of which
may be overridden. Caller should close inputStream when done; opened URL
connection will be closed automatically on success only. On failure
(e.g., a thrown exception), use getConnection
to get
the underlying connection for error handling. Connection should be then
closed by caller when done.
writeData
in interface Data
inputStream
- data to be written
java.io.IOException
- on any write error
DataException
- on data error such as validating, serializing, etc.getConnection()
protected java.net.URL getURLConnection() throws DataException
DataException
- inability to establish any URL for this individualpublic java.net.URLConnection access(java.net.URLConnection urlConnection) throws java.io.IOException, AccessorException
access
in interface Accessor
urlConnection
- a URL connection opened on the data element individual (the
individual itself or one of its Accessors)
java.io.IOException
- on any connection error
AccessorException
- on any Accessor-specific errorHTTPBasicAuthImpl
public java.net.URLConnection getConnection()
public void close()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |