Package jmri.server.json.audio
Class JsonAudioHttpService
- java.lang.Object
-
- jmri.server.json.JsonHttpService
-
- jmri.server.json.JsonNonProvidedNamedBeanHttpService<T>
-
- jmri.server.json.JsonNamedBeanHttpService<Audio>
-
- jmri.server.json.audio.JsonAudioHttpService
-
public class JsonAudioHttpService extends JsonNamedBeanHttpService<Audio>
JSON HTTP Service forAudios.
-
-
Field Summary
-
Fields inherited from class jmri.server.json.JsonHttpService
mapper
-
-
Constructor Summary
Constructors Constructor Description JsonAudioHttpService(com.fasterxml.jackson.databind.ObjectMapper mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoDelete(Audio bean, java.lang.String name, java.lang.String type, com.fasterxml.jackson.databind.JsonNode data, JsonRequest request)Delete the requested bean.com.fasterxml.jackson.databind.node.ObjectNodedoGet(Audio audio, java.lang.String name, java.lang.String type, JsonRequest request)Respond to an HTTP GET request for the requested name.com.fasterxml.jackson.databind.node.ObjectNodedoPost(Audio audio, java.lang.String name, java.lang.String type, com.fasterxml.jackson.databind.JsonNode data, JsonRequest request)Respond to an HTTP POST request for the requested name.com.fasterxml.jackson.databind.JsonNodedoSchema(java.lang.String type, boolean server, JsonRequest request)Get the JSON Schema for thedataproperty of the requested type of JSON object.protected Manager<Audio>getManager()Get the expected manager for the supported JSON type.protected ProvidingManager<Audio>getProvidingManager()Get the expected providing manager for the supported JSON type.protected java.lang.StringgetType()Get the JSON type supported by this service.-
Methods inherited from class jmri.server.json.JsonNamedBeanHttpService
deleteBean, doDelete, doGet, doGetList, doPost, doPut, getNamedBean
-
Methods inherited from class jmri.server.json.JsonNonProvidedNamedBeanHttpService
doGetList, doGetList, getNamedBean, postNamedBean
-
Methods inherited from class jmri.server.json.JsonHttpService
acceptForceDeleteToken, doSchema, doSchema, getObjectMapper, message, message, message, message, message, throwDeleteConflictException
-
-
-
-
Constructor Detail
-
JsonAudioHttpService
public JsonAudioHttpService(com.fasterxml.jackson.databind.ObjectMapper mapper)
-
-
Method Detail
-
doGet
public com.fasterxml.jackson.databind.node.ObjectNode doGet(Audio audio, java.lang.String name, java.lang.String type, JsonRequest request) throws JsonException
Description copied from class:JsonNamedBeanHttpServiceRespond to an HTTP GET request for the requested name.If name is null, return a list of all objects for the given type, if appropriate.
This method should throw a 500 Internal Server Error if type is not recognized.
- Specified by:
doGetin classJsonNamedBeanHttpService<Audio>- Parameters:
audio- the requested objectname- the name of the requested objecttype- the type of the requested objectrequest- the JSON request- Returns:
- a JSON description of the requested object
- Throws:
JsonException- if the named object does not exist or other error occurs
-
doPost
public com.fasterxml.jackson.databind.node.ObjectNode doPost(Audio audio, java.lang.String name, java.lang.String type, com.fasterxml.jackson.databind.JsonNode data, JsonRequest request) throws JsonException
Description copied from class:JsonNamedBeanHttpServiceRespond to an HTTP POST request for the requested name.- Specified by:
doPostin classJsonNamedBeanHttpService<Audio>- Parameters:
audio- the requested objectname- the name of the requested objecttype- the type of the requested objectdata- data describing the requested objectrequest- the JSON request- Returns:
- a JSON description of the requested object
- Throws:
JsonException- if an error occurs
-
doDelete
protected void doDelete(Audio bean, java.lang.String name, java.lang.String type, com.fasterxml.jackson.databind.JsonNode data, JsonRequest request) throws JsonException
Description copied from class:JsonNamedBeanHttpServiceDelete the requested bean.This method must be overridden to allow a bean to be deleted. The simplest overriding method body is:
deleteBean(bean, name, type, data, locale, id);- Overrides:
doDeletein classJsonNamedBeanHttpService<Audio>- Parameters:
bean- the bean to deletename- the named of the bean to deletetype- the type of the bean to deletedata- data describing the named beanrequest- the JSON request- Throws:
JsonException- if an error occurs
-
doSchema
public com.fasterxml.jackson.databind.JsonNode doSchema(java.lang.String type, boolean server, JsonRequest request) throws JsonException
Description copied from class:JsonHttpServiceGet the JSON Schema for thedataproperty of the requested type of JSON object. It is a invalid for implementations to not return a valid schema that clients can use to validate a request to or response from the JSON services.Note that a schema must be contained in a standard object as:
{"type":"schema", "data":{"schema":<em>schema</em>, "server":boolean}}If using
JsonHttpService.doSchema(String, boolean, String, String, int), an implementation can be as simple as:return doSchema(type, server, "path/to/client/schema.json", "path/to/server/schema.json", id);- Specified by:
doSchemain classJsonHttpService- Parameters:
type- the type for which a schema is requestedserver- true if the schema is for a message from the server; false if the schema is for a message from the clientrequest- the JSON request- Returns:
- a JSON Schema valid for the type
- Throws:
JsonException- if an error occurs preparing schema; if type is is not a type handled by this service, this must be thrown with an error code of 500 and the localized message ERROR_UNKNOWN_TYPE
-
getType
protected java.lang.String getType()
Description copied from class:JsonNamedBeanHttpServiceGet the JSON type supported by this service.- Specified by:
getTypein classJsonNamedBeanHttpService<Audio>- Returns:
- the JSON type
-
getManager
protected Manager<Audio> getManager()
Description copied from class:JsonNamedBeanHttpServiceGet the expected manager for the supported JSON type. This should normally be the default manager.- Overrides:
getManagerin classJsonNamedBeanHttpService<Audio>- Returns:
- the manager
-
getProvidingManager
protected ProvidingManager<Audio> getProvidingManager() throws java.lang.UnsupportedOperationException
Description copied from class:JsonNamedBeanHttpServiceGet the expected providing manager for the supported JSON type. This should normally be the default manager.- Specified by:
getProvidingManagerin classJsonNamedBeanHttpService<Audio>- Returns:
- the providing manager
- Throws:
java.lang.UnsupportedOperationException- if a providing manager isn't available
-
-