Class CompositeUtil
- java.lang.Object
-
- org.glassfish.admin.rest.composite.CompositeUtil
-
public class CompositeUtil extends Object
- Author:
- jdlee
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ParameterMap
addToParameterMap(ParameterMap parameters, String basePath, Class<?> configBean, Object source, Subject subject)
void
applyChanges(Map<String,String> changes, String basePath, Subject subject)
Apply changes to domain.xmlActionReporter
executeCommand(Subject subject, String command, ParameterMap parameters, jakarta.ws.rs.core.Response.Status status, boolean includeFailureMessage, boolean throwOnWarning, boolean managed)
Execute anAdminCommand
with the specified parameters.ActionReporter
executeDeleteCommand(Subject subject, String command)
Execute a deleteAdminCommand
with no parameters.ActionReporter
executeDeleteCommand(Subject subject, String command, ParameterMap parameters)
Execute a deleteAdminCommand
with the specified parameters.ActionReporter
executeDeleteCommandManaged(Subject subject, String command, ParameterMap parameters)
Execute a deleteAdminCommand
with the specified parameters.ActionReporter
executeReadCommand(Subject subject, String command)
Execute a read-onlyAdminCommand
with the specified parameters.ActionReporter
executeReadCommand(Subject subject, String command, ParameterMap parameters)
Execute a read-onlyAdminCommand
with no parameters.org.glassfish.jersey.media.sse.EventOutput
executeSseCommand(Subject subject, String command, ParameterMap parameters)
Execute anAdminCommand
with the specified parameters and return EventOutput suitable for SSE.org.glassfish.jersey.media.sse.EventOutput
executeSseCommand(Subject subject, String command, ParameterMap parameters, SseCommandHelper.ActionReportProcessor processor)
Execute anAdminCommand
with the specified parameters and return EventOutput suitable for SSE.ActionReporter
executeWriteCommand(Subject subject, String command)
Execute a writingAdminCommand
with no parameters.ActionReporter
executeWriteCommand(Subject subject, String command, ParameterMap parameters)
Execute a writingAdminCommand
with the specified parameters.ActionReporter
executeWriteCommandManaged(Subject subject, String command, ParameterMap parameters)
Execute a writingAdminCommand
with the specified parameters as managed job.String
getHelpText(Annotation[] annos)
If theHelpText
annotation is in the list ofAnnotation
s, return the value from the specified bundle for the given key.Locale
getLocale(jakarta.ws.rs.core.HttpHeaders requestHeaders)
Locale
getLocale(jakarta.ws.rs.core.MultivaluedMap<String,String> requestHeaders)
<T> T
getModel(Class<T> modelIface)
This method will return a generated concrete class that implements the interface requested, as well as any interfaces intended to extend the base model interface.Object
getResourceExtensions(Class<?> baseClass, Object data, String method)
Find and execute all resource extensions for the specified base resource and HTTP method TODO: method enum?Set<Class<?>>
getRestModels()
<T> String
getValidationFailureMessages(Locale locale, Set<jakarta.validation.ConstraintViolation<T>> constraintViolations, T model)
static CompositeUtil
instance()
<T> T
unmarshallClass(Locale locale, Class<T> modelClass, jakarta.json.JsonObject json)
Convert the givenRestModel
encoded as Json to a live Java Object.<T> Set<jakarta.validation.ConstraintViolation<T>>
validateRestModel(Locale locale, T model)
-
-
-
Method Detail
-
instance
public static CompositeUtil instance()
-
getModel
public <T> T getModel(Class<T> modelIface)
This method will return a generated concrete class that implements the interface requested, as well as any interfaces intended to extend the base model interface. Model extensions must be annotated with- Parameters:
modelIface
- The base interface for the desired data model- Returns:
- An instance of a concrete class implementing the requested interfaces
- Throws:
Exception
-
getResourceExtensions
public Object getResourceExtensions(Class<?> baseClass, Object data, String method)
Find and execute all resource extensions for the specified base resource and HTTP method TODO: method enum?- Parameters:
baseClass
-data
-method
-
-
addToParameterMap
public ParameterMap addToParameterMap(ParameterMap parameters, String basePath, Class<?> configBean, Object source, Subject subject)
-
unmarshallClass
public <T> T unmarshallClass(Locale locale, Class<T> modelClass, jakarta.json.JsonObject json) throws jakarta.json.JsonException
Convert the givenRestModel
encoded as Json to a live Java Object.- Parameters:
locale
-modelClass
- The targetRestModel
typejson
- The json encoding of the object- Returns:
- Throws:
jakarta.json.JsonException
-
getHelpText
public String getHelpText(Annotation[] annos)
If theHelpText
annotation is in the list ofAnnotation
s, return the value from the specified bundle for the given key.- Parameters:
annos
-- Returns:
-
validateRestModel
public <T> Set<jakarta.validation.ConstraintViolation<T>> validateRestModel(Locale locale, T model)
-
getValidationFailureMessages
public <T> String getValidationFailureMessages(Locale locale, Set<jakarta.validation.ConstraintViolation<T>> constraintViolations, T model)
-
applyChanges
public void applyChanges(Map<String,String> changes, String basePath, Subject subject)
Apply changes to domain.xml- Parameters:
changes
-basePath
-
-
executeDeleteCommand
public ActionReporter executeDeleteCommand(Subject subject, String command)
Execute a deleteAdminCommand
with no parameters.- Parameters:
subject
-command
-- Returns:
-
executeDeleteCommand
public ActionReporter executeDeleteCommand(Subject subject, String command, ParameterMap parameters)
Execute a deleteAdminCommand
with the specified parameters.- Parameters:
subject
-command
-parameters
-- Returns:
-
executeDeleteCommandManaged
public ActionReporter executeDeleteCommandManaged(Subject subject, String command, ParameterMap parameters)
Execute a deleteAdminCommand
with the specified parameters.- Parameters:
subject
-command
-parameters
-- Returns:
-
executeWriteCommand
public ActionReporter executeWriteCommand(Subject subject, String command)
Execute a writingAdminCommand
with no parameters.- Parameters:
subject
-command
-- Returns:
-
executeWriteCommand
public ActionReporter executeWriteCommand(Subject subject, String command, ParameterMap parameters)
Execute a writingAdminCommand
with the specified parameters.- Parameters:
subject
-command
-parameters
-- Returns:
-
executeWriteCommandManaged
public ActionReporter executeWriteCommandManaged(Subject subject, String command, ParameterMap parameters)
Execute a writingAdminCommand
with the specified parameters as managed job.- Parameters:
subject
-command
-parameters
-- Returns:
-
executeReadCommand
public ActionReporter executeReadCommand(Subject subject, String command)
Execute a read-onlyAdminCommand
with the specified parameters.- Parameters:
subject
-command
-- Returns:
-
executeReadCommand
public ActionReporter executeReadCommand(Subject subject, String command, ParameterMap parameters)
Execute a read-onlyAdminCommand
with no parameters.- Parameters:
subject
-command
-parameters
-- Returns:
-
executeCommand
public ActionReporter executeCommand(Subject subject, String command, ParameterMap parameters, jakarta.ws.rs.core.Response.Status status, boolean includeFailureMessage, boolean throwOnWarning, boolean managed)
Execute anAdminCommand
with the specified parameters.- Parameters:
command
-parameters
-throwBadRequest
- (vs. NOT_FOUND)throwOnWarning
- (vs.ignore warning)- Returns:
-
executeSseCommand
public org.glassfish.jersey.media.sse.EventOutput executeSseCommand(Subject subject, String command, ParameterMap parameters)
Execute anAdminCommand
with the specified parameters and return EventOutput suitable for SSE.
-
executeSseCommand
public org.glassfish.jersey.media.sse.EventOutput executeSseCommand(Subject subject, String command, ParameterMap parameters, SseCommandHelper.ActionReportProcessor processor)
Execute anAdminCommand
with the specified parameters and return EventOutput suitable for SSE.
-
getLocale
public Locale getLocale(jakarta.ws.rs.core.HttpHeaders requestHeaders)
-
-