Package org.exolab.jms.persistence

Examples of org.exolab.jms.persistence.PersistenceException


                MessageHandler handler = MessageHandlerFactory.create(
                        qualifiedType, _destinations, _connection);
                result = handler.get(messageId);
            }
        } catch (SQLException exception) {
            throw new PersistenceException(
                    "Failed to get message with JMSMessageID=" + messageId,
                    exception);
        } finally {
            SQLHelper.close(set);
            SQLHelper.close(select);
View Full Code Here


            while (set.next()) {
                String messageId = set.getString("message_id");
                result.add(messageId);
            }
        } catch (SQLException exception) {
            throw new PersistenceException("Failed to get message ids",
                                           exception);
        } finally {
            SQLHelper.close(set);
            SQLHelper.close(select);
        }
View Full Code Here

            select = _connection.prepareStatement(
                    "select * from " + MESSAGE_TABLE + " where message_id = ?");
            select.setString(1, messageId);
            set = select.executeQuery();
            if (!set.next()) {
                throw new PersistenceException(
                        "Message not found, JMSMessageID=" + messageId);
            }
            String correlationId = set.getString("correlation_id");
            int deliveryMode = set.getInt("delivery_mode");
            long destinationId = set.getLong("destination_id");
            long expiration = set.getLong("expiration");
            int priority = set.getInt("priority");
            boolean redelivered = set.getBoolean("redelivered");
            long replyToId = set.getLong("reply_to_id");
            long timestamp = set.getLong("timestamp");
            String type = set.getString("type");

            Destination destination = _destinations.get(destinationId);

            message.setJMSMessageID(messageId);
            message.setJMSCorrelationID(correlationId);
            message.setJMSDeliveryMode(deliveryMode);
            message.setJMSDestination(destination);
            message.setJMSExpiration(expiration);
            message.setJMSPriority(priority);
            message.setJMSRedelivered(redelivered);
            if (replyToId != 0) {
                Destination replyTo = _destinations.get(replyToId);
                message.setJMSReplyTo(replyTo);
            }
            message.setJMSTimestamp(timestamp);
            message.setJMSType(type);

            Blob blob = set.getBlob("body");
            Object body;
            try {
                body = deserialize(blob);
            } catch (Exception exception) {
                throw new PersistenceException(
                        "Failed to deserialize message body, JMSMessageID="
                        + messageId, exception);
            }
            setBody(body, message);
        } catch (SQLException exception) {
            throw new PersistenceException(
                    "Failed to populate message, JMSMessageID="
                    + messageId, exception);
        } finally {
            SQLHelper.close(set);
            SQLHelper.close(select);
View Full Code Here

            Object body = getBody(message);
            byte[] blob;
            try {
                blob = serialize(body);
            } catch (Exception exception) {
                throw new PersistenceException(
                        "Failed to serialize message body, JMSMessageID="
                        + messageId, exception);
            }
            insert.setObject(12, blob);

            insert.executeUpdate();
           
            // insert header properties
            Enumeration iterator = message.getPropertyNames();
            while (iterator.hasMoreElements()) {
                String name = (String) iterator.nextElement();
                Object value = message.getObjectProperty(name);
                addProperty(messageId, name, value);
            }
            _connection.commit();
        } catch (SQLException exception) {
            throw new PersistenceException(
                    "Failed to add message, JMSMessageID=" + messageId,
                    exception);
        } finally {
            SQLHelper.close(insert);
        }
View Full Code Here

                    value = deserialize(blob);
                } catch (Exception exception) {
                    String message = "Failed to destream property for "
                            + "message, JMSMessageID=" + messageId
                            + ", property=" + name;
                    throw new PersistenceException(message, exception);
                }
                result.put(name, value);
            }
        } catch (SQLException exception) {
            throw new PersistenceException(
                    "Failed to get properties for message, JMSMessageID="
                    + messageId, exception);
        } finally {
            SQLHelper.close(set);
            SQLHelper.close(select);
View Full Code Here

            String message = "Failed to serialize property for message, "
                    + "JMSMessageID=" + messageId + ", name=" + name;
            if (value != null) {
                message += " of type " + value.getClass().getName();
            }
            throw new PersistenceException(message, exception);
        }

        PreparedStatement insert = null;
        try {
            insert = _connection.prepareStatement(
                    "insert into " + MESSAGE_PROPERTIES_TABLE
                    + " values (?, ?, ?)");
            insert.setString(1, messageId);
            insert.setString(2, name);
            insert.setObject(3, blob);
            insert.executeUpdate();
        } catch (SQLException exception) {
            throw new PersistenceException(
                    "Failed to add property for message, JMSMessageID="
                    + messageId + ", name=" + name + ", value=" + value,
                    exception);
        } finally {
            SQLHelper.close(insert);
View Full Code Here

            insert.setString(2, value);
            insert.execute();

            _properties.put(name, value);
        } catch (SQLException exception) {
            throw new PersistenceException(
                    "Failed to insert property, name=" + name
                    + ", value=" + value, exception);
        } finally {
            SQLHelper.close(insert);
        }
View Full Code Here

                String name = set.getString(1);
                String value = set.getString(2);
                _properties.put(name, value);
            }
        } catch (SQLException exception) {
            throw new PersistenceException("Failed to load properties",
                                           exception);
        } finally {
            SQLHelper.close(set);
            SQLHelper.close(select);
        }
View Full Code Here

                        + ", name=" + name + ", precision=" + precision
                        + ", create params=" + createParams);
                }
            }
        } catch (SQLException exception) {
            throw new PersistenceException(
                "Failed to get type meta-data", exception);
        } finally {
            SQLHelper.close(set);
        }
    }
View Full Code Here

    public DBTool(String path) throws PersistenceException {
        Configuration config;
        try {
            config = ConfigurationReader.read(path);
        } catch (Exception exception) {
            throw new PersistenceException(exception.getMessage());
        }
        DOMConfigurator.configure(config.getLoggerConfiguration().getFile());
        init(config);
    }
View Full Code Here

TOP

Related Classes of org.exolab.jms.persistence.PersistenceException

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.