Package adams.flow.rest.dex
Class DataExchange
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.rest.AbstractRESTPlugin
-
- adams.flow.rest.dex.DataExchange
-
- All Implemented Interfaces:
adams.core.AdditionalInformationHandler
,adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.SizeOfHandler
,RESTPlugin
,Serializable
public class DataExchange extends AbstractRESTPlugin
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DataExchange.TokenMessage
Wrapper class for the token.
-
Field Summary
Fields Modifier and Type Field Description protected AbstractAuthentication
m_Authentication
the authentication scheme.protected AbstractBackend
m_Backend
the backend in use.protected com.fasterxml.jackson.databind.ObjectMapper
m_Mapper
the object mapper to use.static String
PARAMKEY_NAME
static String
PARAMKEY_PAYLOAD
static String
PARAMVALUE_TOKEN
-
Constructor Summary
Constructors Constructor Description DataExchange()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
authenticationTipText()
Returns the tip text for this property.String
backendTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.javax.ws.rs.core.Response
download(org.apache.cxf.jaxrs.ext.multipart.MultipartBody body)
Handles the download of data.AbstractAuthentication
getAuthentication()
Returns the authentication scheme.AbstractBackend
getBackend()
Returns the backend scheme.String
globalInfo()
Returns a string describing the object.protected javax.ws.rs.core.Response
handleError(String msg)
Logs the error and generates a JSON response with the error.javax.ws.rs.core.Response
remove(org.apache.cxf.jaxrs.ext.multipart.MultipartBody body)
Handles the removal of data.protected void
reset()
Resets the scheme.void
setAuthentication(AbstractAuthentication value)
Sets the authentication scheme.void
setBackend(AbstractBackend value)
Sets the backend scheme.javax.ws.rs.core.Response
upload(org.apache.cxf.jaxrs.ext.multipart.MultipartBody body)
Handles the upload of data.-
Methods inherited from class adams.flow.rest.AbstractRESTPlugin
getAdditionalInformation
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
PARAMKEY_NAME
public static final String PARAMKEY_NAME
- See Also:
- Constant Field Values
-
PARAMKEY_PAYLOAD
public static final String PARAMKEY_PAYLOAD
- See Also:
- Constant Field Values
-
PARAMVALUE_TOKEN
public static final String PARAMVALUE_TOKEN
- See Also:
- Constant Field Values
-
m_Authentication
protected AbstractAuthentication m_Authentication
the authentication scheme.
-
m_Backend
protected AbstractBackend m_Backend
the backend in use.
-
m_Mapper
protected transient com.fasterxml.jackson.databind.ObjectMapper m_Mapper
the object mapper to use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.core.option.AbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.core.option.AbstractOptionHandler
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classadams.core.option.AbstractOptionHandler
-
setAuthentication
public void setAuthentication(AbstractAuthentication value)
Sets the authentication scheme.- Parameters:
value
- the scheme
-
getAuthentication
public AbstractAuthentication getAuthentication()
Returns the authentication scheme.- Returns:
- the scheme
-
authenticationTipText
public String authenticationTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setBackend
public void setBackend(AbstractBackend value)
Sets the backend scheme.- Parameters:
value
- the scheme
-
getBackend
public AbstractBackend getBackend()
Returns the backend scheme.- Returns:
- the scheme
-
backendTipText
public String backendTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
handleError
protected javax.ws.rs.core.Response handleError(String msg)
Logs the error and generates a JSON response with the error.- Parameters:
msg
- the error message- Returns:
- the generated JSON
-
upload
@POST @Path("/upload") @Consumes("multipart/form-data") @Produces("application/json") public javax.ws.rs.core.Response upload(org.apache.cxf.jaxrs.ext.multipart.MultipartBody body)
Handles the upload of data.- Parameters:
body
- the form data- Returns:
- the generated JSON reply. Either contains an element "error" if failed or "token" with the generated that the data item can now be accessed with.
-
download
@POST @Path("/download") @Consumes("multipart/form-data") @Produces("application/octet-stream") public javax.ws.rs.core.Response download(org.apache.cxf.jaxrs.ext.multipart.MultipartBody body)
Handles the download of data.- Parameters:
body
- the form data- Returns:
- the generated JSON reply. Returns the requested data.
-
remove
@POST @Path("/remove") @Consumes("multipart/form-data") public javax.ws.rs.core.Response remove(org.apache.cxf.jaxrs.ext.multipart.MultipartBody body)
Handles the removal of data.- Parameters:
body
- the form data- Returns:
- the generated JSON reply.
-
-