Package org.jpos.q2
Class QFactory
- java.lang.Object
-
- org.jpos.q2.QFactory
-
public class QFactory extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
autoconfigure(java.lang.Object obj, Configuration cfg)
void
configureQBean(javax.management.MBeanServer server, javax.management.ObjectName objectName, org.jdom2.Element e)
javax.management.ObjectInstance
createQBean(Q2 server, org.jdom2.Element e, java.lang.Object obj)
void
destroyQBean(Q2 server, javax.management.ObjectName objectName, java.lang.Object obj)
javax.management.AttributeList
getAttributeList(org.jdom2.Element e)
java.lang.String
getAttributeName(java.lang.String name)
sets the first character of the string to the upper casestatic java.lang.String
getAttributeValue(org.jdom2.Element e, java.lang.String name)
protected java.util.Collection
getCollection(java.lang.Class type, org.jdom2.Element e)
Creats a collection from a definition element with the format.Configuration
getConfiguration(org.jdom2.Element e)
static java.lang.String
getEnabledAttribute(org.jdom2.Element e)
protected java.lang.Object
getObject(org.jdom2.Element childElement)
Creates an object from a definition element.Q2
getQ2()
java.lang.Object
instantiate(Q2 server, org.jdom2.Element e)
static void
invoke(java.lang.Object obj, java.lang.String m, java.lang.Object p)
Try to invoke a method (usually a setter) on the given object silently ignoring if method does not existstatic void
invoke(java.lang.Object obj, java.lang.String m, java.lang.Object p, java.lang.Class pc)
Try to invoke a method (usually a setter) on the given object silently ignoring if method does not existstatic boolean
isEnabled(org.jdom2.Element e)
<T> T
newInstance(java.lang.Class<T> clazz)
<T> T
newInstance(java.lang.String clazz)
void
setAttribute(javax.management.MBeanServer server, javax.management.ObjectName objectName, java.lang.String attribute, java.lang.Object value)
void
setConfiguration(java.lang.Object obj, org.jdom2.Element e)
void
setLogger(java.lang.Object obj, org.jdom2.Element e)
void
startQBean(Q2 server, javax.management.ObjectName objectName)
-
-
-
Method Detail
-
instantiate
public java.lang.Object instantiate(Q2 server, org.jdom2.Element e) throws javax.management.ReflectionException, javax.management.MBeanException, javax.management.InstanceNotFoundException
- Throws:
javax.management.ReflectionException
javax.management.MBeanException
javax.management.InstanceNotFoundException
-
createQBean
public javax.management.ObjectInstance createQBean(Q2 server, org.jdom2.Element e, java.lang.Object obj) throws javax.management.MalformedObjectNameException, javax.management.InstanceAlreadyExistsException, javax.management.InstanceNotFoundException, javax.management.MBeanException, javax.management.NotCompliantMBeanException, javax.management.InvalidAttributeValueException, javax.management.ReflectionException, ConfigurationException
- Throws:
javax.management.MalformedObjectNameException
javax.management.InstanceAlreadyExistsException
javax.management.InstanceNotFoundException
javax.management.MBeanException
javax.management.NotCompliantMBeanException
javax.management.InvalidAttributeValueException
javax.management.ReflectionException
ConfigurationException
-
setAttribute
public void setAttribute(javax.management.MBeanServer server, javax.management.ObjectName objectName, java.lang.String attribute, java.lang.Object value) throws javax.management.InstanceNotFoundException, javax.management.MBeanException, javax.management.InvalidAttributeValueException, javax.management.ReflectionException
- Throws:
javax.management.InstanceNotFoundException
javax.management.MBeanException
javax.management.InvalidAttributeValueException
javax.management.ReflectionException
-
startQBean
public void startQBean(Q2 server, javax.management.ObjectName objectName) throws javax.management.InstanceNotFoundException, javax.management.MBeanException, javax.management.ReflectionException
- Throws:
javax.management.InstanceNotFoundException
javax.management.MBeanException
javax.management.ReflectionException
-
destroyQBean
public void destroyQBean(Q2 server, javax.management.ObjectName objectName, java.lang.Object obj) throws javax.management.InstanceNotFoundException, javax.management.MBeanException, javax.management.ReflectionException
- Throws:
javax.management.InstanceNotFoundException
javax.management.MBeanException
javax.management.ReflectionException
-
configureQBean
public void configureQBean(javax.management.MBeanServer server, javax.management.ObjectName objectName, org.jdom2.Element e) throws ConfigurationException
- Throws:
ConfigurationException
-
getAttributeList
public javax.management.AttributeList getAttributeList(org.jdom2.Element e) throws ConfigurationException
- Throws:
ConfigurationException
-
getObject
protected java.lang.Object getObject(org.jdom2.Element childElement) throws ConfigurationException
Creates an object from a definition element. The element may have an attribute called type indicating the type of the object to create, if this attribute is not present java.lang.String is assumed. int, long and boolean are converted to their wrappers.- Parameters:
childElement
- Dom Element with the definition of the object.- Returns:
- The created object.
- Throws:
ConfigurationException
- If an exception is found trying to create the object.
-
getCollection
protected java.util.Collection getCollection(java.lang.Class type, org.jdom2.Element e) throws ConfigurationException
Creats a collection from a definition element with the format.<{attr|item} type="...">
- ...
...- Parameters:
type
- class typee
- the Element- Returns:
- the object collection
- Throws:
ConfigurationException
-
getAttributeName
public java.lang.String getAttributeName(java.lang.String name)
sets the first character of the string to the upper case- Parameters:
name
- attribute name- Returns:
- attribute name
-
newInstance
public <T> T newInstance(java.lang.String clazz) throws ConfigurationException
- Throws:
ConfigurationException
-
newInstance
public <T> T newInstance(java.lang.Class<T> clazz) throws ConfigurationException
- Throws:
ConfigurationException
-
getConfiguration
public Configuration getConfiguration(org.jdom2.Element e) throws ConfigurationException
- Throws:
ConfigurationException
-
setLogger
public void setLogger(java.lang.Object obj, org.jdom2.Element e)
-
getAttributeValue
public static java.lang.String getAttributeValue(org.jdom2.Element e, java.lang.String name)
-
setConfiguration
public void setConfiguration(java.lang.Object obj, org.jdom2.Element e) throws ConfigurationException
- Throws:
ConfigurationException
-
invoke
public static void invoke(java.lang.Object obj, java.lang.String m, java.lang.Object p) throws ConfigurationException
Try to invoke a method (usually a setter) on the given object silently ignoring if method does not exist- Parameters:
obj
- the objectm
- method to invokep
- parameter- Throws:
ConfigurationException
- if method happens to throw an exception
-
invoke
public static void invoke(java.lang.Object obj, java.lang.String m, java.lang.Object p, java.lang.Class pc) throws ConfigurationException
Try to invoke a method (usually a setter) on the given object silently ignoring if method does not exist- Parameters:
obj
- the objectm
- method to invokep
- parameterpc
- parameter class- Throws:
ConfigurationException
- if method happens to throw an exception
-
isEnabled
public static boolean isEnabled(org.jdom2.Element e)
-
getEnabledAttribute
public static java.lang.String getEnabledAttribute(org.jdom2.Element e)
-
autoconfigure
public static void autoconfigure(java.lang.Object obj, Configuration cfg) throws java.lang.IllegalAccessException
- Throws:
java.lang.IllegalAccessException
-
-