Class QFactory
java.lang.Object
org.jpos.q2.QFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidautoconfigure(Object obj, Configuration cfg) voidconfigureQBean(MBeanServer server, ObjectName objectName, org.jdom2.Element e) createQBean(Q2 server, org.jdom2.Element e, Object obj) voiddestroyQBean(Q2 server, ObjectName objectName, Object obj) static ExecutorServiceexecutorService(boolean virtual) static org.jdom2.ElementexpandEnvProperties(org.jdom2.Element e) Decorates anElementby replacing its attributes, and contentEnvironmentproperties references.getAttributeList(org.jdom2.Element e) getAttributeName(String name) sets the first character of the string to the upper casestatic StringgetAttributeValue(org.jdom2.Element e, String name) protected CollectiongetCollection(Class type, org.jdom2.Element e) Creats a collection from a definition element with the format.getConfiguration(org.jdom2.Element e) static StringgetEagerStartAttribute(org.jdom2.Element e) static StringgetEnabledAttribute(org.jdom2.Element e) protected ObjectgetObject(org.jdom2.Element childElement) Creates an object from a definition element.getQ2()instantiate(Q2 server, org.jdom2.Element e) static voidTry to invoke a method (usually a setter) on the given object silently ignoring if method does not existstatic voidTry to invoke a method (usually a setter) on the given object silently ignoring if method does not existstatic booleanisEagerStart(org.jdom2.Element e) static booleanisEnabled(org.jdom2.Element e) <T> TnewInstance(Class<T> clazz) <T> TnewInstance(String clazz) <T> TnewInstance(org.jdom2.Element e) Creates a new instance from the values inElement e.voidsetAttribute(MBeanServer server, ObjectName objectName, String attribute, Object value) voidsetConfiguration(Object obj, org.jdom2.Element e) voidvoidstartQBean(Q2 server, ObjectName objectName)
-
Constructor Details
-
QFactory
-
-
Method Details
-
instantiate
public Object instantiate(Q2 server, org.jdom2.Element e) throws ReflectionException, MBeanException, InstanceNotFoundException -
createQBean
public ObjectInstance createQBean(Q2 server, org.jdom2.Element e, Object obj) throws MalformedObjectNameException, InstanceAlreadyExistsException, InstanceNotFoundException, MBeanException, NotCompliantMBeanException, InvalidAttributeValueException, ReflectionException, ConfigurationException -
getQ2
-
setAttribute
public void setAttribute(MBeanServer server, ObjectName objectName, String attribute, Object value) throws InstanceNotFoundException, MBeanException, InvalidAttributeValueException, ReflectionException -
startQBean
public void startQBean(Q2 server, ObjectName objectName) throws InstanceNotFoundException, MBeanException, ReflectionException -
destroyQBean
public void destroyQBean(Q2 server, ObjectName objectName, Object obj) throws InstanceNotFoundException, MBeanException, ReflectionException -
configureQBean
public void configureQBean(MBeanServer server, ObjectName objectName, org.jdom2.Element e) throws ConfigurationException - Throws:
ConfigurationException
-
getAttributeList
- Throws:
ConfigurationException
-
getObject
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
Creats a collection from a definition element with the format.invalid input: '<'{attr|item} type="..."> invalid input: '<'item [type="..."]>... ...- Parameters:
type- class typee- the Element- Returns:
- the object collection
- Throws:
ConfigurationException
-
getAttributeName
sets the first character of the string to the upper case- Parameters:
name- attribute name- Returns:
- attribute name
-
newInstance
- Throws:
ConfigurationException
-
newInstance
- Throws:
ConfigurationException
-
newInstance
Creates a new instance from the values inElement e.
The method honors the
enabledattribute in the givenElement e, returning null immediately ifenabledis computed to a true-equivalent.It also calls
setLogger(Object, Element)to set logger and realm, andsetConfiguration(Object, Element)to trigger the standard [auto]configuration sequence from properties and XML.- Parameters:
e- The XML config- Returns:
- the new instance, or null if not enabled
- Throws:
ConfigurationException- if the instance can't be created (e.g. class not found) or the configuration process itself threw the exception.
-
getConfiguration
- Throws:
ConfigurationException
-
setLogger
-
getAttributeValue
-
setConfiguration
- Throws:
ConfigurationException
-
invoke
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
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
-
isEagerStart
-
getEnabledAttribute
-
getEagerStartAttribute
-
autoconfigure
- Throws:
IllegalAccessException
-
expandEnvProperties
Decorates anElementby replacing its attributes, and contentEnvironmentproperties references.- Parameters:
e- The element being decorated.- Returns:
- The modified element, it is modified in place, but it is returned to ease method chaining or call composition.
-
executorService
-