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 ParameterMapaddToParameterMap(ParameterMap parameters, String basePath, Class<?> configBean, Object source, Subject subject)voidapplyChanges(Map<String,String> changes, String basePath, Subject subject)Apply changes to domain.xmlActionReporterexecuteCommand(Subject subject, String command, ParameterMap parameters, jakarta.ws.rs.core.Response.Status status, boolean includeFailureMessage, boolean throwOnWarning, boolean managed)Execute anAdminCommandwith the specified parameters.ActionReporterexecuteDeleteCommand(Subject subject, String command)Execute a deleteAdminCommandwith no parameters.ActionReporterexecuteDeleteCommand(Subject subject, String command, ParameterMap parameters)Execute a deleteAdminCommandwith the specified parameters.ActionReporterexecuteDeleteCommandManaged(Subject subject, String command, ParameterMap parameters)Execute a deleteAdminCommandwith the specified parameters.ActionReporterexecuteReadCommand(Subject subject, String command)Execute a read-onlyAdminCommandwith the specified parameters.ActionReporterexecuteReadCommand(Subject subject, String command, ParameterMap parameters)Execute a read-onlyAdminCommandwith no parameters.org.glassfish.jersey.media.sse.EventOutputexecuteSseCommand(Subject subject, String command, ParameterMap parameters)Execute anAdminCommandwith the specified parameters and return EventOutput suitable for SSE.org.glassfish.jersey.media.sse.EventOutputexecuteSseCommand(Subject subject, String command, ParameterMap parameters, SseCommandHelper.ActionReportProcessor processor)Execute anAdminCommandwith the specified parameters and return EventOutput suitable for SSE.ActionReporterexecuteWriteCommand(Subject subject, String command)Execute a writingAdminCommandwith no parameters.ActionReporterexecuteWriteCommand(Subject subject, String command, ParameterMap parameters)Execute a writingAdminCommandwith the specified parameters.ActionReporterexecuteWriteCommandManaged(Subject subject, String command, ParameterMap parameters)Execute a writingAdminCommandwith the specified parameters as managed job.StringgetHelpText(Annotation[] annos)If theHelpTextannotation is in the list ofAnnotations, return the value from the specified bundle for the given key.LocalegetLocale(jakarta.ws.rs.core.HttpHeaders requestHeaders)LocalegetLocale(jakarta.ws.rs.core.MultivaluedMap<String,String> requestHeaders)<T> TgetModel(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.ObjectgetResourceExtensions(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> StringgetValidationFailureMessages(Locale locale, Set<jakarta.validation.ConstraintViolation<T>> constraintViolations, T model)static CompositeUtilinstance()<T> TunmarshallClass(Locale locale, Class<T> modelClass, jakarta.json.JsonObject json)Convert the givenRestModelencoded 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 givenRestModelencoded as Json to a live Java Object.- Parameters:
locale-modelClass- The targetRestModeltypejson- The json encoding of the object- Returns:
- Throws:
jakarta.json.JsonException
-
getHelpText
public String getHelpText(Annotation[] annos)
If theHelpTextannotation is in the list ofAnnotations, 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 deleteAdminCommandwith no parameters.- Parameters:
subject-command-- Returns:
-
executeDeleteCommand
public ActionReporter executeDeleteCommand(Subject subject, String command, ParameterMap parameters)
Execute a deleteAdminCommandwith the specified parameters.- Parameters:
subject-command-parameters-- Returns:
-
executeDeleteCommandManaged
public ActionReporter executeDeleteCommandManaged(Subject subject, String command, ParameterMap parameters)
Execute a deleteAdminCommandwith the specified parameters.- Parameters:
subject-command-parameters-- Returns:
-
executeWriteCommand
public ActionReporter executeWriteCommand(Subject subject, String command)
Execute a writingAdminCommandwith no parameters.- Parameters:
subject-command-- Returns:
-
executeWriteCommand
public ActionReporter executeWriteCommand(Subject subject, String command, ParameterMap parameters)
Execute a writingAdminCommandwith the specified parameters.- Parameters:
subject-command-parameters-- Returns:
-
executeWriteCommandManaged
public ActionReporter executeWriteCommandManaged(Subject subject, String command, ParameterMap parameters)
Execute a writingAdminCommandwith the specified parameters as managed job.- Parameters:
subject-command-parameters-- Returns:
-
executeReadCommand
public ActionReporter executeReadCommand(Subject subject, String command)
Execute a read-onlyAdminCommandwith the specified parameters.- Parameters:
subject-command-- Returns:
-
executeReadCommand
public ActionReporter executeReadCommand(Subject subject, String command, ParameterMap parameters)
Execute a read-onlyAdminCommandwith 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 anAdminCommandwith 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 anAdminCommandwith 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 anAdminCommandwith the specified parameters and return EventOutput suitable for SSE.
-
getLocale
public Locale getLocale(jakarta.ws.rs.core.HttpHeaders requestHeaders)
-
-