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.PersistentTimer;
31: import org.apache.geronimo.timer.ThreadPooledTimer;
32: import org.apache.geronimo.timer.TransactionalExecutorTaskFactory;
33:
34: /**
35: *
36: *
37: * @version $Rev: 607943 $ $Date: 2008-01-01 15:07:17 -0800 (Tue, 01 Jan 2008) $
38: *
39: */
40: public class JDBCStoreThreadPooledTransactionalTimer extends
41: ThreadPooledTimer {
42:
43: public JDBCStoreThreadPooledTransactionalTimer(
44: int repeatCount,
45: TransactionManager transactionManager,
46: ResourceSource<ResourceException> managedConnectionFactoryWrapper,
47: Executor threadPool, Kernel kernel) throws SQLException,
48: ResourceException {
49: super (new TransactionalExecutorTaskFactory(transactionManager,
50: repeatCount), new JDBCWorkerPersistence(kernel
51: .getKernelName(),
52: (DataSource) managedConnectionFactoryWrapper
53: .$getResource(), false), threadPool,
54: transactionManager);
55: }
56:
57: public static final GBeanInfo GBEAN_INFO;
58:
59: static {
60: GBeanInfoBuilder infoFactory = GBeanInfoBuilder
61: .createStatic(JDBCStoreThreadPooledTransactionalTimer.class);
62: infoFactory.addInterface(PersistentTimer.class);
63:
64: infoFactory.addAttribute("repeatCount", int.class, true);
65: infoFactory.addReference("TransactionManager",
66: TransactionManager.class, NameFactory.JTA_RESOURCE);
67: infoFactory.addReference("ManagedConnectionFactoryWrapper",
68: ResourceSource.class,
69: NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
70: infoFactory.addReference("ThreadPool", Executor.class,
71: NameFactory.GERONIMO_SERVICE);
72: infoFactory.addAttribute("kernel", Kernel.class, false);
73:
74: infoFactory.setConstructor(new String[] { "repeatCount",
75: "TransactionManager",
76: "ManagedConnectionFactoryWrapper", "ThreadPool",
77: "kernel" });
78: GBEAN_INFO = infoFactory.getBeanInfo();
79: }
80:
81: public static GBeanInfo getGBeanInfo() {
82: return GBEAN_INFO;
83: }
84: }
|