001    /**
002     *
003     * Copyright 2006 The Apache Software Foundation
004     *
005     *  Licensed under the Apache License, Version 2.0 (the "License");
006     *  you may not use this file except in compliance with the License.
007     *  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    package org.apache.geronimo.connector;
018    
019    import java.util.Timer;
020    import javax.resource.spi.work.WorkManager;
021    import javax.resource.spi.XATerminator;
022    import javax.resource.spi.UnavailableException;
023    
024    /**
025     * GBean BootstrapContext implementation that refers to externally configured WorkManager
026     * and XATerminator gbeans.
027     *
028     * @version $Rev: 437254 $ $Date: 2006-08-26 17:07:55 -0700 (Sat, 26 Aug 2006) $
029     */
030    public class GeronimoBootstrapContext implements javax.resource.spi.BootstrapContext {
031        private final WorkManager workManager;
032        private final XATerminator xATerminator;
033    
034        /**
035         * Default constructor for use as a GBean Endpoint.
036         */
037        public GeronimoBootstrapContext() {
038            workManager = null;
039            xATerminator = null;
040        }
041    
042        /**
043         * Normal constructor for use as a GBean.
044         * @param workManager
045         * @param xaTerminator
046         */
047        public GeronimoBootstrapContext(WorkManager workManager, XATerminator xaTerminator) {
048            this.workManager = workManager;
049            this.xATerminator = xaTerminator;
050        }
051    
052    
053        /**
054         * @see javax.resource.spi.BootstrapContext#getWorkManager()
055         */
056        public WorkManager getWorkManager() {
057            return workManager;
058        }
059    
060        /**
061         * @see javax.resource.spi.BootstrapContext#getXATerminator()
062         */
063        public XATerminator getXATerminator() {
064            return xATerminator;
065        }
066    
067        /**
068         * @see javax.resource.spi.BootstrapContext#createTimer()
069         */
070        public Timer createTimer() throws UnavailableException {
071            return new Timer();
072        }
073    
074    }