Package org.exolab.jms.persistence

Examples of org.exolab.jms.persistence.PersistenceAdapter


                } else {
                    Configuration config = ConfigurationReader.read(configPath);
                    DatabaseService dbService = new DatabaseService(config);
                    dbService.start();

                    PersistenceAdapter adapter = dbService.getAdapter();
                    connection = adapter.getConnection();
                }
                IDatabaseConnection dbConnection
                        = new DatabaseConnection(connection);
                IDataSet fullDataSet = dbConnection.createDataSet();
                FlatXmlDataSet.write(fullDataSet,
View Full Code Here


            throws JMSException, PersistenceException {

        String name = consumer.getName();
        JmsDestination destination = subscription.getDestination();
        Iterator iterator = subscription.getMessages().iterator();
        PersistenceAdapter adapter = _database.getAdapter();
        Connection connection = _database.getConnection();

        if (!consumer.isQueueConsumer()) {
            adapter.addDurableConsumer(connection, destination.getName(), name);

        }

        while (iterator.hasNext()) {
            MessageState state = (MessageState) iterator.next();
            MessageImpl message = adapter.getMessage(connection,
                                                     state.getMessageId());
            PersistentMessageHandle handle =
                    new PersistentMessageHandle(message.getJMSMessageID(),
                                                message.getJMSPriority(),
                                                message.getAcceptedTime(),
View Full Code Here

            // database and cache it.
            if (message == null) {
                // fault in at least the next message from the database
                try {
                    DatabaseService service = DatabaseService.getInstance();
                    PersistenceAdapter adapter = service.getAdapter();
                    Connection connection = service.getConnection();
                    message = adapter.getMessage(connection, messageId);
                } catch (PersistenceException exception) {
                    final String msg = "Failed to retrieve message";
                    _log.error(msg, exception);
                    throw new JMSException(msg + ": " + exception.getMessage());
                }
View Full Code Here

        if (_references.remove(messageId) != null) {
            if (reference.isPersistent()) {
                try {
                    DatabaseService service = DatabaseService.getInstance();
                    Connection connection = service.getConnection();
                    PersistenceAdapter adapter = service.getAdapter();
                    adapter.removeMessage(connection, messageId);
                } catch (Exception exception) {
                    _log.error("Failed to remove message", exception);
                    throw new JMSException("Failed to remove message: "
                            + exception.getMessage());
                }
View Full Code Here

     * @return <code>true</code> if the user is created otherwise
     *         <code>false</code>
     */
    public synchronized boolean createUser(User user) {
        boolean success = false;
        PersistenceAdapter adapter = _database.getAdapter();

        if (_userCache.get(user.getUsername()) == null) {
            try {
                _database.begin();
                Connection connection = _database.getConnection();
                adapter.addUser(connection, user);
                addToUserCache(user);
                _database.commit();
                success = true;
            } catch (Exception exception) {
                _log.error("Failed to create user", exception);
View Full Code Here

     * @return <code>true</code> if password is updated otherwise
     *         <code>false</code>
     */
    public synchronized boolean updateUser(User user) {
        boolean success = false;
        PersistenceAdapter adapter = _database.getAdapter();

        if (_userCache.get(user.getUsername()) != null) {
            try {
                _database.begin();
                Connection connection = _database.getConnection();
                adapter.updateUser(connection, user);
                _database.commit();
                addToUserCache(user);
                success = true;
            } catch (Exception exception) {
                _log.error("Failed to update user", exception);
View Full Code Here

     * @param user the userobject containing the username
     * @return <code>true</code> if the is removed otherwise <code>false</code>
     */
    public synchronized boolean deleteUser(User user) {
        boolean success = false;
        PersistenceAdapter adapter = _database.getAdapter();

        if (_userCache.get(user.getUsername()) != null) {
            try {
                _database.begin();
                Connection connection = _database.getConnection();
                adapter.removeUser(connection, user);
                removeFromUserCache(user);
                success = true;
                _database.commit();
            } catch (Exception exception) {
                _log.error("Failed to remove user", exception);
View Full Code Here

    protected void doStart() throws ServiceException {
        try {
            _database.begin();
            Connection connection = _database.getConnection();

            PersistenceAdapter adapter = _database.getAdapter();

            // return a list of JmsDestination objects.
            HashMap map = adapter.getAllDurableConsumers(connection);
            Iterator iter = map.keySet().iterator();

            // Create an endpoint for each durable consumer
            while (iter.hasNext()) {
                String consumer = (String) iter.next();
View Full Code Here

            _log.debug("createPersistentDestination(destination="
                       + destination + ")");
        }

        boolean queue = (destination instanceof JmsQueue) ? true : false;
        PersistenceAdapter adapter = _database.getAdapter();

        // check that the destination does not exist. If it exists then return
        // false. If it doesn't exists the create it and bind it to the jndi
        // context

        try {
            _database.begin();
            Connection connection = _database.getConnection();
            adapter.addDestination(connection, destination.getName(), queue);
            _database.commit();
        } catch (Exception exception) { // JMSException, PersistenceException
            cleanup("Failed to create persistent destination "
                    + destination.getName(), exception);
        }
View Full Code Here

            }
        }
        if (endpoint == null) {
            try {
                _database.begin();
                PersistenceAdapter adapter = _database.getAdapter();
                Connection connection = _database.getConnection();
                adapter.addDurableConsumer(connection, topic.getName(), name);
                endpoint = addDurableConsumer(topic, name, clientID);
                _database.commit();
            } catch (Exception exception) {
                String msg = "Failed to create durable consumer, name=" + name
                        + ", for topic=" + topic.getName();
View Full Code Here

TOP

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

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.