Package lt.baltic_amadeus.jqbridge.server

Examples of lt.baltic_amadeus.jqbridge.server.PortConfigurationException


        Config conf = provider.getConfig();
        String pfx = "port." + name + ".";
        /* Queue manager name */
        queueMgr = conf.getString(pfx + "queuemgr");
        if (queueMgr == null || queueMgr.equals(""))
            throw new PortConfigurationException(this, "queue manager property (queuemgr) not set");
        /* Connection mode */
        connProps = new Hashtable();
        String connMode = conf.getString(pfx + "connmode", "bindings");
        if (connMode.equals("bindings"))
            connProps.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_BINDINGS);
        else if (connMode.equals("client"))
            connProps.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);
        else
            throw new PortConfigurationException(this, "connection mode property (connmode) must be either 'bindings' or 'client'");
        /* Connection properties */
        String hostStr = conf.getString(pfx + "host");
        String portStr = conf.getString(pfx + "port");
        String chanStr = conf.getString(pfx + "channel");
        String userStr = conf.getString(pfx + "user");
        String passStr = conf.getString(pfx + "password");
        if (connMode.equals("bindings")) {
            if (hostStr != null && ! hostStr.equals("") ||
                portStr != null & ! portStr.equals("") ||
                chanStr != null & ! chanStr.equals("") ||
                userStr != null & ! userStr.equals("") ||
                passStr != null & ! passStr.equals(""))
            throw new PortConfigurationException(this, "properties host, port, channel, user and password must not be defined when connection mode (connmode) is set to 'bindings'");
        }
        else {
            if (hostStr == null || hostStr.equals(""))
                throw new PortConfigurationException(this, "queue manager host property (host) not set");
            connProps.put(MQC.HOST_NAME_PROPERTY, hostStr);
            if (portStr != null && ! portStr.equals("")) {
                try {
                    int portNum = Integer.parseInt(portStr);
                    connProps.put(MQC.PORT_PROPERTY, new Integer(portNum));
                } catch (NumberFormatException ex) {
                    throw new PortConfigurationException(this, "queue manager port property (port) must be a valid integer");
                }
            }
            if (chanStr == null || chanStr.equals(""))
                throw new PortConfigurationException(this, "queue manager channel property (channel) not set");
            connProps.put(MQC.CHANNEL_PROPERTY, chanStr);
            if (userStr != null && ! userStr.equals(""))
                connProps.put(MQC.USER_ID_PROPERTY, userStr);
            if (passStr != null && ! passStr.equals(""))
                connProps.put(MQC.PASSWORD_PROPERTY, passStr);
View Full Code Here


        Config conf = provider.getConfig();
        String pfx = "port." + name + "."
        /* Queue manager name */
        queueMgr = conf.getString(pfx + "queuemgr");
        if (queueMgr == null || queueMgr.equals(""))
            throw new PortConfigurationException(this, "queue manager property (queuemgr) not set");
        /* Connection properties */
        connProps = new Hashtable();
        connProps.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_BINDINGS);
    }
View Full Code Here

                        );
            }
            msgLog = port.getProvider().getMessageLogger();
        }
        catch (InvalidDestinationException ex) {
            throw new PortConfigurationException(port.getName(), "invalid port destination " + ep.getDestination());
        }
        catch (javax.jms.IllegalStateException ex) {
            throw new ConnectionDownException(ex);
        }
        catch (JMSException ex) {
View Full Code Here

                        );
            }
            msgLog = port.getProvider().getMessageLogger();
        }
        catch (InvalidDestinationException ex) {
            throw new PortConfigurationException(port.getName(), "invalid port destination " + ep.getDestination());
        }
        catch (javax.jms.IllegalStateException ex) {
            throw new ConnectionDownException(ex);
        }
        catch (JMSException ex) {
View Full Code Here

        BeanInfo info;
        try {
            info = Introspector.getBeanInfo(obj.getClass());
        }
        catch (IntrospectionException ex) {
            throw new PortConfigurationException(name,
                    "cannot assign factory properties because of an error while detecting them", ex);
        }
        Map props = new HashMap(); /* property name -> PropertyDescriptor */
        PropertyDescriptor[] dscs = info.getPropertyDescriptors();
        for (int j = 0; j < dscs.length; j++) {
            PropertyDescriptor desctor = dscs[j];
            props.put(desctor.getName(), desctor);
        }
        /* assign properties */
        while (i.hasNext()) {
            String cfName = (String) i.next();
            String propName = cfName.substring(cfName.lastIndexOf('.') + 1);
            PropertyDescriptor desctor = (PropertyDescriptor) props.get(propName);
            if (desctor == null)
                throw new PortConfigurationException(name,
                        "cannot assign factory property " + propName + " because it doesn't exist");
            Method setter = desctor.getWriteMethod();
            if (setter == null)
                throw new PortConfigurationException(name,
                        "cannot assign factory property " + propName + " because it is not writable");
            Class propType = desctor.getPropertyType();
            if (propType == null || propType.isArray())
                throw new PortConfigurationException(name,
                        "cannot assign factory property " + propName + " because it is indexed property");
            try {
                if (propType.equals(String.class)) {
                    /* String property */
                    String strValue = conf.getString(cfName);
                    setter.invoke(obj, new Object[] { strValue });
                }
                else if (propType.equals(Integer.class) || propType.equals(Integer.TYPE)) {
                    /* int property */
                    int intValue = conf.getInt(cfName);
                    setter.invoke(obj, new Object[] { new Integer(intValue) });
                }
                else if (propType.equals(Boolean.class) || propType.equals(Boolean.TYPE)) {
                    /* boolean property */
                    boolean boolValue = conf.getBool(cfName);
                    setter.invoke(obj, new Object[] { new Boolean(boolValue) });
                }
                else {
                    throw new PortConfigurationException(name,
                            "cannot assign factory property " + propName + " because its type (" + propType + ") is not supported");               
                }
            }
            catch (BridgeException ex) {
                throw ex;
            }
            catch (Exception ex) {
                throw new PortConfigurationException(name,
                        "cannot assign factory property " + propName, ex);               
            }
        }
    }
View Full Code Here

                throw ex;
            }
        }
        catch (JMSException ex) {
            if (firstTime)
                throw new PortConfigurationException(name, "JMS connection could not be initiated", ex);
            else
                throw new CommunicationException(this, ex);
        }
        /* success */
        log.info("Port " + name + " connection restored");
View Full Code Here

TOP

Related Classes of lt.baltic_amadeus.jqbridge.server.PortConfigurationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.