org.fourthline.cling.model.resource
Class Resource<M>

java.lang.Object
  extended by org.fourthline.cling.model.resource.Resource<M>
Type Parameters:
M - The type of the model object.
Direct Known Subclasses:
DeviceDescriptorResource, IconResource, ServiceControlResource, ServiceDescriptorResource, ServiceEventCallbackResource, ServiceEventSubscriptionResource

public class Resource<M>
extends Object

An addressable object, stored, managed, and accessible through the Registry.

Author:
Christian Bauer

Constructor Summary
Resource(URI pathQuery, M model)
           
 
Method Summary
 boolean equals(Object o)
           
 M getModel()
           
 URI getPathQuery()
           
 int hashCode()
           
 void maintain(List<Runnable> pendingExecutions, ExpirationDetails expirationDetails)
          Called periodically by the registry to maintain the resource.
 boolean matches(URI pathQuery)
           
 void shutdown()
          Called by the registry when it stops, in the shutdown thread.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Resource

public Resource(URI pathQuery,
                M model)
Parameters:
pathQuery - The path and (optional) query URI parts of this resource.
model - The model object.
Method Detail

getPathQuery

public URI getPathQuery()

getModel

public M getModel()

matches

public boolean matches(URI pathQuery)
Parameters:
pathQuery - A relative URI.
Returns:
true if the given URI path and query matches the resource's path and query.

maintain

public void maintain(List<Runnable> pendingExecutions,
                     ExpirationDetails expirationDetails)
Called periodically by the registry to maintain the resource.

NOOP by default.

Parameters:
pendingExecutions - Add Runnable's to this collection if maintenance code has to run in the background.
expirationDetails - The details of this resource's expiration, e.g. when it will expire.

shutdown

public void shutdown()
Called by the registry when it stops, in the shutdown thread.

NOOP by default.


equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 4th Line GmbH, Switzerland. All Rights Reserved.