public class MpdPlugin extends JPlugin
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_PLUGIN_NAME
The default name of this plugin.
|
Constructor and Description |
---|
MpdPlugin()
Creates a new MPD plugin.
|
MpdPlugin(String name)
Creates a new MPD plugin.
|
Modifier and Type | Method and Description |
---|---|
void |
connect()
Connects to the MPD server.
|
protected org.bff.javampd.server.MPD |
createMpd()
Creates the MPD server representation.
|
void |
disconnect()
Disconnects from the MPD server.
|
String |
getEventNamePrefix()
Returns the MPD-based Sponge event name prefix.
|
String |
getHostname()
Returns the MPD server hostname.
|
MpdListenerManager |
getListenerManager()
Returns the MPD event listener manager.
|
String |
getPassword()
Returns the MPD server password.
|
Integer |
getPort()
Returns the MPD server port.
|
org.bff.javampd.server.MPD |
getServer()
Returns the MPD server representation.
|
Integer |
getTimeout()
Returns the MPD server timeout.
|
boolean |
isAutoConnect()
Returns the auto connect flag.
|
boolean |
isAutoStartMonitor()
Returns the auto start monitor flag.
|
void |
onConfigure(Configuration configuration)
Applies the XML configuration to this plugin.
|
void |
onShutdown()
Shuts down the plugin.
|
void |
onStartup()
Starts up this plugin.
|
void |
registerAllListeners()
Registers all MPD event listeners.
|
void |
registerListener(MpdEventCategory category)
Registers the MPD event listener for the MPD event category.
|
void |
registerListeners(MpdEventCategory... categories)
Registers MPD event listeners by MPD event categories.
|
void |
removeListener(MpdEventCategory category)
Removes the MPD event listener for the MPD event category.
|
protected <T> void |
sendEvent(MpdEventCategory category,
T source)
Sends a new MPD-based Sponge event to the engine.
|
void |
setAutoConnect(boolean autoConnect)
Sets the auto connect flag.
|
void |
setAutoStartMonitor(boolean autoStartMonitor)
Sets the auto start monitor flag.
|
void |
setEventNamePrefix(String eventNamePrefix)
Sets the MPD-based Sponge event name prefix.
|
void |
setHostname(String hostname)
Sets the MPD server hostname.
|
void |
setPassword(String password)
Sets the MPD server password.
|
void |
setPort(Integer port)
Sets the MPD server port.
|
void |
setServer(org.bff.javampd.server.MPD server)
Sets the MPD server representation.
|
void |
setTimeout(Integer timeout)
Sets the MPD server timeout.
|
doShutdown, doStartup, getConfiguration, getEngineOperations, getKnowledgeBase, getLogger, getSponge, onAfterReload, onBeforeReload, onInit, setConfiguration, setKnowledgeBase, shutdown, startup, toString
getDescription, getEngine, getInternalService, getLabel, getName, getState, isFailed, isNew, isNewOrStartingOrRunning, isRunning, isStarting, isStopping, isTerminated, setDescription, setEngine, setLabel, setName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isFailed, isNew, isRunning, isStarting, isStopping, isTerminated
getDescription, getLabel, getName, setDescription, setLabel, setName
public static final String DEFAULT_PLUGIN_NAME
public MpdPlugin()
public MpdPlugin(String name)
name
- the plugin name.public void onConfigure(Configuration configuration)
onConfigure
in interface Plugin
onConfigure
in class BasePlugin
configuration
- configuration.public void onStartup()
onStartup
in interface Plugin
onStartup
in class BasePlugin
public void connect()
public void disconnect()
protected org.bff.javampd.server.MPD createMpd()
protected <T> void sendEvent(MpdEventCategory category, T source)
T
- source event type.category
- the MPD event category.source
- the source MPD event.public void onShutdown()
onShutdown
in interface Plugin
onShutdown
in class BasePlugin
public String getHostname()
public void setHostname(String hostname)
hostname
- the MPD server hostname.public Integer getPort()
public void setPort(Integer port)
port
- the MPD server port.public String getPassword()
public void setPassword(String password)
password
- the MPD server password.public Integer getTimeout()
public void setTimeout(Integer timeout)
timeout
- the MPD server timeout.public String getEventNamePrefix()
public void setEventNamePrefix(String eventNamePrefix)
eventNamePrefix
- the MPD-based Sponge event name prefix.public boolean isAutoConnect()
true
if the plugin is to connect to the MPD server on startup.public void setAutoConnect(boolean autoConnect)
autoConnect
- true
if the plugin is to connect to the MPD server on startup.public boolean isAutoStartMonitor()
true
if the plugin is to start the MPD monitor on startup.public void setAutoStartMonitor(boolean autoStartMonitor)
autoStartMonitor
- true
if the plugin is to start the MPD monitor on startup.public org.bff.javampd.server.MPD getServer()
public void setServer(org.bff.javampd.server.MPD server)
server
- the MPD server representation.public MpdListenerManager getListenerManager()
public void registerListeners(MpdEventCategory... categories)
categories
- the MPD event categories.public void registerAllListeners()
public void registerListener(MpdEventCategory category)
category
- the MPD event category.public void removeListener(MpdEventCategory category)
category
- the MPD event category.Copyright © 2016–2019 Softelnet. All rights reserved.