Package tigase.component.modules.impl
Class AdHocCommandModule
- java.lang.Object
-
- tigase.component.modules.AbstractModule
-
- tigase.component.modules.impl.AdHocCommandModule
-
- All Implemented Interfaces:
Module
,Initializable
- Direct Known Subclasses:
AdHocCommandMonitorModule
@Bean(name="commands", active=true) public class AdHocCommandModule extends AbstractModule implements Initializable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AdHocCommandModule.ScriptCommandProcessor
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String[]
COMMAND_PATH
protected AdHocCommandManager
commandsManager
protected static Criteria
CRIT
static java.lang.String
ID
protected AdHocCommandModule.ScriptCommandProcessor
scriptProcessor
static java.lang.String
XMLNS
-
Fields inherited from class tigase.component.modules.AbstractModule
eventBus, log, writer
-
Fields inherited from interface tigase.component.modules.Module
EMPTY_FEATURES
-
-
Constructor Summary
Constructors Constructor Description AdHocCommandModule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCommandListItemsElements(java.lang.String node, JID stanzaTo, JID stanzaFrom, java.util.function.Consumer<Element> collector)
java.util.List<Element>
getCommandListItems(JID senderJid, JID toJid)
AdHocCommandManager
getCommandsManager()
java.lang.String[]
getFeatures()
Returns XMPP features offered by module.Criteria
getModuleCriteria()
Returns critera used by Component to select module to handle incoming stanza.java.util.List<Element>
getScriptItems(java.lang.String node, JID stanzaTo, JID stanzaFrom)
AdHocCommandModule.ScriptCommandProcessor
getScriptProcessor()
void
initialize()
Method will be called, when bean will be created, configured and ready to use.void
process(Packet packet)
Process incoming stanza.protected void
processScriptAdHoc(Packet packet)
void
register(AdHocCommand command)
void
setCommandsManager(AdHocCommandManager commandsManager)
void
setScriptProcessor(AdHocCommandModule.ScriptCommandProcessor scriptProcessor)
-
Methods inherited from class tigase.component.modules.AbstractModule
fireEvent, getEventBus, getWriter, setEventBus, setWriter, write, write
-
-
-
-
Field Detail
-
ID
public static final java.lang.String ID
- See Also:
- Constant Field Values
-
XMLNS
public static final java.lang.String XMLNS
- See Also:
- Constant Field Values
-
COMMAND_PATH
protected static final java.lang.String[] COMMAND_PATH
-
CRIT
protected static final Criteria CRIT
-
commandsManager
@Inject(nullAllowed=false) protected AdHocCommandManager commandsManager
-
scriptProcessor
@Inject(nullAllowed=false) protected AdHocCommandModule.ScriptCommandProcessor scriptProcessor
-
-
Method Detail
-
getCommandsManager
public AdHocCommandManager getCommandsManager()
-
setCommandsManager
public void setCommandsManager(AdHocCommandManager commandsManager)
-
getFeatures
public java.lang.String[] getFeatures()
Description copied from interface:Module
Returns XMPP features offered by module. Features will be returned by Service Discovery.- Specified by:
getFeatures
in interfaceModule
- Returns:
- array of features or
null
.
-
getModuleCriteria
public Criteria getModuleCriteria()
Description copied from interface:Module
Returns critera used by Component to select module to handle incoming stanza.- Specified by:
getModuleCriteria
in interfaceModule
- Returns:
- criteria of selecting module.
-
getScriptItems
public java.util.List<Element> getScriptItems(java.lang.String node, JID stanzaTo, JID stanzaFrom)
-
addCommandListItemsElements
public void addCommandListItemsElements(java.lang.String node, JID stanzaTo, JID stanzaFrom, java.util.function.Consumer<Element> collector)
-
getScriptProcessor
public AdHocCommandModule.ScriptCommandProcessor getScriptProcessor()
-
setScriptProcessor
public void setScriptProcessor(AdHocCommandModule.ScriptCommandProcessor scriptProcessor)
-
initialize
public void initialize()
Description copied from interface:Initializable
Method will be called, when bean will be created, configured and ready to use.- Specified by:
initialize
in interfaceInitializable
-
process
public void process(Packet packet) throws ComponentException
Description copied from interface:Module
Process incoming stanza.- Specified by:
process
in interfaceModule
- Parameters:
packet
- receivedstanza
.- Throws:
ComponentException
- if stanza can't be processed correctly. ComponentException is converted to error stanza and returned to stanza sender.
-
register
public void register(AdHocCommand command)
-
processScriptAdHoc
protected void processScriptAdHoc(Packet packet)
-
-