Class HierarchyResolver
- java.lang.Object
-
- com.levigo.jadice.server.html.worker.request.HierarchyResolver
-
- All Implemented Interfaces:
StreamResolver
,Serializable
public class HierarchyResolver extends Object implements StreamResolver, Serializable
AStreamResolver
which searches the stream hierarchy upwards for a resolver which knows about streams it is asked for.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description HierarchyResolver(StreamDescriptor sd)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stream
getStream(String cid)
Retrieve the correspondingStream
by its stream identifier - here the cid (Content-ID).List<Stream>
getUnusedStreams()
Retrieve all streams that were not used so far.boolean
markUnused(String cid)
Mark aStream
as being unused and reset it to an unused state.
-
-
-
Constructor Detail
-
HierarchyResolver
public HierarchyResolver(StreamDescriptor sd)
-
-
Method Detail
-
getStream
public Stream getStream(String cid) throws IOException
Description copied from interface:StreamResolver
Retrieve the correspondingStream
by its stream identifier - here the cid (Content-ID).- Specified by:
getStream
in interfaceStreamResolver
- Parameters:
cid
- the Content-ID that identifies theStream
that shall be retrieved.- Returns:
- the correspondig
Stream
. - Throws:
IOException
- if reading a stream failed.
-
getUnusedStreams
public List<Stream> getUnusedStreams() throws IOException
Description copied from interface:StreamResolver
Retrieve all streams that were not used so far. Per definition, these streams are regarded when this method was called- Specified by:
getUnusedStreams
in interfaceStreamResolver
- Returns:
- unused streams
- Throws:
IOException
- in case of I/O errors
-
markUnused
public boolean markUnused(String cid)
Description copied from interface:StreamResolver
Mark aStream
as being unused and reset it to an unused state. This method can only be used once to add theStream
to the unused streams collection. In subsequent invocations it will only return if marking theStream
as unused succeeded once but will not add it to the collection of unused streams again.- Specified by:
markUnused
in interfaceStreamResolver
- Parameters:
cid
- the Content-ID that identifies theStream
that shall be retrieved.- Returns:
true
if resetting theStream
to an unused state succeeded otherwisefalse
.
-
-