net.sbbi.upnp.jmx
Class UPNPServiceMBean

java.lang.Object
  extended bynet.sbbi.upnp.jmx.UPNPServiceMBean
All Implemented Interfaces:
javax.management.DynamicMBean

public class UPNPServiceMBean
extends java.lang.Object
implements javax.management.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
UPNPServiceMBean(UPNPDevice device, UPNPService service)
          Creates a dynamic MBean from an UPNP service with no resource bundle to describe the service
UPNPServiceMBean(UPNPDevice device, UPNPService service, java.util.Locale locale, java.lang.String bundlePackage)
          Creates a dynamic MBean from an UPNP service
 
Method Summary
 java.lang.Object getAttribute(java.lang.String attributeName)
           
 javax.management.AttributeList getAttributes(java.lang.String[] attributeNames)
           
 javax.management.MBeanInfo getMBeanInfo()
           
 javax.management.ObjectName getObjectName()
          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
static UPNPServiceMBean[] getUPNPRootDeviceAsMBeans(UPNPRootDevice device)
          Creates UPNPServiceMBean device service mBeans for a given UPNPRootDevice
 java.lang.Object invoke(java.lang.String operationName, java.lang.Object[] paramsValue, java.lang.String[] signature)
           
 void setAttribute(javax.management.Attribute attributeName)
           
 javax.management.AttributeList setAttributes(javax.management.AttributeList attributeNames)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 service
service - the service that will be exposed as an MBean

UPNPServiceMBean

public UPNPServiceMBean(UPNPDevice device,
                        UPNPService service,
                        java.util.Locale locale,
                        java.lang.String bundlePackage)
Creates a dynamic MBean from an UPNP service

Parameters:
device - the device that is hosting the service
service - the service that will be exposed as an MBean
locale - 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 java.lang.Object getAttribute(java.lang.String attributeName)
                              throws javax.management.AttributeNotFoundException,
                                     javax.management.MBeanException,
                                     javax.management.ReflectionException
Specified by:
getAttribute in interface javax.management.DynamicMBean
Throws:
javax.management.AttributeNotFoundException
javax.management.MBeanException
javax.management.ReflectionException

getAttributes

public javax.management.AttributeList getAttributes(java.lang.String[] attributeNames)
Specified by:
getAttributes in interface javax.management.DynamicMBean

getMBeanInfo

public javax.management.MBeanInfo getMBeanInfo()
Specified by:
getMBeanInfo in interface javax.management.DynamicMBean

invoke

public java.lang.Object invoke(java.lang.String operationName,
                               java.lang.Object[] paramsValue,
                               java.lang.String[] signature)
                        throws javax.management.MBeanException,
                               javax.management.ReflectionException
Specified by:
invoke in interface javax.management.DynamicMBean
Throws:
javax.management.MBeanException
javax.management.ReflectionException

setAttribute

public void setAttribute(javax.management.Attribute attributeName)
                  throws javax.management.AttributeNotFoundException,
                         javax.management.InvalidAttributeValueException,
                         javax.management.MBeanException,
                         javax.management.ReflectionException
Specified by:
setAttribute in interface javax.management.DynamicMBean
Throws:
javax.management.AttributeNotFoundException
javax.management.InvalidAttributeValueException
javax.management.MBeanException
javax.management.ReflectionException

setAttributes

public javax.management.AttributeList setAttributes(javax.management.AttributeList attributeNames)
Specified by:
setAttributes in interface javax.management.DynamicMBean

getObjectName

public javax.management.ObjectName getObjectName()
                                          throws javax.management.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:
javax.management.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


Copyright © 2005 SuperBonBon Industries. All Rights Reserved.