/** 
 * 
 * Copyright 2004 Protique Ltd
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 * 
 **/
package org.codehaus.activemq.store.vm;

import EDU.oswego.cs.dl.util.concurrent.ConcurrentHashMap;
import org.codehaus.activemq.message.ActiveMQXid;
import org.codehaus.activemq.service.Transaction;
import org.codehaus.activemq.service.TransactionManager;
import org.codehaus.activemq.store.PreparedTransactionStore;

import javax.jms.JMSException;
import java.util.ArrayList;
import java.util.Map;

/**
 * @version $Revision: 1.1 $
 */
public class VMPreparedTransactionStoreImpl implements PreparedTransactionStore {
    private Map prepared = new ConcurrentHashMap();

    public ActiveMQXid[] getXids() {
        ArrayList list = new ArrayList(prepared.keySet());
        ActiveMQXid answer[] = new ActiveMQXid[list.size()];
        list.toArray(answer);
        return answer;
    }

    public void remove(ActiveMQXid xid) {
        prepared.remove(xid);
    }

    public void put(ActiveMQXid xid, Transaction transaction) {
        prepared.put(xid, transaction);
    }

    public void loadPreparedTransactions(TransactionManager transactionManager) {
    }

    public void start() throws JMSException {
    }

    public void stop() throws JMSException {
    }
}
