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.transaction.log;
018    
019    import java.io.IOException;
020    
021    import org.apache.geronimo.gbean.GBeanInfo;
022    import org.apache.geronimo.gbean.GBeanInfoBuilder;
023    import org.apache.geronimo.gbean.GBeanLifecycle;
024    import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
025    import org.apache.geronimo.system.serverinfo.ServerInfo;
026    import org.apache.geronimo.transaction.manager.TransactionLog;
027    import org.apache.geronimo.transaction.manager.XidFactory;
028    import org.objectweb.howl.log.LogConfigurationException;
029    
030    /**
031     * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
032     */
033    public class HOWLLogGBean extends HOWLLog implements GBeanLifecycle {
034        public HOWLLogGBean(String bufferClassName, int bufferSize, boolean checksumEnabled, boolean adler32Checksum, int flushSleepTimeMilliseconds, String logFileDir, String logFileExt, String logFileName, int maxBlocksPerFile, int maxBuffers, int maxLogFiles, int minBuffers, int threadsWaitingForceThreshold, XidFactory xidFactory, ServerInfo serverInfo) throws IOException, LogConfigurationException {
035            super(bufferClassName, bufferSize, checksumEnabled, adler32Checksum, flushSleepTimeMilliseconds, logFileDir, logFileExt, logFileName, maxBlocksPerFile, maxBuffers, maxLogFiles, minBuffers, threadsWaitingForceThreshold, xidFactory, serverInfo.resolveServer("."));
036        }
037    
038        public static final GBeanInfo GBEAN_INFO;
039    
040        static {
041            GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(HOWLLogGBean.class, NameFactory.TRANSACTION_LOG);
042            infoFactory.addAttribute("bufferClassName", String.class, true);
043            infoFactory.addAttribute("bufferSizeKBytes", Integer.TYPE, true);
044            infoFactory.addAttribute("checksumEnabled", Boolean.TYPE, true);
045            infoFactory.addAttribute("adler32Checksum", Boolean.TYPE, true);
046            infoFactory.addAttribute("flushSleepTimeMilliseconds", Integer.TYPE, true);
047            infoFactory.addAttribute("logFileDir", String.class, true);
048            infoFactory.addAttribute("logFileExt", String.class, true);
049            infoFactory.addAttribute("logFileName", String.class, true);
050            infoFactory.addAttribute("maxBlocksPerFile", Integer.TYPE, true);
051            infoFactory.addAttribute("maxBuffers", Integer.TYPE, true);
052            infoFactory.addAttribute("maxLogFiles", Integer.TYPE, true);
053            infoFactory.addAttribute("minBuffers", Integer.TYPE, true);
054            infoFactory.addAttribute("threadsWaitingForceThreshold", Integer.TYPE, true);
055    
056            infoFactory.addReference("XidFactory", XidFactory.class, NameFactory.XID_FACTORY);
057            infoFactory.addReference("ServerInfo", ServerInfo.class, NameFactory.GERONIMO_SERVICE);
058    
059            infoFactory.addInterface(TransactionLog.class);
060    
061            infoFactory.setConstructor(new String[]{
062                    "bufferClassName",
063                    "bufferSizeKBytes",
064                    "checksumEnabled",
065                    "adler32ChecksumEnabled",
066                    "flushSleepTimeMilliseconds",
067                    "logFileDir",
068                    "logFileExt",
069                    "logFileName",
070                    "maxBlocksPerFile",
071                    "maxBuffers",
072                    "maxLogFiles",
073                    "minBuffers",
074                    "threadsWaitingForceThreshold",
075                    "XidFactory",
076                    "ServerInfo"});
077            GBEAN_INFO = infoFactory.getBeanInfo();
078        }
079    
080        public static GBeanInfo getGBeanInfo() {
081            return HOWLLogGBean.GBEAN_INFO;
082        }
083    
084    }