001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  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    
021    import javax.resource.spi.UnavailableException;
022    import javax.resource.spi.XATerminator;
023    import javax.resource.spi.work.WorkManager;
024    
025    /**
026     * GBean BootstrapContext implementation that refers to externally configured WorkManager
027     * and XATerminator gbeans.
028     *
029     * @version $Rev: 550546 $ $Date: 2007-06-25 12:52:11 -0400 (Mon, 25 Jun 2007) $
030     */
031    public class GeronimoBootstrapContext implements javax.resource.spi.BootstrapContext {
032        private final WorkManager workManager;
033        private final XATerminator xATerminator;
034    
035        /**
036         * Default constructor for use as a GBean Endpoint.
037         */
038        public GeronimoBootstrapContext() {
039            workManager = null;
040            xATerminator = null;
041        }
042    
043        /**
044         * Normal constructor for use as a GBean.
045         * @param workManager
046         * @param xaTerminator
047         */
048        public GeronimoBootstrapContext(WorkManager workManager, XATerminator xaTerminator) {
049            this.workManager = workManager;
050            this.xATerminator = xaTerminator;
051        }
052    
053    
054        /**
055         * @see javax.resource.spi.BootstrapContext#getWorkManager()
056         */
057        public WorkManager getWorkManager() {
058            return workManager;
059        }
060    
061        /**
062         * @see javax.resource.spi.BootstrapContext#getXATerminator()
063         */
064        public XATerminator getXATerminator() {
065            return xATerminator;
066        }
067    
068        /**
069         * @see javax.resource.spi.BootstrapContext#createTimer()
070         */
071        public Timer createTimer() throws UnavailableException {
072            return new Timer();
073        }
074    
075    }