|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codeforamerica.open311.internals.caching.AbstractCache
public abstract class AbstractCache
Implements all the operations of the Cache
interface. Classes which
extend this will have to implement the abstract methods.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.codeforamerica.open311.internals.caching.Cache |
---|
Cache.CacheableOperation |
Field Summary | |
---|---|
protected static String |
FILE
|
Constructor Summary | |
---|---|
AbstractCache()
|
Method Summary | |
---|---|
protected abstract String |
getProperty(String key)
Retrieves a property. |
ServiceDefinition |
retrieveCachedServiceDefinition(String endpointUrl,
String serviceCode)
Looks for a cached service definition. |
ServiceDiscoveryInfo |
retrieveCachedServiceDiscoveryInfo(City city)
Looks for the service discovery of a given city in the local cache. |
List<Service> |
retrieveCachedServiceList(String endpointUrl)
Looks for a cached list of services. |
ServiceRequest |
retrieveCachedServiceRequest(String endpointUrl,
String serviceRequestId)
Looks for a cached GET service request response. |
List<ServiceRequest> |
retrieveCachedServiceRequests(String endpointUrl,
GETServiceRequestsFilter filter)
Looks for a cached GET service requests response. |
String |
retrieveCitiesInfo()
Looks for the endpoints-service discovery relationships. |
void |
saveCitiesInfo(String data)
Saves the endpoints-service discovery relationships. |
void |
saveListOfServices(String endpointUrl,
List<Service> services)
Saves a list of Service objects related to an endpoint. |
protected abstract void |
saveProperty(String key,
String value)
Saves a property. |
void |
saveServiceDefinition(String endpointUrl,
String serviceCode,
ServiceDefinition serviceDefinition)
Saves a service definition. |
void |
saveServiceDiscovery(City city,
ServiceDiscoveryInfo serviceDiscovery)
Saves a object related to a city. |
void |
saveServiceRequestList(String endpointUrl,
GETServiceRequestsFilter filter,
List<ServiceRequest> requests)
Saves a list of service requests. |
void |
saveSingleServiceRequest(String endpointUrl,
String serviceRequestId,
ServiceRequest request)
Saves a service request. |
void |
setCustomTimeToLive(Cache.CacheableOperation operation,
int timeToLiveInHours)
Set a custom time to live to a given operation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.codeforamerica.open311.internals.caching.Cache |
---|
deleteCache |
Field Detail |
---|
protected static final String FILE
Constructor Detail |
---|
public AbstractCache()
Method Detail |
---|
public void saveCitiesInfo(String data)
Cache
saveCitiesInfo
in interface Cache
data
- A JSON list.public String retrieveCitiesInfo()
Cache
retrieveCitiesInfo
in interface Cache
null
if it wasn't found.public void saveServiceDiscovery(City city, ServiceDiscoveryInfo serviceDiscovery)
Cache
object
related to a city.
saveServiceDiscovery
in interface Cache
city
- City related to the requested service discovery.serviceDiscovery
- The obtained service discovery.public ServiceDiscoveryInfo retrieveCachedServiceDiscoveryInfo(City city)
Cache
retrieveCachedServiceDiscoveryInfo
in interface Cache
city
- City of interest.
null
if
it isn't cached.public void saveListOfServices(String endpointUrl, List<Service> services)
Cache
Service
objects related to an endpoint.
saveListOfServices
in interface Cache
endpointUrl
- Url of the endpoint.services
- Obtained services.public List<Service> retrieveCachedServiceList(String endpointUrl)
Cache
retrieveCachedServiceList
in interface Cache
endpointUrl
- Url of the endpoint.
null
if they aren't cached.public void saveServiceDefinition(String endpointUrl, String serviceCode, ServiceDefinition serviceDefinition)
Cache
saveServiceDefinition
in interface Cache
endpointUrl
- Url of the endpoint.serviceCode
- Code of the service.serviceDefinition
- Obtained definition from the server.public ServiceDefinition retrieveCachedServiceDefinition(String endpointUrl, String serviceCode)
Cache
retrieveCachedServiceDefinition
in interface Cache
endpointUrl
- Url of the endpoint.serviceCode
- Service code of the desired service.
null
if it isn't cached.public void saveServiceRequestList(String endpointUrl, GETServiceRequestsFilter filter, List<ServiceRequest> requests)
Cache
saveServiceRequestList
in interface Cache
endpointUrl
- Url of the endpoint.filter
- Filter sent to the endpoint.requests
- Obtained list of requests.public List<ServiceRequest> retrieveCachedServiceRequests(String endpointUrl, GETServiceRequestsFilter filter)
Cache
retrieveCachedServiceRequests
in interface Cache
endpointUrl
- Url of the endpoint.filter
- The desired filter.
null
if they aren't
cached.public void saveSingleServiceRequest(String endpointUrl, String serviceRequestId, ServiceRequest request)
Cache
saveSingleServiceRequest
in interface Cache
endpointUrl
- Url of the endpoint.serviceRequestId
- Id of the requested service request.request
- Obtained service request.public ServiceRequest retrieveCachedServiceRequest(String endpointUrl, String serviceRequestId)
Cache
retrieveCachedServiceRequest
in interface Cache
endpointUrl
- Url of the endpoint.serviceRequestId
- The service request's id.
null
if it wasn't cached.public void setCustomTimeToLive(Cache.CacheableOperation operation, int timeToLiveInHours)
Cache
setCustomTimeToLive
in interface Cache
operation
- Operation which time to live will be changed.timeToLiveInHours
- New time to live (in hours).protected abstract void saveProperty(String key, String value)
null
strings are not allowed).
key
- Key of the property.value
- Value of the property.protected abstract String getProperty(String key)
key
- Key of the property (empty or null
strings are
not allowed).
null
if the key doesn't exist.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |