org.jpos.q2
Class QFactory

java.lang.Object
  extended by org.jpos.q2.QFactory

public class QFactory
extends Object

Version:
$Revision$ $Date$
Author:
Alireza Taherkordi, Alejandro P. Revilla

Constructor Summary
QFactory(ObjectName loaderName, Q2 q2)
           
 
Method Summary
 void configureQBean(MBeanServer server, ObjectName objectName, org.jdom.Element e)
           
 ObjectInstance createQBean(Q2 server, org.jdom.Element e, Object obj)
           
 void destroyQBean(Q2 server, ObjectName objectName, Object obj)
           
 AttributeList getAttributeList(org.jdom.Element e)
           
 String getAttributeName(String name)
          sets the first character of the string to the upper case
protected  Collection getCollection(Class type, org.jdom.Element e)
          Creats a collection from a definition element with the format.
 Configuration getConfiguration(org.jdom.Element e)
           
 void getExtraPath(QClassLoader loader, org.jdom.Element e)
           
protected  Object getObject(org.jdom.Element childElement)
          creates an object from a definition element.
 Q2 getQ2()
           
 Object instantiate(Q2 server, org.jdom.Element e)
           
static void invoke(Object obj, String m, Object p)
          Try to invoke a method (usually a setter) on the given object silently ignoring if method does not exist
static void invoke(Object obj, String m, Object p, Class pc)
          Try to invoke a method (usually a setter) on the given object silently ignoring if method does not exist
 Object newInstance(String clazz)
           
 void setAttribute(MBeanServer server, ObjectName objectName, String attribute, Object value)
           
 void setConfiguration(Object obj, org.jdom.Element e)
           
 void setLogger(Object obj, org.jdom.Element e)
           
 void startQBean(Q2 server, ObjectName objectName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QFactory

public QFactory(ObjectName loaderName,
                Q2 q2)
Method Detail

instantiate

public Object instantiate(Q2 server,
                          org.jdom.Element e)
                   throws ReflectionException,
                          MBeanException,
                          InstanceNotFoundException
Throws:
ReflectionException
MBeanException
InstanceNotFoundException

createQBean

public ObjectInstance createQBean(Q2 server,
                                  org.jdom.Element e,
                                  Object obj)
                           throws ClassNotFoundException,
                                  InstantiationException,
                                  IllegalAccessException,
                                  MalformedObjectNameException,
                                  MalformedURLException,
                                  InstanceAlreadyExistsException,
                                  MBeanRegistrationException,
                                  InstanceNotFoundException,
                                  MBeanException,
                                  NotCompliantMBeanException,
                                  InvalidAttributeValueException,
                                  ReflectionException,
                                  ConfigurationException
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
MalformedObjectNameException
MalformedURLException
InstanceAlreadyExistsException
MBeanRegistrationException
InstanceNotFoundException
MBeanException
NotCompliantMBeanException
InvalidAttributeValueException
ReflectionException
ConfigurationException

getQ2

public Q2 getQ2()

getExtraPath

public void getExtraPath(QClassLoader loader,
                         org.jdom.Element e)

setAttribute

public void setAttribute(MBeanServer server,
                         ObjectName objectName,
                         String attribute,
                         Object value)
                  throws InstanceNotFoundException,
                         MBeanException,
                         InvalidAttributeValueException,
                         ReflectionException
Throws:
InstanceNotFoundException
MBeanException
InvalidAttributeValueException
ReflectionException

startQBean

public void startQBean(Q2 server,
                       ObjectName objectName)
                throws ClassNotFoundException,
                       InstantiationException,
                       IllegalAccessException,
                       MalformedObjectNameException,
                       MalformedURLException,
                       InstanceAlreadyExistsException,
                       MBeanRegistrationException,
                       InstanceNotFoundException,
                       MBeanException,
                       NotCompliantMBeanException,
                       InvalidAttributeValueException,
                       ReflectionException
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
MalformedObjectNameException
MalformedURLException
InstanceAlreadyExistsException
MBeanRegistrationException
InstanceNotFoundException
MBeanException
NotCompliantMBeanException
InvalidAttributeValueException
ReflectionException

destroyQBean

public void destroyQBean(Q2 server,
                         ObjectName objectName,
                         Object obj)
                  throws ClassNotFoundException,
                         InstantiationException,
                         IllegalAccessException,
                         MalformedObjectNameException,
                         MalformedURLException,
                         InstanceAlreadyExistsException,
                         MBeanRegistrationException,
                         InstanceNotFoundException,
                         MBeanException,
                         NotCompliantMBeanException,
                         InvalidAttributeValueException,
                         ReflectionException
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException
MalformedObjectNameException
MalformedURLException
InstanceAlreadyExistsException
MBeanRegistrationException
InstanceNotFoundException
MBeanException
NotCompliantMBeanException
InvalidAttributeValueException
ReflectionException

configureQBean

public void configureQBean(MBeanServer server,
                           ObjectName objectName,
                           org.jdom.Element e)
                    throws ConfigurationException
Throws:
ConfigurationException

getAttributeList

public AttributeList getAttributeList(org.jdom.Element e)
                               throws ConfigurationException
Throws:
ConfigurationException

getObject

protected Object getObject(org.jdom.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 Collection getCollection(Class type,
                                   org.jdom.Element e)
                            throws ConfigurationException
Creats a collection from a definition element with the format.
    <{attr|item} type="...">
        ...
        ...
    
 

Parameters:
type -
e -
Returns:
Throws:
ConfigurationException

getAttributeName

public String getAttributeName(String name)
sets the first character of the string to the upper case

Parameters:
name -
Returns:
attribute name

newInstance

public Object newInstance(String clazz)
                   throws ConfigurationException
Throws:
ConfigurationException

getConfiguration

public Configuration getConfiguration(org.jdom.Element e)
                               throws ConfigurationException
Throws:
ConfigurationException

setLogger

public void setLogger(Object obj,
                      org.jdom.Element e)

setConfiguration

public void setConfiguration(Object obj,
                             org.jdom.Element e)
                      throws ConfigurationException
Throws:
ConfigurationException

invoke

public static void invoke(Object obj,
                          String m,
                          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 object
m - method to invoke
p - parameter
Throws:
ConfigurationException - if method happens to throw an exception

invoke

public static void invoke(Object obj,
                          String m,
                          Object p,
                          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 object
m - method to invoke
p - parameter
pc - parameter class
Throws:
ConfigurationException - if method happens to throw an exception


Copyright © 1998-2012 jPOS.org. All Rights Reserved.