1 /**2 *3 * Copyright 2003-2004 The Apache Software Foundation4 *5 * Licensed under the Apache License, Version 2.0 (the "License");6 * you may not use this file except in compliance with the License.7 * You may obtain a copy of the License at8 *9 * http://www.apache.org/licenses/LICENSE-2.010 *11 * Unless required by applicable law or agreed to in writing, software12 * distributed under the License is distributed on an "AS IS" BASIS,13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14 * See the License for the specific language governing permissions and15 * limitations under the License.16 */17 18 package org.apache.geronimo.connector;19 20 import java.util.Timer ;21 22 import javax.resource.spi.UnavailableException ;23 import javax.resource.spi.XATerminator ;24 import javax.resource.spi.work.WorkManager ;25 26 import org.apache.geronimo.connector.work.GeronimoWorkManager;27 28 /**29 * GBean BootstrapContext implementation that refers to externally configured WorkManager30 * and XATerminator gbeans.31 *32 * @version $Rev: 56022 $ $Date: 2004-10-29 22:16:18 -0700 (Fri, 29 Oct 2004) $33 */34 public class BootstrapContextImpl implements javax.resource.spi.BootstrapContext {35 private final GeronimoWorkManager workManager;36 37 /**38 * Normal constructor for use as a GBean.39 * @param workManager40 */41 public BootstrapContextImpl(final GeronimoWorkManager workManager) {42 this.workManager = workManager;43 }44 45 46 /**47 * @see javax.resource.spi.BootstrapContext#getWorkManager()48 */49 public WorkManager getWorkManager() {50 return workManager;51 }52 53 /**54 * @see javax.resource.spi.BootstrapContext#getXATerminator()55 */56 public XATerminator getXATerminator() {57 return workManager.getXATerminator();58 }59 60 /**61 * @see javax.resource.spi.BootstrapContext#createTimer()62 */63 public Timer createTimer() throws UnavailableException {64 return new Timer ();65 }66 67 // public static final GBeanInfo GBEAN_INFO;68 //69 // static {70 // GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(BootstrapContext.class);71 // //adding interface does not work, creates attributes for references???72 //// infoFactory.addInterface(javax.resource.spi.BootstrapContext.class);73 //74 // infoFactory.addOperation("createTimer");75 // infoFactory.addOperation("getWorkManager");76 // infoFactory.addOperation("getXATerminator");77 //78 // infoFactory.addReference("WorkManager", WorkManager.class);79 // infoFactory.addReference("XATerminator", XATerminator.class);80 //81 // infoFactory.setConstructor(new String[]{"WorkManager", "XATerminator"});82 //83 // GBEAN_INFO = infoFactory.getBeanInfo();84 // }85 //86 // public static GBeanInfo getGBeanInfo() {87 // return GBEAN_INFO;88 // }89 90 }91