Search in sources :

Example 1 with TopicImpl

use of com.swiftmq.jms.TopicImpl in project swiftmq-client by iitsoftware.

the class SwiftMQObjectFactory method getObjectInstance.

public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
    if (obj instanceof Reference) {
        Reference ref = (Reference) obj;
        if (ref.getClassName().equals(TopicImpl.class.getName())) {
            RefAddr addr = ref.get("topicName");
            if (addr != null) {
                return new TopicImpl((String) addr.getContent());
            }
        } else if (ref.getClassName().equals(QueueImpl.class.getName())) {
            RefAddr addr = ref.get("queueName");
            if (addr != null) {
                return new QueueImpl((String) addr.getContent());
            }
        } else if (ref.getClassName().equals(com.swiftmq.jms.v400.ConnectionFactoryImpl.class.getName())) {
            RefAddr listenerName = ref.get("listenerName");
            RefAddr socketFactoryClass = ref.get("socketFactoryClass");
            RefAddr hostname = ref.get("hostname");
            RefAddr port = ref.get("port");
            RefAddr keepaliveInterval = ref.get("keepaliveInterval");
            RefAddr clientId = ref.get("clientId");
            RefAddr smqpProducerReplyInterval = ref.get("smqpProducerReplyInterval");
            RefAddr smqpConsumerCacheSize = ref.get("smqpConsumerCacheSize");
            RefAddr jmsDeliveryMode = ref.get("jmsDeliveryMode");
            RefAddr jmsPriority = ref.get("jmsPriority");
            RefAddr jmsTTL = ref.get("jmsTTL");
            RefAddr jmsMessageIdEnabled = ref.get("jmsMessageIdEnabled");
            RefAddr jmsMessageTimestampEnabled = ref.get("jmsMessageTimestampEnabled");
            RefAddr useThreadContextCL = ref.get("useThreadContextCL");
            RefAddr inputBufferSize = ref.get("inputBufferSize");
            RefAddr inputExtendSize = ref.get("inputExtendSize");
            RefAddr outputBufferSize = ref.get("outputBufferSize");
            RefAddr outputExtendSize = ref.get("outputExtendSize");
            RefAddr intraVM = ref.get("intraVM");
            if (listenerName != null && socketFactoryClass != null && hostname != null && port != null && keepaliveInterval != null && smqpProducerReplyInterval != null && smqpConsumerCacheSize != null && jmsDeliveryMode != null && jmsPriority != null && jmsTTL != null && jmsMessageIdEnabled != null && jmsMessageTimestampEnabled != null && useThreadContextCL != null && inputBufferSize != null && inputExtendSize != null && outputBufferSize != null && outputExtendSize != null && intraVM != null) {
                com.swiftmq.jms.v400.ConnectionFactoryImpl cf = new com.swiftmq.jms.v400.ConnectionFactoryImpl((String) listenerName.getContent(), (String) socketFactoryClass.getContent(), (String) hostname.getContent(), Integer.parseInt((String) port.getContent()), Long.parseLong((String) keepaliveInterval.getContent()), clientId == null ? null : (String) clientId.getContent(), Integer.parseInt((String) smqpProducerReplyInterval.getContent()), Integer.parseInt((String) smqpConsumerCacheSize.getContent()), Integer.parseInt((String) jmsDeliveryMode.getContent()), Integer.parseInt((String) jmsPriority.getContent()), Long.parseLong((String) jmsTTL.getContent()), Boolean.valueOf((String) jmsMessageIdEnabled.getContent()).booleanValue(), Boolean.valueOf((String) jmsMessageTimestampEnabled.getContent()).booleanValue(), Boolean.valueOf((String) useThreadContextCL.getContent()).booleanValue(), Integer.parseInt((String) inputBufferSize.getContent()), Integer.parseInt((String) inputExtendSize.getContent()), Integer.parseInt((String) outputBufferSize.getContent()), Integer.parseInt((String) outputExtendSize.getContent()), Boolean.valueOf((String) intraVM.getContent()).booleanValue());
                return cf;
            }
        } else if (ref.getClassName().equals(com.swiftmq.jms.v500.ConnectionFactoryImpl.class.getName())) {
            RefAddr listenerName = ref.get("listenerName");
            RefAddr socketFactoryClass = ref.get("socketFactoryClass");
            RefAddr hostname = ref.get("hostname");
            RefAddr port = ref.get("port");
            RefAddr keepaliveInterval = ref.get("keepaliveInterval");
            RefAddr clientId = ref.get("clientId");
            RefAddr smqpProducerReplyInterval = ref.get("smqpProducerReplyInterval");
            RefAddr smqpConsumerCacheSize = ref.get("smqpConsumerCacheSize");
            RefAddr jmsDeliveryMode = ref.get("jmsDeliveryMode");
            RefAddr jmsPriority = ref.get("jmsPriority");
            RefAddr jmsTTL = ref.get("jmsTTL");
            RefAddr jmsMessageIdEnabled = ref.get("jmsMessageIdEnabled");
            RefAddr jmsMessageTimestampEnabled = ref.get("jmsMessageTimestampEnabled");
            RefAddr useThreadContextCL = ref.get("useThreadContextCL");
            RefAddr inputBufferSize = ref.get("inputBufferSize");
            RefAddr inputExtendSize = ref.get("inputExtendSize");
            RefAddr outputBufferSize = ref.get("outputBufferSize");
            RefAddr outputExtendSize = ref.get("outputExtendSize");
            RefAddr intraVM = ref.get("intraVM");
            if (listenerName != null && socketFactoryClass != null && hostname != null && port != null && keepaliveInterval != null && smqpProducerReplyInterval != null && smqpConsumerCacheSize != null && jmsDeliveryMode != null && jmsPriority != null && jmsTTL != null && jmsMessageIdEnabled != null && jmsMessageTimestampEnabled != null && useThreadContextCL != null && inputBufferSize != null && inputExtendSize != null && outputBufferSize != null && outputExtendSize != null && intraVM != null) {
                com.swiftmq.jms.v500.ConnectionFactoryImpl cf = new com.swiftmq.jms.v500.ConnectionFactoryImpl((String) listenerName.getContent(), (String) socketFactoryClass.getContent(), (String) hostname.getContent(), Integer.parseInt((String) port.getContent()), Long.parseLong((String) keepaliveInterval.getContent()), clientId == null ? null : (String) clientId.getContent(), Integer.parseInt((String) smqpProducerReplyInterval.getContent()), Integer.parseInt((String) smqpConsumerCacheSize.getContent()), Integer.parseInt((String) jmsDeliveryMode.getContent()), Integer.parseInt((String) jmsPriority.getContent()), Long.parseLong((String) jmsTTL.getContent()), Boolean.valueOf((String) jmsMessageIdEnabled.getContent()).booleanValue(), Boolean.valueOf((String) jmsMessageTimestampEnabled.getContent()).booleanValue(), Boolean.valueOf((String) useThreadContextCL.getContent()).booleanValue(), Integer.parseInt((String) inputBufferSize.getContent()), Integer.parseInt((String) inputExtendSize.getContent()), Integer.parseInt((String) outputBufferSize.getContent()), Integer.parseInt((String) outputExtendSize.getContent()), Boolean.valueOf((String) intraVM.getContent()).booleanValue());
                return cf;
            }
        } else if (ref.getClassName().equals(com.swiftmq.jms.v510.ConnectionFactoryImpl.class.getName())) {
            RefAddr listenerName = ref.get("listenerName");
            RefAddr socketFactoryClass = ref.get("socketFactoryClass");
            RefAddr hostname = ref.get("hostname");
            RefAddr port = ref.get("port");
            RefAddr keepaliveInterval = ref.get("keepaliveInterval");
            RefAddr clientId = ref.get("clientId");
            RefAddr smqpProducerReplyInterval = ref.get("smqpProducerReplyInterval");
            RefAddr smqpConsumerCacheSize = ref.get("smqpConsumerCacheSize");
            RefAddr jmsDeliveryMode = ref.get("jmsDeliveryMode");
            RefAddr jmsPriority = ref.get("jmsPriority");
            RefAddr jmsTTL = ref.get("jmsTTL");
            RefAddr jmsMessageIdEnabled = ref.get("jmsMessageIdEnabled");
            RefAddr jmsMessageTimestampEnabled = ref.get("jmsMessageTimestampEnabled");
            RefAddr useThreadContextCL = ref.get("useThreadContextCL");
            RefAddr inputBufferSize = ref.get("inputBufferSize");
            RefAddr inputExtendSize = ref.get("inputExtendSize");
            RefAddr outputBufferSize = ref.get("outputBufferSize");
            RefAddr outputExtendSize = ref.get("outputExtendSize");
            RefAddr intraVM = ref.get("intraVM");
            if (listenerName != null && socketFactoryClass != null && hostname != null && port != null && keepaliveInterval != null && smqpProducerReplyInterval != null && smqpConsumerCacheSize != null && jmsDeliveryMode != null && jmsPriority != null && jmsTTL != null && jmsMessageIdEnabled != null && jmsMessageTimestampEnabled != null && useThreadContextCL != null && inputBufferSize != null && inputExtendSize != null && outputBufferSize != null && outputExtendSize != null && intraVM != null) {
                com.swiftmq.jms.v510.ConnectionFactoryImpl cf = new com.swiftmq.jms.v510.ConnectionFactoryImpl((String) listenerName.getContent(), (String) socketFactoryClass.getContent(), (String) hostname.getContent(), Integer.parseInt((String) port.getContent()), Long.parseLong((String) keepaliveInterval.getContent()), clientId == null ? null : (String) clientId.getContent(), Integer.parseInt((String) smqpProducerReplyInterval.getContent()), Integer.parseInt((String) smqpConsumerCacheSize.getContent()), Integer.parseInt((String) jmsDeliveryMode.getContent()), Integer.parseInt((String) jmsPriority.getContent()), Long.parseLong((String) jmsTTL.getContent()), Boolean.valueOf((String) jmsMessageIdEnabled.getContent()).booleanValue(), Boolean.valueOf((String) jmsMessageTimestampEnabled.getContent()).booleanValue(), Boolean.valueOf((String) useThreadContextCL.getContent()).booleanValue(), Integer.parseInt((String) inputBufferSize.getContent()), Integer.parseInt((String) inputExtendSize.getContent()), Integer.parseInt((String) outputBufferSize.getContent()), Integer.parseInt((String) outputExtendSize.getContent()), Boolean.valueOf((String) intraVM.getContent()).booleanValue());
                return cf;
            }
        } else if (ref.getClassName().equals(com.swiftmq.jms.v600.ConnectionFactoryImpl.class.getName())) {
            RefAddr listenerName = ref.get("listenerName");
            RefAddr socketFactoryClass = ref.get("socketFactoryClass");
            RefAddr hostname = ref.get("hostname");
            RefAddr port = ref.get("port");
            RefAddr keepaliveInterval = ref.get("keepaliveInterval");
            RefAddr clientId = ref.get("clientId");
            RefAddr smqpProducerReplyInterval = ref.get("smqpProducerReplyInterval");
            RefAddr smqpConsumerCacheSize = ref.get("smqpConsumerCacheSize");
            RefAddr jmsDeliveryMode = ref.get("jmsDeliveryMode");
            RefAddr jmsPriority = ref.get("jmsPriority");
            RefAddr jmsTTL = ref.get("jmsTTL");
            RefAddr jmsMessageIdEnabled = ref.get("jmsMessageIdEnabled");
            RefAddr jmsMessageTimestampEnabled = ref.get("jmsMessageTimestampEnabled");
            RefAddr useThreadContextCL = ref.get("useThreadContextCL");
            RefAddr inputBufferSize = ref.get("inputBufferSize");
            RefAddr inputExtendSize = ref.get("inputExtendSize");
            RefAddr outputBufferSize = ref.get("outputBufferSize");
            RefAddr outputExtendSize = ref.get("outputExtendSize");
            RefAddr intraVM = ref.get("intraVM");
            RefAddr hostname2 = ref.get("hostname2");
            RefAddr port2 = ref.get("port2");
            RefAddr reconnectEnabled = ref.get("reconnectEnabled");
            RefAddr maxRetries = ref.get("maxRetries");
            RefAddr retryDelay = ref.get("retryDelay");
            RefAddr duplicateMessageDetection = ref.get("duplicateMessageDetection");
            RefAddr duplicateBacklogSize = ref.get("duplicateBacklogSize");
            if (listenerName != null && socketFactoryClass != null && hostname != null && port != null && keepaliveInterval != null && smqpProducerReplyInterval != null && smqpConsumerCacheSize != null && jmsDeliveryMode != null && jmsPriority != null && jmsTTL != null && jmsMessageIdEnabled != null && jmsMessageTimestampEnabled != null && useThreadContextCL != null && inputBufferSize != null && inputExtendSize != null && outputBufferSize != null && outputExtendSize != null && intraVM != null) {
                com.swiftmq.jms.v600.ConnectionFactoryImpl cf = new com.swiftmq.jms.v600.ConnectionFactoryImpl((String) listenerName.getContent(), (String) socketFactoryClass.getContent(), (String) hostname.getContent(), Integer.parseInt((String) port.getContent()), Long.parseLong((String) keepaliveInterval.getContent()), clientId == null ? null : (String) clientId.getContent(), Integer.parseInt((String) smqpProducerReplyInterval.getContent()), Integer.parseInt((String) smqpConsumerCacheSize.getContent()), Integer.parseInt((String) jmsDeliveryMode.getContent()), Integer.parseInt((String) jmsPriority.getContent()), Long.parseLong((String) jmsTTL.getContent()), Boolean.valueOf((String) jmsMessageIdEnabled.getContent()).booleanValue(), Boolean.valueOf((String) jmsMessageTimestampEnabled.getContent()).booleanValue(), Boolean.valueOf((String) useThreadContextCL.getContent()).booleanValue(), Integer.parseInt((String) inputBufferSize.getContent()), Integer.parseInt((String) inputExtendSize.getContent()), Integer.parseInt((String) outputBufferSize.getContent()), Integer.parseInt((String) outputExtendSize.getContent()), Boolean.valueOf((String) intraVM.getContent()).booleanValue());
                cf.setReconnectEnabled(Boolean.valueOf((String) reconnectEnabled.getContent()).booleanValue());
                cf.setMaxRetries(Integer.valueOf((String) maxRetries.getContent()).intValue());
                cf.setRetryDelay(Long.valueOf((String) retryDelay.getContent()).longValue());
                cf.setDuplicateMessageDetection(Boolean.valueOf((String) duplicateMessageDetection.getContent()).booleanValue());
                cf.setDuplicateBacklogSize(Integer.valueOf((String) duplicateBacklogSize.getContent()).intValue());
                if (hostname2 != null) {
                    cf.setHostname2((String) hostname2.getContent());
                    cf.setPort2(Integer.parseInt((String) port2.getContent()));
                }
                return cf;
            }
        } else if (ref.getClassName().equals(com.swiftmq.jms.v610.ConnectionFactoryImpl.class.getName())) {
            RefAddr listenerName = ref.get("listenerName");
            RefAddr socketFactoryClass = ref.get("socketFactoryClass");
            RefAddr hostname = ref.get("hostname");
            RefAddr port = ref.get("port");
            RefAddr keepaliveInterval = ref.get("keepaliveInterval");
            RefAddr clientId = ref.get("clientId");
            RefAddr smqpProducerReplyInterval = ref.get("smqpProducerReplyInterval");
            RefAddr smqpConsumerCacheSize = ref.get("smqpConsumerCacheSize");
            RefAddr jmsDeliveryMode = ref.get("jmsDeliveryMode");
            RefAddr jmsPriority = ref.get("jmsPriority");
            RefAddr jmsTTL = ref.get("jmsTTL");
            RefAddr jmsMessageIdEnabled = ref.get("jmsMessageIdEnabled");
            RefAddr jmsMessageTimestampEnabled = ref.get("jmsMessageTimestampEnabled");
            RefAddr useThreadContextCL = ref.get("useThreadContextCL");
            RefAddr inputBufferSize = ref.get("inputBufferSize");
            RefAddr inputExtendSize = ref.get("inputExtendSize");
            RefAddr outputBufferSize = ref.get("outputBufferSize");
            RefAddr outputExtendSize = ref.get("outputExtendSize");
            RefAddr intraVM = ref.get("intraVM");
            RefAddr hostname2 = ref.get("hostname2");
            RefAddr port2 = ref.get("port2");
            RefAddr reconnectEnabled = ref.get("reconnectEnabled");
            RefAddr maxRetries = ref.get("maxRetries");
            RefAddr retryDelay = ref.get("retryDelay");
            RefAddr duplicateMessageDetection = ref.get("duplicateMessageDetection");
            RefAddr duplicateBacklogSize = ref.get("duplicateBacklogSize");
            if (listenerName != null && socketFactoryClass != null && hostname != null && port != null && keepaliveInterval != null && smqpProducerReplyInterval != null && smqpConsumerCacheSize != null && jmsDeliveryMode != null && jmsPriority != null && jmsTTL != null && jmsMessageIdEnabled != null && jmsMessageTimestampEnabled != null && useThreadContextCL != null && inputBufferSize != null && inputExtendSize != null && outputBufferSize != null && outputExtendSize != null && intraVM != null) {
                com.swiftmq.jms.v610.ConnectionFactoryImpl cf = new com.swiftmq.jms.v610.ConnectionFactoryImpl((String) listenerName.getContent(), (String) socketFactoryClass.getContent(), (String) hostname.getContent(), Integer.parseInt((String) port.getContent()), Long.parseLong((String) keepaliveInterval.getContent()), clientId == null ? null : (String) clientId.getContent(), Integer.parseInt((String) smqpProducerReplyInterval.getContent()), Integer.parseInt((String) smqpConsumerCacheSize.getContent()), Integer.parseInt((String) jmsDeliveryMode.getContent()), Integer.parseInt((String) jmsPriority.getContent()), Long.parseLong((String) jmsTTL.getContent()), Boolean.valueOf((String) jmsMessageIdEnabled.getContent()).booleanValue(), Boolean.valueOf((String) jmsMessageTimestampEnabled.getContent()).booleanValue(), Boolean.valueOf((String) useThreadContextCL.getContent()).booleanValue(), Integer.parseInt((String) inputBufferSize.getContent()), Integer.parseInt((String) inputExtendSize.getContent()), Integer.parseInt((String) outputBufferSize.getContent()), Integer.parseInt((String) outputExtendSize.getContent()), Boolean.valueOf((String) intraVM.getContent()).booleanValue());
                cf.setReconnectEnabled(Boolean.valueOf((String) reconnectEnabled.getContent()).booleanValue());
                cf.setMaxRetries(Integer.valueOf((String) maxRetries.getContent()).intValue());
                cf.setRetryDelay(Long.valueOf((String) retryDelay.getContent()).longValue());
                cf.setDuplicateMessageDetection(Boolean.valueOf((String) duplicateMessageDetection.getContent()).booleanValue());
                cf.setDuplicateBacklogSize(Integer.valueOf((String) duplicateBacklogSize.getContent()).intValue());
                if (hostname2 != null) {
                    cf.setHostname2((String) hostname2.getContent());
                    cf.setPort2(Integer.parseInt((String) port2.getContent()));
                }
                return cf;
            }
        } else if (ref.getClassName().equals(com.swiftmq.jms.v630.ConnectionFactoryImpl.class.getName())) {
            RefAddr listenerName = ref.get("listenerName");
            RefAddr socketFactoryClass = ref.get("socketFactoryClass");
            RefAddr hostname = ref.get("hostname");
            RefAddr port = ref.get("port");
            RefAddr keepaliveInterval = ref.get("keepaliveInterval");
            RefAddr clientId = ref.get("clientId");
            RefAddr smqpProducerReplyInterval = ref.get("smqpProducerReplyInterval");
            RefAddr smqpConsumerCacheSize = ref.get("smqpConsumerCacheSize");
            RefAddr jmsDeliveryMode = ref.get("jmsDeliveryMode");
            RefAddr jmsPriority = ref.get("jmsPriority");
            RefAddr jmsTTL = ref.get("jmsTTL");
            RefAddr jmsMessageIdEnabled = ref.get("jmsMessageIdEnabled");
            RefAddr jmsMessageTimestampEnabled = ref.get("jmsMessageTimestampEnabled");
            RefAddr useThreadContextCL = ref.get("useThreadContextCL");
            RefAddr inputBufferSize = ref.get("inputBufferSize");
            RefAddr inputExtendSize = ref.get("inputExtendSize");
            RefAddr outputBufferSize = ref.get("outputBufferSize");
            RefAddr outputExtendSize = ref.get("outputExtendSize");
            RefAddr intraVM = ref.get("intraVM");
            RefAddr hostname2 = ref.get("hostname2");
            RefAddr port2 = ref.get("port2");
            RefAddr reconnectEnabled = ref.get("reconnectEnabled");
            RefAddr maxRetries = ref.get("maxRetries");
            RefAddr retryDelay = ref.get("retryDelay");
            RefAddr duplicateMessageDetection = ref.get("duplicateMessageDetection");
            RefAddr duplicateBacklogSize = ref.get("duplicateBacklogSize");
            if (listenerName != null && socketFactoryClass != null && hostname != null && port != null && keepaliveInterval != null && smqpProducerReplyInterval != null && smqpConsumerCacheSize != null && jmsDeliveryMode != null && jmsPriority != null && jmsTTL != null && jmsMessageIdEnabled != null && jmsMessageTimestampEnabled != null && useThreadContextCL != null && inputBufferSize != null && inputExtendSize != null && outputBufferSize != null && outputExtendSize != null && intraVM != null) {
                com.swiftmq.jms.v630.ConnectionFactoryImpl cf = new com.swiftmq.jms.v630.ConnectionFactoryImpl((String) listenerName.getContent(), (String) socketFactoryClass.getContent(), (String) hostname.getContent(), Integer.parseInt((String) port.getContent()), Long.parseLong((String) keepaliveInterval.getContent()), clientId == null ? null : (String) clientId.getContent(), Integer.parseInt((String) smqpProducerReplyInterval.getContent()), Integer.parseInt((String) smqpConsumerCacheSize.getContent()), Integer.parseInt((String) jmsDeliveryMode.getContent()), Integer.parseInt((String) jmsPriority.getContent()), Long.parseLong((String) jmsTTL.getContent()), Boolean.valueOf((String) jmsMessageIdEnabled.getContent()).booleanValue(), Boolean.valueOf((String) jmsMessageTimestampEnabled.getContent()).booleanValue(), Boolean.valueOf((String) useThreadContextCL.getContent()).booleanValue(), Integer.parseInt((String) inputBufferSize.getContent()), Integer.parseInt((String) inputExtendSize.getContent()), Integer.parseInt((String) outputBufferSize.getContent()), Integer.parseInt((String) outputExtendSize.getContent()), Boolean.valueOf((String) intraVM.getContent()).booleanValue());
                cf.setReconnectEnabled(Boolean.valueOf((String) reconnectEnabled.getContent()).booleanValue());
                cf.setMaxRetries(Integer.valueOf((String) maxRetries.getContent()).intValue());
                cf.setRetryDelay(Long.valueOf((String) retryDelay.getContent()).longValue());
                cf.setDuplicateMessageDetection(Boolean.valueOf((String) duplicateMessageDetection.getContent()).booleanValue());
                cf.setDuplicateBacklogSize(Integer.valueOf((String) duplicateBacklogSize.getContent()).intValue());
                if (hostname2 != null) {
                    cf.setHostname2((String) hostname2.getContent());
                    cf.setPort2(Integer.parseInt((String) port2.getContent()));
                }
                return cf;
            }
        } else if (ref.getClassName().equals(com.swiftmq.jms.v750.ConnectionFactoryImpl.class.getName())) {
            RefAddr listenerName = ref.get("listenerName");
            RefAddr socketFactoryClass = ref.get("socketFactoryClass");
            RefAddr hostname = ref.get("hostname");
            RefAddr port = ref.get("port");
            RefAddr keepaliveInterval = ref.get("keepaliveInterval");
            RefAddr clientId = ref.get("clientId");
            RefAddr smqpProducerReplyInterval = ref.get("smqpProducerReplyInterval");
            RefAddr smqpConsumerCacheSize = ref.get("smqpConsumerCacheSize");
            RefAddr smqpConsumerCacheSizeKB = ref.get("smqpConsumerCacheSizeKB");
            RefAddr jmsDeliveryMode = ref.get("jmsDeliveryMode");
            RefAddr jmsPriority = ref.get("jmsPriority");
            RefAddr jmsTTL = ref.get("jmsTTL");
            RefAddr jmsMessageIdEnabled = ref.get("jmsMessageIdEnabled");
            RefAddr jmsMessageTimestampEnabled = ref.get("jmsMessageTimestampEnabled");
            RefAddr useThreadContextCL = ref.get("useThreadContextCL");
            RefAddr inputBufferSize = ref.get("inputBufferSize");
            RefAddr inputExtendSize = ref.get("inputExtendSize");
            RefAddr outputBufferSize = ref.get("outputBufferSize");
            RefAddr outputExtendSize = ref.get("outputExtendSize");
            RefAddr intraVM = ref.get("intraVM");
            RefAddr hostname2 = ref.get("hostname2");
            RefAddr port2 = ref.get("port2");
            RefAddr reconnectEnabled = ref.get("reconnectEnabled");
            RefAddr maxRetries = ref.get("maxRetries");
            RefAddr retryDelay = ref.get("retryDelay");
            RefAddr duplicateMessageDetection = ref.get("duplicateMessageDetection");
            RefAddr duplicateBacklogSize = ref.get("duplicateBacklogSize");
            if (listenerName != null && socketFactoryClass != null && hostname != null && port != null && keepaliveInterval != null && smqpProducerReplyInterval != null && smqpConsumerCacheSize != null && smqpConsumerCacheSizeKB != null && jmsDeliveryMode != null && jmsPriority != null && jmsTTL != null && jmsMessageIdEnabled != null && jmsMessageTimestampEnabled != null && useThreadContextCL != null && inputBufferSize != null && inputExtendSize != null && outputBufferSize != null && outputExtendSize != null && intraVM != null) {
                com.swiftmq.jms.v750.ConnectionFactoryImpl cf = new com.swiftmq.jms.v750.ConnectionFactoryImpl((String) listenerName.getContent(), (String) socketFactoryClass.getContent(), (String) hostname.getContent(), Integer.parseInt((String) port.getContent()), Long.parseLong((String) keepaliveInterval.getContent()), clientId == null ? null : (String) clientId.getContent(), Integer.parseInt((String) smqpProducerReplyInterval.getContent()), Integer.parseInt((String) smqpConsumerCacheSize.getContent()), Integer.parseInt((String) smqpConsumerCacheSizeKB.getContent()), Integer.parseInt((String) jmsDeliveryMode.getContent()), Integer.parseInt((String) jmsPriority.getContent()), Long.parseLong((String) jmsTTL.getContent()), Boolean.valueOf((String) jmsMessageIdEnabled.getContent()).booleanValue(), Boolean.valueOf((String) jmsMessageTimestampEnabled.getContent()).booleanValue(), Boolean.valueOf((String) useThreadContextCL.getContent()).booleanValue(), Integer.parseInt((String) inputBufferSize.getContent()), Integer.parseInt((String) inputExtendSize.getContent()), Integer.parseInt((String) outputBufferSize.getContent()), Integer.parseInt((String) outputExtendSize.getContent()), Boolean.valueOf((String) intraVM.getContent()).booleanValue());
                cf.setReconnectEnabled(Boolean.valueOf((String) reconnectEnabled.getContent()).booleanValue());
                cf.setMaxRetries(Integer.valueOf((String) maxRetries.getContent()).intValue());
                cf.setRetryDelay(Long.valueOf((String) retryDelay.getContent()).longValue());
                cf.setDuplicateMessageDetection(Boolean.valueOf((String) duplicateMessageDetection.getContent()).booleanValue());
                cf.setDuplicateBacklogSize(Integer.valueOf((String) duplicateBacklogSize.getContent()).intValue());
                if (hostname2 != null) {
                    cf.setHostname2((String) hostname2.getContent());
                    cf.setPort2(Integer.parseInt((String) port2.getContent()));
                }
                return cf;
            }
        }
    }
    return null;
}
Also used : Reference(javax.naming.Reference) QueueImpl(com.swiftmq.jms.QueueImpl) RefAddr(javax.naming.RefAddr) TopicImpl(com.swiftmq.jms.TopicImpl)

Example 2 with TopicImpl

use of com.swiftmq.jms.TopicImpl in project swiftmq-ce by iitsoftware.

the class NontransactedTopicSession method visit.

public void visit(ProduceMessageRequest req) {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitProduceMessageRequest");
    ctx.incMsgsSent(1);
    ProduceMessageReply reply = null;
    if (req.isReplyRequired())
        reply = (ProduceMessageReply) req.createReply();
    int producerId = req.getQueueProducerId();
    Producer producer = null;
    try {
        MessageImpl msg = SMQPUtil.getMessage(req);
        if (producerId == -1) {
            TopicImpl topic = (TopicImpl) msg.getJMSDestination();
            if (topic.getType() != DestinationFactory.TYPE_TEMPTOPIC)
                ctx.authSwiftlet.verifyTopicSenderSubscription(topic.getTopicName(), ctx.activeLogin.getLoginId());
            producer = new TopicProducer(ctx, topic);
        } else {
            producer = (Producer) producerList.get(producerId);
        }
        QueuePushTransaction transaction = (QueuePushTransaction) producer.createTransaction();
        transaction.putMessage(msg);
        transaction.commit();
        if (req.isReplyRequired()) {
            reply.setDelay(transaction.getFlowControlDelay());
            reply.setOk(true);
        }
        if (producerId == -1)
            producer.close();
    } catch (Exception e) {
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/produce messages failed: " + e.getMessage());
        if (req.isReplyRequired()) {
            reply.setOk(false);
            reply.setException(e);
        }
    }
    if (req.isReplyRequired())
        reply.send();
}
Also used : QueuePushTransaction(com.swiftmq.swiftlet.queue.QueuePushTransaction) TopicImpl(com.swiftmq.jms.TopicImpl) MessageImpl(com.swiftmq.jms.MessageImpl) JMSException(javax.jms.JMSException) ResourceLimitException(com.swiftmq.swiftlet.auth.ResourceLimitException) InvalidSelectorException(javax.jms.InvalidSelectorException)

Example 3 with TopicImpl

use of com.swiftmq.jms.TopicImpl in project swiftmq-ce by iitsoftware.

the class NontransactedTopicSession method visit.

public void visit(CreateSubscriberRequest req) {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitCreateSubscriberRequest");
    CreateSubscriberReply reply = (CreateSubscriberReply) req.createReply();
    try {
        ctx.activeLogin.getResourceLimitGroup().incConsumers();
    } catch (ResourceLimitException e) {
        reply.setOk(false);
        reply.setException(new JMSException(e.toString()));
        reply.send();
        return;
    }
    TopicImpl topic = req.getTopic();
    String messageSelector = req.getMessageSelector();
    boolean noLocal = req.isNoLocal();
    try {
        Entity subEntity = null;
        if (subscriberEntityList != null)
            subEntity = subscriberEntityList.createEntity();
        int consumerId = 0;
        TopicConsumer consumer = null;
        if (topic.getType() == DestinationFactory.TYPE_TOPIC) {
            consumerId = ArrayListTool.setFirstFreeOrExpand(consumerList, null);
            consumer = new TopicConsumer(ctx, topic, messageSelector, noLocal);
            consumerList.set(consumerId, consumer);
            if (subEntity != null) {
                Property prop = subEntity.getProperty("topic");
                prop.setReadOnly(false);
                prop.setValue(topic.getTopicName());
                prop.setReadOnly(true);
                prop = subEntity.getProperty("boundto");
                prop.setReadOnly(false);
                prop.setValue(topic.getQueueName());
                prop.setReadOnly(true);
                subEntity.setDynamicObject(consumer);
            }
            if (subEntity != null)
                subEntity.setName(topic.getTopicName() + "-" + consumerId);
        } else {
            consumerId = ArrayListTool.setFirstFreeOrExpand(consumerList, null);
            consumer = new TopicConsumer(ctx, topic, messageSelector, noLocal);
            consumerList.set(consumerId, consumer);
            if (subEntity != null)
                subEntity.setDynamicObject(consumer);
            if (subEntity != null) {
                subEntity.setName(topic.getQueueName() + "-" + consumerId);
                Property prop = subEntity.getProperty("temptopic");
                prop.setReadOnly(false);
                prop.setValue(new Boolean(true));
                prop.setReadOnly(true);
                prop = subEntity.getProperty("boundto");
                prop.setReadOnly(false);
                prop.setValue(topic.getQueueName());
                prop.setReadOnly(true);
            }
        }
        consumer.setAutoCommit(req.isAutoCommit());
        consumer.createReadTransaction();
        consumer.createTransaction();
        reply.setOk(true);
        reply.setTopicSubscriberId(consumerId);
        reply.setTmpQueueName((consumer).getQueueName());
        if (subEntity != null) {
            Property prop = subEntity.getProperty("nolocal");
            prop.setReadOnly(false);
            prop.setValue(new Boolean(noLocal));
            prop.setReadOnly(true);
            subEntity.createCommands();
            prop = subEntity.getProperty("selector");
            if (messageSelector != null) {
                prop.setValue(messageSelector);
            }
            prop.setReadOnly(true);
            subscriberEntityList.addEntity(subEntity);
        }
    } catch (InvalidSelectorException e) {
        ctx.activeLogin.getResourceLimitGroup().decConsumers();
        ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/CreateSubscriber has invalid Selector: " + e);
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/CreateSubscriber has invalid Selector: " + e);
        reply.setOk(false);
        reply.setException(e);
    } catch (Exception e1) {
        ctx.activeLogin.getResourceLimitGroup().decConsumers();
        ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/Exception during create subscriber: " + e1);
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/Exception during create subscriber (req=" + req + "): \n" + SwiftUtilities.getStackTrace(e1));
        reply.setOk(false);
        reply.setException(e1);
    }
    reply.send();
}
Also used : Entity(com.swiftmq.mgmt.Entity) InvalidSelectorException(javax.jms.InvalidSelectorException) JMSException(javax.jms.JMSException) JMSException(javax.jms.JMSException) ResourceLimitException(com.swiftmq.swiftlet.auth.ResourceLimitException) InvalidSelectorException(javax.jms.InvalidSelectorException) TopicImpl(com.swiftmq.jms.TopicImpl) Property(com.swiftmq.mgmt.Property) ResourceLimitException(com.swiftmq.swiftlet.auth.ResourceLimitException)

Example 4 with TopicImpl

use of com.swiftmq.jms.TopicImpl in project swiftmq-ce by iitsoftware.

the class NontransactedTopicSession method visit.

public void visit(CreateDurableRequest req) {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitCreateDurableRequest");
    CreateDurableReply reply = (CreateDurableReply) req.createReply();
    try {
        ctx.activeLogin.getResourceLimitGroup().incConsumers();
    } catch (ResourceLimitException e) {
        reply.setOk(false);
        reply.setException(new JMSException(e.toString()));
        reply.send();
        return;
    }
    TopicImpl topic = req.getTopic();
    String messageSelector = req.getMessageSelector();
    boolean noLocal = req.isNoLocal();
    String durableName = req.getDurableName();
    try {
        int consumerId = 0;
        TopicDurableConsumer consumer = null;
        consumerId = ArrayListTool.setFirstFreeOrExpand(consumerList, null);
        consumer = new TopicDurableConsumer(ctx, durableName, topic, messageSelector, noLocal);
        consumerList.set(consumerId, consumer);
        consumer.createReadTransaction();
        consumer.createTransaction();
        reply.setOk(true);
        reply.setTopicSubscriberId(consumerId);
        reply.setQueueName(consumer.getQueueName() + '@' + SwiftletManager.getInstance().getRouterName());
        if (durableEntityList != null) {
            Entity durEntity = durableEntityList.createEntity();
            durEntity.setName(ctx.activeLogin.getClientId() + "$" + durableName);
            durEntity.createCommands();
            Property prop = durEntity.getProperty("clientid");
            prop.setValue(ctx.activeLogin.getClientId());
            prop.setReadOnly(true);
            prop = durEntity.getProperty("durablename");
            prop.setValue(durableName);
            prop.setReadOnly(true);
            prop = durEntity.getProperty("topic");
            prop.setValue(topic.getTopicName());
            prop.setReadOnly(true);
            prop = durEntity.getProperty("boundto");
            prop.setValue(consumer.getQueueName());
            prop.setReadOnly(true);
            prop = durEntity.getProperty("nolocal");
            prop.setValue(new Boolean(noLocal));
            prop.setReadOnly(true);
            prop = durEntity.getProperty("selector");
            if (messageSelector != null) {
                prop.setValue(messageSelector);
            }
            prop.setReadOnly(true);
            durableEntityList.addEntity(durEntity);
        }
    } catch (InvalidSelectorException e) {
        ctx.activeLogin.getResourceLimitGroup().decConsumers();
        ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/CreateDurable has invalid Selector: " + e);
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/CreateDurable has invalid Selector: " + e);
        reply.setOk(false);
        reply.setException(e);
    } catch (Exception e1) {
        ctx.activeLogin.getResourceLimitGroup().decConsumers();
        ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/Exception during create durable: " + e1);
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/Exception during create durable: " + e1);
        reply.setOk(false);
        reply.setException(e1);
    }
    reply.send();
}
Also used : Entity(com.swiftmq.mgmt.Entity) InvalidSelectorException(javax.jms.InvalidSelectorException) JMSException(javax.jms.JMSException) JMSException(javax.jms.JMSException) ResourceLimitException(com.swiftmq.swiftlet.auth.ResourceLimitException) InvalidSelectorException(javax.jms.InvalidSelectorException) TopicImpl(com.swiftmq.jms.TopicImpl) Property(com.swiftmq.mgmt.Property) ResourceLimitException(com.swiftmq.swiftlet.auth.ResourceLimitException)

Example 5 with TopicImpl

use of com.swiftmq.jms.TopicImpl in project swiftmq-ce by iitsoftware.

the class NontransactedTopicSession method visit.

public void visit(CreateDurableRequest req) {
    if (ctx.traceSpace.enabled)
        ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/visitCreateDurableRequest");
    CreateDurableReply reply = (CreateDurableReply) req.createReply();
    try {
        ctx.activeLogin.getResourceLimitGroup().incConsumers();
    } catch (ResourceLimitException e) {
        reply.setOk(false);
        reply.setException(new JMSException(e.toString()));
        reply.send();
        return;
    }
    TopicImpl topic = req.getTopic();
    String messageSelector = req.getMessageSelector();
    boolean noLocal = req.isNoLocal();
    String durableName = req.getDurableName();
    try {
        int consumerId = 0;
        TopicDurableConsumer consumer = null;
        consumerId = ArrayListTool.setFirstFreeOrExpand(consumerList, null);
        consumer = new TopicDurableConsumer(ctx, durableName, topic, messageSelector, noLocal);
        consumerList.set(consumerId, consumer);
        consumer.createReadTransaction();
        consumer.createTransaction();
        reply.setOk(true);
        reply.setTopicSubscriberId(consumerId);
        reply.setQueueName(consumer.getQueueName() + '@' + SwiftletManager.getInstance().getRouterName());
        if (durableEntityList != null) {
            Entity durEntity = durableEntityList.createEntity();
            durEntity.setName(ctx.activeLogin.getClientId() + "$" + durableName);
            durEntity.createCommands();
            Property prop = durEntity.getProperty("clientid");
            prop.setValue(ctx.activeLogin.getClientId());
            prop.setReadOnly(true);
            prop = durEntity.getProperty("durablename");
            prop.setValue(durableName);
            prop.setReadOnly(true);
            prop = durEntity.getProperty("topic");
            prop.setValue(topic.getTopicName());
            prop.setReadOnly(true);
            prop = durEntity.getProperty("boundto");
            prop.setValue(consumer.getQueueName());
            prop.setReadOnly(true);
            prop = durEntity.getProperty("nolocal");
            prop.setValue(new Boolean(noLocal));
            prop.setReadOnly(true);
            prop = durEntity.getProperty("selector");
            if (messageSelector != null) {
                prop.setValue(messageSelector);
            }
            prop.setReadOnly(true);
            durableEntityList.addEntity(durEntity);
        }
    } catch (InvalidSelectorException e) {
        ctx.activeLogin.getResourceLimitGroup().decConsumers();
        ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/CreateDurable has invalid Selector: " + e);
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/CreateDurable has invalid Selector: " + e);
        reply.setOk(false);
        reply.setException(e);
    } catch (Exception e1) {
        ctx.activeLogin.getResourceLimitGroup().decConsumers();
        ctx.logSwiftlet.logWarning("sys$jms", ctx.tracePrefix + "/Exception during create durable: " + e1);
        if (ctx.traceSpace.enabled)
            ctx.traceSpace.trace("sys$jms", ctx.tracePrefix + "/Exception during create durable: " + e1);
        reply.setOk(false);
        reply.setException(e1);
    }
    reply.send();
}
Also used : Entity(com.swiftmq.mgmt.Entity) InvalidSelectorException(javax.jms.InvalidSelectorException) JMSException(javax.jms.JMSException) JMSException(javax.jms.JMSException) ResourceLimitException(com.swiftmq.swiftlet.auth.ResourceLimitException) InvalidSelectorException(javax.jms.InvalidSelectorException) TopicImpl(com.swiftmq.jms.TopicImpl) Property(com.swiftmq.mgmt.Property) ResourceLimitException(com.swiftmq.swiftlet.auth.ResourceLimitException)

Aggregations

TopicImpl (com.swiftmq.jms.TopicImpl)71 JMSException (javax.jms.JMSException)62 InvalidSelectorException (javax.jms.InvalidSelectorException)58 ResourceLimitException (com.swiftmq.swiftlet.auth.ResourceLimitException)56 Entity (com.swiftmq.mgmt.Entity)42 Property (com.swiftmq.mgmt.Property)42 MessageImpl (com.swiftmq.jms.MessageImpl)17 QueuePushTransaction (com.swiftmq.swiftlet.queue.QueuePushTransaction)14 DataByteArrayInputStream (com.swiftmq.tools.util.DataByteArrayInputStream)8 RingBuffer (com.swiftmq.tools.collection.RingBuffer)7 EntityList (com.swiftmq.mgmt.EntityList)6 List (java.util.List)6 QueueImpl (com.swiftmq.jms.QueueImpl)4 MessageSelector (com.swiftmq.ms.MessageSelector)4 AuthenticationException (com.swiftmq.swiftlet.auth.AuthenticationException)4 TopicException (com.swiftmq.swiftlet.topic.TopicException)4 IOException (java.io.IOException)4 SwiftletException (com.swiftmq.swiftlet.SwiftletException)3 InvalidDestinationException (javax.jms.InvalidDestinationException)3 ActiveLogin (com.swiftmq.swiftlet.auth.ActiveLogin)2