Package net.sbbi.upnp.jmx
Class UPNPServiceMBean
- java.lang.Object
-
- net.sbbi.upnp.jmx.UPNPServiceMBean
-
- All Implemented Interfaces:
DynamicMBean
public class UPNPServiceMBean extends Object implements DynamicMBean
This is a dynamic MBean for UPNP services The dynamic MBean will be populated with basic informations about UPNP service attributes and operations. You can provide a locale object that will try to lookup a resource bundle to generate attributes and operations informations. The bundle must contains the following data to match the UPNP devices actions and state variables: service.name=My Service description attribute.ServiceAttribute=My Attribute Desc operation.ServiceOperation=My Action de description operation.ServiceOperation.ActionArgument1=My Action first argument description operation.ServiceOperation.ActionArgument2=My Action second argument description and must be named with the UPNP service Id + locale, the service id ':' char must be replaced with '_' chars. urn:upnp-org:serviceId:LANHostCfg1 will be translated into : urn_upnp-org_serviceId_LANHostCfg1_fr.properties- Version:
- 1.0
- Author:
- SuperBonBon
-
-
Constructor Summary
Constructors Constructor Description UPNPServiceMBean(UPNPDevice device, UPNPService service)Creates a dynamic MBean from an UPNP service with no resource bundle to describe the serviceUPNPServiceMBean(UPNPDevice device, UPNPService service, Locale locale, String bundlePackage)Creates a dynamic MBean from an UPNP service
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetAttribute(String attributeName)AttributeListgetAttributes(String[] attributeNames)MBeanInfogetMBeanInfo()ObjectNamegetObjectName()Creates an object name for this device, this name should be used ot avoid any names collision especially with multiple sames UPNP devices type on the networkstatic UPNPServiceMBean[]getUPNPRootDeviceAsMBeans(UPNPRootDevice device)Creates UPNPServiceMBean device service mBeans for a given UPNPRootDeviceObjectinvoke(String operationName, Object[] paramsValue, String[] signature)voidsetAttribute(Attribute attributeName)AttributeListsetAttributes(AttributeList attributeNames)
-
-
-
Constructor Detail
-
UPNPServiceMBean
public UPNPServiceMBean(UPNPDevice device, UPNPService service)
Creates a dynamic MBean from an UPNP service with no resource bundle to describe the service- Parameters:
device- the device that is hosting the serviceservice- the service that will be exposed as an MBean
-
UPNPServiceMBean
public UPNPServiceMBean(UPNPDevice device, UPNPService service, Locale locale, String bundlePackage)
Creates a dynamic MBean from an UPNP service- Parameters:
device- the device that is hosting the serviceservice- the service that will be exposed as an MBeanlocale- the resource bundle locale, null if no bundle needs to be used..bundlePackage- the resource bundle package location into the classpath I.E net/sbbi/upnplib/myDevicesBundlesPackage, null if the bundles are located at the classpath root.
-
-
Method Detail
-
getAttribute
public Object getAttribute(String attributeName) throws AttributeNotFoundException, MBeanException, ReflectionException
- Specified by:
getAttributein interfaceDynamicMBean- Throws:
AttributeNotFoundExceptionMBeanExceptionReflectionException
-
getAttributes
public AttributeList getAttributes(String[] attributeNames)
- Specified by:
getAttributesin interfaceDynamicMBean
-
getMBeanInfo
public MBeanInfo getMBeanInfo()
- Specified by:
getMBeanInfoin interfaceDynamicMBean
-
invoke
public Object invoke(String operationName, Object[] paramsValue, String[] signature) throws MBeanException, ReflectionException
- Specified by:
invokein interfaceDynamicMBean- Throws:
MBeanExceptionReflectionException
-
setAttribute
public void setAttribute(Attribute attributeName) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
- Specified by:
setAttributein interfaceDynamicMBean- Throws:
AttributeNotFoundExceptionInvalidAttributeValueExceptionMBeanExceptionReflectionException
-
setAttributes
public AttributeList setAttributes(AttributeList attributeNames)
- Specified by:
setAttributesin interfaceDynamicMBean
-
getObjectName
public ObjectName getObjectName() throws MalformedObjectNameException
Creates an object name for this device, this name should be used ot avoid any names collision especially with multiple sames UPNP devices type on the network- Returns:
- a new Object Name
- Throws:
MalformedObjectNameException
-
getUPNPRootDeviceAsMBeans
public static UPNPServiceMBean[] getUPNPRootDeviceAsMBeans(UPNPRootDevice device)
Creates UPNPServiceMBean device service mBeans for a given UPNPRootDevice- Parameters:
device- the root device- Returns:
- an array of UPNPServiceMBean objects representing the UPNP device services MBeans
-
-