|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcitysdk.tourism.client.requests.TourismClient
public class TourismClient
Stub used for the CitySDK Tourism API. It abstracts applications from the different requests allowed in the API and returns the correct data objects from such calls. The stub also provides a logging mechanism defaulting to INFO level messages.
| Method Summary | |
|---|---|
java.util.Set<java.lang.String> |
getAvailableResources()
Gets all the available resources of a given version for the queried server. |
ListPOIS |
getByCode(java.lang.String code)
Gets all POI-based objects containing the given code |
Category |
getCategories(ParameterList list)
Returns the list of Category
available. |
Event |
getEvent(java.lang.String eventBase,
java.lang.String eventId)
Returns the description of a given Event. |
ListEvent |
getEventRelation(java.lang.String id,
Term relation)
Returns a list of Events with the given relation with the POI identified by id. |
ListEvent |
getEvents(ParameterList parameterList)
Returns a list of Events following the desired parameters. |
POI |
getGeneric(java.lang.String base,
java.lang.String id)
Returns a generic object matching the given base and id |
PointOfInterest |
getPoi(java.lang.String poiBase,
java.lang.String poiId)
Returns the complete description of a given POI. |
ListPointOfInterest |
getPoiRelation(java.lang.String id,
Term relation)
Returns a list of Points of Interest with the given relation with the POI identified by id. |
ListPointOfInterest |
getPois(ParameterList parameterList)
Returns a list of POIs following the desired parameters. |
Route |
getRoute(java.lang.String routeBase,
java.lang.String routeId)
Returns the description of a given Route and its POIs. |
ListRoute |
getRoutes(ParameterList parameterList)
Returns a list of Routes following the desired parameters. |
ListTag |
getTags(ParameterList list)
Returns the list of ListTag
available. |
java.lang.String |
getVersion()
|
boolean |
hasAnyResourcesOf(ResourceTerms resource)
Checks whether the server has any resources of POIs, Events or Routes in a given version. |
boolean |
hasResource(ResourceTerms resource)
Verifies if the client has a given resource |
boolean |
hasResourceParameter(ResourceTerms resource,
ParameterTerms parameter)
Checks whether a given resource is available for the queried server. |
void |
setLoggingLevel(java.util.logging.Level level)
Set the logging level for the logger |
void |
useVersion(java.lang.String version)
Set the version to use by the stub |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public void setLoggingLevel(java.util.logging.Level level)
level - the wanted levelpublic java.lang.String getVersion()
public void useVersion(java.lang.String version)
version - the version to use
public java.util.Set<java.lang.String> getAvailableResources()
throws VersionNotAvailableException
VersionNotAvailableException - thrown if a previously set version is not available
public boolean hasResource(ResourceTerms resource)
throws VersionNotAvailableException
resource - the resource to find
true if the resource is present, false
otherwise
VersionNotAvailableException - thrown if the version is not supported
public boolean hasAnyResourcesOf(ResourceTerms resource)
throws VersionNotAvailableException,
InvalidResourceTermException
resource - the term to search for. It must be RESOURCE_POIS,
RESOURCE_EVENTS or RESOURCE_ROUTES, otherwise it will return
false.
true if the server has any given capacity of the
referred term, false otherwise.
VersionNotAvailableException - thrown if a previously set version is not available
InvalidResourceTermException - thrown if the resource term is not one of the presented terms
public boolean hasResourceParameter(ResourceTerms resource,
ParameterTerms parameter)
throws VersionNotAvailableException
resource - the wanted resourceparameter - a given search parameter.
true if available, false otherwise.
VersionNotAvailableException - thrown if a previously set version is not available
public ListPointOfInterest getPois(ParameterList parameterList)
throws InvalidParameterException,
java.io.IOException,
ResourceNotAllowedException,
UnknownErrorException,
ServerErrorException,
VersionNotAvailableException
InvalidParameterException.
parameterList - the parameters that should be followed.
ListPointOfInterest.
InvalidParameterException - thrown if the given parameterList contains invalid terms.
java.io.IOException - thrown in case of socket errors.
ResourceNotAllowedException - thrown if the server does not support POIs listing
UnknownErrorException - thrown in case of unforeseen errors.
ServerErrorException - thrown if the server returns a code different from HTTP 200
OK.
VersionNotAvailableException - thrown if a previously set version is not available
public ListEvent getEvents(ParameterList parameterList)
throws InvalidParameterException,
java.io.IOException,
ResourceNotAllowedException,
UnknownErrorException,
ServerErrorException,
VersionNotAvailableException
InvalidParameterException.
parameterList - the parameters that should be followed.
ListEvent.
InvalidParameterException - thrown if the given parameterList contains invalid terms.
java.io.IOException - thrown in case of socket errors.
ResourceNotAllowedException - thrown if the server does not support events listing
UnknownErrorException - thrown in case of unforeseen errors.
ServerErrorException - thrown if the server returns a code different from HTTP 200
OK.
VersionNotAvailableException - thrown if a previously set version is not available
public ListRoute getRoutes(ParameterList parameterList)
throws InvalidParameterException,
java.io.IOException,
ResourceNotAllowedException,
UnknownErrorException,
ServerErrorException,
VersionNotAvailableException
InvalidParameterException.
parameterList - the parameters that should be followed.
ListRoute.
InvalidParameterException - thrown if the given parameterList contains invalid terms.
java.io.IOException - thrown in case of socket errors.
ResourceNotAllowedException - thrown if the server does not support routes listing
UnknownErrorException - thrown in case of unforeseen errors.
ServerErrorException - thrown if the server returns a code different from HTTP 200
OK.
VersionNotAvailableException - thrown if a previously set version is not available
public Category getCategories(ParameterList list)
throws java.io.IOException,
UnknownErrorException,
InvalidParameterTermException,
ServerErrorException,
ResourceNotAllowedException,
VersionNotAvailableException
Category
available. The term should be either one of the following:
list - the parameters that should be followed. It should contain a
list with one of the above terms specified
Category.
java.io.IOException - thrown in case of socket errors.
UnknownErrorException - thrown in case of unforeseen errors.
InvalidParameterTermException - thrown if the term is not one of aforementioned valid terms.
ServerErrorException - thrown if the server returns a code different from HTTP 200
OK.
ResourceNotAllowedException - thrown if the server does not support category listing.
VersionNotAvailableException - thrown if a previously set version is not available.
public ListTag getTags(ParameterList list)
throws java.io.IOException,
UnknownErrorException,
ServerErrorException,
InvalidParameterTermException,
ResourceNotAllowedException,
VersionNotAvailableException
ListTag
available. The term should be either one of the following:
list - the parameters that should be followed. It should contain a
list with one of the above terms specified
ListTag.
java.io.IOException - thrown in case of socket errors.
UnknownErrorException - thrown in case of unforeseen errors.
InvalidParameterTermException - thrown if the term is not one of aforementioned valid terms.
ServerErrorException - thrown if the server returns a code different from HTTP 200
OK.
ResourceNotAllowedException - thrown if the server does not support tags listing.
VersionNotAvailableException - thrown if a previously set version is not available.
public PointOfInterest getPoi(java.lang.String poiBase,
java.lang.String poiId)
throws java.io.IOException,
UnknownErrorException,
ServerErrorException
poiBase - the base URL of the POI.poiId - the ID of the POI.
PointOfInterest
containing a complete description of the POI.
java.io.IOException - thrown in case of socket errors.
UnknownErrorException - thrown in case of unforeseen errors.
ServerErrorException - thrown if the server returns a code different from HTTP 200
OK.
public Event getEvent(java.lang.String eventBase,
java.lang.String eventId)
throws java.io.IOException,
UnknownErrorException,
ServerErrorException
eventBase - the base URL of the Event.eventId - the ID of the Event.
Event containing a
description of the Event.
java.io.IOException - thrown in case of socket errors.
UnknownErrorException - thrown in case of unforeseen errors.
ServerErrorException - thrown if the server returns a code different from HTTP 200
OK.
public Route getRoute(java.lang.String routeBase,
java.lang.String routeId)
throws java.io.IOException,
UnknownErrorException,
ServerErrorException
routeBase - the base URL of the Route.routeId - the ID of the Route.
Route containing a
description of the Route.
java.io.IOException - thrown in case of socket errors.
UnknownErrorException - thrown in case of unforeseen errors.
ServerErrorException - thrown if the server returns a code different from HTTP 200
OK.
public POI getGeneric(java.lang.String base,
java.lang.String id)
throws java.io.IOException,
UnknownErrorException,
ServerErrorException
base - the base URI of the POI objectid - the id of the POI object
java.io.IOException - thrown in case of socket errors.
UnknownErrorException - thrown in case of unforeseen errors.
ServerErrorException - thrown if the server returns a code different from HTTP 200
OK.
public ListPointOfInterest getPoiRelation(java.lang.String id,
Term relation)
throws VersionNotAvailableException,
InvalidValueException,
ResourceNotAllowedException,
java.io.IOException,
ServerErrorException,
UnknownErrorException
id - the id of the poi to find the relationsrelation - the wanted relation with the poi
ListPointOfInterest
java.io.IOException - thrown in case of socket errors.
ServerErrorException - thrown if the server returns a code different from HTTP 200
OK.
UnknownErrorException - thrown in case of unforeseen errors.
VersionNotAvailableException - thrown if a previously set version is not available
InvalidValueException - thrown if the relation is not one of the presented values
ResourceNotAllowedException - thrown if the server does not support POIs relationships
public ListEvent getEventRelation(java.lang.String id,
Term relation)
throws InvalidParameterTermException,
java.io.IOException,
ServerErrorException,
VersionNotAvailableException,
UnknownErrorException,
InvalidValueException,
ResourceNotAllowedException
id - the id of the event to find the relationsrelation - the wanted relation with the related event
ListEvent
java.io.IOException - thrown in case of socket errors.
ServerErrorException - thrown if the server returns a code different from HTTP 200
OK.
UnknownErrorException - thrown in case of unforeseen errors.
VersionNotAvailableException - thrown if a previously set version is not available
InvalidValueException - thrown if the relation is not one of the presented values
ResourceNotAllowedException - thrown if the server does not support event relations
InvalidParameterTermException
public ListPOIS getByCode(java.lang.String code)
throws ResourceNotAllowedException,
VersionNotAvailableException,
java.io.IOException,
ServerErrorException,
UnknownErrorException
code - a link to search for POI-based objects
ResourceNotAllowedException - thrown if search by code is not available
VersionNotAvailableException - thrown if the given version is not available
java.io.IOException - thrown in case of socket errors
ServerErrorException - thrown in case of a server error (returning code other than
HTTP 200 OK)
UnknownErrorException - thrown in case of unforseen errors
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||