Package net.shibboleth.idp.admin.impl
Class DoStorageOperation
- All Implemented Interfaces:
Component,DestructableComponent,InitializableComponent,ProfileAction,Aware,MessageSource,MessageSourceAware,Action
Action that implements a JSON REST API for accessing
StorageService records.
The API supports GET and DELETE at the moment, using jsonapi.org conventions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringStorage context to operate on.static final StringFlow variable indicating ID of storage context.private StringStorage key to operate on.static final StringFlow variable indicating ID of storage key.private org.slf4j.LoggerClass logger.private com.fasterxml.jackson.databind.ObjectMapperJSON object mapper.static final StringFlow variable indicating ID of storage service bean to reload.private StorageServiceStorageServiceto operate on. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddoCreate()Perform create operation.private voiddoDelete()Perform delete operation.protected voiddoExecute(ProfileRequestContext profileRequestContext) protected voidprotected booleandoPreExecute(ProfileRequestContext profileRequestContext) private voiddoRead()Perform read operation.private voiddoUpdate()Perform update operation.private StringNull safe context getter.private StringgetKey()Null safe key getter.private StorageServicegetStorageService(RequestContext requestContext) Helper method to get the storage service bean to operate on.private voidOutput an error object.voidsetObjectMapper(com.fasterxml.jackson.databind.ObjectMapper mapper) Set the JSONObjectMapperto use for serialization.voidsetStorageService(StorageService storage) Sets theStorageServiceto use.Methods inherited from class net.shibboleth.idp.profile.AbstractProfileAction
doExecute, execute, getBean, getBean, getMessage, getMessage, getMessage, getParameter, getParameter, getProfileContextLookupStrategy, getRequestContext, getResult, setMessageSource, setProfileContextLookupStrategyMethods inherited from class org.opensaml.profile.action.AbstractConditionalProfileAction
getActivationCondition, setActivationConditionMethods inherited from class org.opensaml.profile.action.AbstractProfileAction
doPostExecute, doPostExecute, ensureHttpServletRequest, ensureHttpServletResponse, execute, getHttpServletRequest, getHttpServletRequestSupplier, getHttpServletResponse, getHttpServletResponseSupplier, getLogPrefix, isPreExecuteCalled, setHttpServletRequestSupplier, setHttpServletResponseSupplierMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
SERVICE_ID
Flow variable indicating ID of storage service bean to reload.- See Also:
-
CONTEXT
Flow variable indicating ID of storage context.- See Also:
-
KEY
Flow variable indicating ID of storage key.- See Also:
-
log
@Nonnull private org.slf4j.Logger logClass logger. -
objectMapper
JSON object mapper. -
storageService
StorageServiceto operate on. -
context
Storage context to operate on. -
key
Storage key to operate on.
-
-
Constructor Details
-
DoStorageOperation
public DoStorageOperation()
-
-
Method Details
-
setObjectMapper
public void setObjectMapper(@Nonnull com.fasterxml.jackson.databind.ObjectMapper mapper) Set the JSONObjectMapperto use for serialization.- Parameters:
mapper- object mapper
-
setStorageService
Sets theStorageServiceto use.Primarily for testing, to bypass use of Spring to obtain the service to use.
- Parameters:
storage- storage service
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
getKey
Null safe key getter.- Returns:
- Returns the key.
-
getContext
Null safe context getter.- Returns:
- Returns the context.
-
doPreExecute
- Overrides:
doPreExecutein classAbstractConditionalProfileAction
-
doExecute
- Overrides:
doExecutein classAbstractProfileAction
-
getStorageService
Helper method to get the storage service bean to operate on.- Parameters:
requestContext- current SWF request context- Returns:
- storage service or null
-
doRead
Perform read operation.- Throws:
IOException- if an error is raised
-
doCreate
Perform create operation.- Throws:
IOException- if an error is raised
-
doUpdate
Perform update operation.- Throws:
IOException- if an error is raised
-
doDelete
Perform delete operation.- Throws:
IOException- if an error is raised
-
sendError
private void sendError(int status, @Nonnull @NotEmpty String title, @Nonnull @NotEmpty String detail) throws IOException Output an error object.- Parameters:
status- HTTP statustitle- fixed error descriptiondetail- human-readable error description- Throws:
IOException- if unable to output the error
-