Class CommandInvokedEvent
java.lang.Object
org.glassfish.internal.api.events.CommandInvokedEvent
An HK2 event that is triggered when an Admin command is invoked via the REST interface (including Admin Console and CLI).
To listen to this event, create an HK2 subscriber with the following:
Serviceannotation on the class or otherwise register the class as an HK2 serviceMessageReceiverqualifier annotation on the class with theCommandInvokedEventmessage type- A listener method with void return type and a single argument of the
CommandInvokedEventtype annotated with theSubscribeToannotation - Make sure that this subscriber is started as an HK2 service to receive the events
An example listener:
@Service
@RunLevel(value = StartupRunLevel.VAL, mode = RunLevel.RUNLEVEL_MODE_NON_VALIDATING)
@MessageReceiver({CommandInvokedEvent.class})
public class CommandSubscriber {
public void commandInvoked(@SubscribeTo CommandInvokedEvent event) {
log(event);
}
}
- Author:
- Ondro Mihalyi
-
Constructor Summary
ConstructorsConstructorDescriptionCommandInvokedEvent(String commandName, org.glassfish.api.admin.ParameterMap parameters, Subject subject) -
Method Summary
Modifier and TypeMethodDescriptionorg.glassfish.api.admin.ParameterMapOptional<org.glassfish.security.common.UserPrincipal>
-
Constructor Details
-
CommandInvokedEvent
-
-
Method Details
-
getCommandName
- Returns:
- Name of the executed command
-
getParameters
public org.glassfish.api.admin.ParameterMap getParameters()- Returns:
- Parameters used with the command. If not parameters, the result is an empty map. Never null.
-
getSubject
-
getUserPrincipal
-