01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * 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 and
15: * limitations under the License.
16: */package org.apache.geronimo.timer.jdbc;
17:
18: import java.sql.SQLException;
19: import java.util.concurrent.Executor;
20:
21: import javax.resource.ResourceException;
22: import javax.sql.DataSource;
23: import javax.transaction.TransactionManager;
24:
25: import org.apache.geronimo.gbean.GBeanInfo;
26: import org.apache.geronimo.gbean.GBeanInfoBuilder;
27: import org.apache.geronimo.naming.ResourceSource;
28: import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
29: import org.apache.geronimo.kernel.Kernel;
30: import org.apache.geronimo.timer.NontransactionalExecutorTaskFactory;
31: import org.apache.geronimo.timer.PersistentTimer;
32: import org.apache.geronimo.timer.ThreadPooledTimer;
33:
34: /**
35: * @version $Rev: 607943 $ $Date: 2008-01-01 15:07:17 -0800 (Tue, 01 Jan 2008) $
36: */
37: public class JDBCStoreThreadPooledNonTransactionalTimer extends
38: ThreadPooledTimer {
39:
40: public JDBCStoreThreadPooledNonTransactionalTimer(
41: ResourceSource<ResourceException> managedConnectionFactoryWrapper,
42: TransactionManager transactionManager, Executor threadPool,
43: Kernel kernel) throws SQLException, ResourceException {
44: super (new NontransactionalExecutorTaskFactory(),
45: new JDBCWorkerPersistence(kernel.getKernelName(),
46: (DataSource) managedConnectionFactoryWrapper
47: .$getResource(), false), threadPool,
48: transactionManager);
49: }
50:
51: public static final GBeanInfo GBEAN_INFO;
52:
53: static {
54: GBeanInfoBuilder infoFactory = GBeanInfoBuilder
55: .createStatic(JDBCStoreThreadPooledNonTransactionalTimer.class);
56: infoFactory.addInterface(PersistentTimer.class);
57:
58: infoFactory.addReference("ManagedConnectionFactoryWrapper",
59: ResourceSource.class,
60: NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
61: infoFactory.addReference("ThreadPool", Executor.class,
62: NameFactory.GERONIMO_SERVICE);
63: infoFactory.addReference("TransactionManager",
64: TransactionManager.class, NameFactory.JTA_RESOURCE);
65:
66: infoFactory.addAttribute("kernel", Kernel.class, false);
67:
68: infoFactory.setConstructor(new String[] {
69: "ManagedConnectionFactoryWrapper",
70: "TransactionManager", "ThreadPool", "kernel" });
71: GBEAN_INFO = infoFactory.getBeanInfo();
72: }
73:
74: public static GBeanInfo getGBeanInfo() {
75: return GBEAN_INFO;
76: }
77: }
|