001: package org.tigris.scarab.components;
002:
003: import org.apache.avalon.framework.configuration.Configuration;
004: import org.apache.avalon.framework.configuration.ConfigurationException;
005: import org.apache.torque.Torque;
006: import org.apache.torque.TorqueInstance;
007: import org.apache.turbine.Turbine;
008: import org.tigris.scarab.util.ScarabUtil;
009:
010: /* ================================================================
011: * Copyright (c) 2000-2003 CollabNet. All rights reserved.
012: *
013: * Redistribution and use in source and binary forms, with or without
014: * modification, are permitted provided that the following conditions are
015: * met:
016: *
017: * 1. Redistributions of source code must retain the above copyright
018: * notice, this list of conditions and the following disclaimer.
019: *
020: * 2. Redistributions in binary form must reproduce the above copyright
021: * notice, this list of conditions and the following disclaimer in the
022: * documentation and/or other materials provided with the distribution.
023: *
024: * 3. The end-user documentation included with the redistribution, if
025: * any, must include the following acknowlegement: "This product includes
026: * software developed by Collab.Net <http://www.Collab.Net/>."
027: * Alternately, this acknowlegement may appear in the software itself, if
028: * and wherever such third-party acknowlegements normally appear.
029: *
030: * 4. The hosted project names must not be used to endorse or promote
031: * products derived from this software without prior written
032: * permission. For written permission, please contact info@collab.net.
033: *
034: * 5. Products derived from this software may not use the "Tigris" or
035: * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
036: * prior written permission of Collab.Net.
037: *
038: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
039: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
040: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
041: * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
042: * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
043: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
044: * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
045: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
046: * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
047: * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
048: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
049: *
050: * ====================================================================
051: *
052: * This software consists of voluntary contributions made by many
053: * individuals on behalf of Collab.Net.
054: */
055:
056: /**
057: * Avalon component for Torque adjusted to the needs of Scarab.
058: *
059: * @author <a href="mailto:dabbous@saxess.com">Hussayn dabbous</a>
060: * @version $Id: TorqueComponent.java 9925 2005-10-31 12:41:16Z hair $
061: */
062: public class TorqueComponent extends
063: org.apache.torque.avalon.TorqueComponent {
064:
065: static {
066: ScarabUtil.initializeScarab();
067: }
068:
069: public TorqueComponent() {
070: super ();
071: }
072:
073: /**
074: * Creates a new instance.
075: *
076: * @param torqueInstance The instance of the Torque core used by
077: * this component.
078: */
079: protected TorqueComponent(TorqueInstance torqueInstance) {
080: super (torqueInstance);
081: }
082:
083: /**
084: * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
085: */
086: public void configure(Configuration configuration)
087: throws ConfigurationException {
088: // we retrieve the configuration from Turbine runtime @see #initialize()
089: getLogger().debug("configure(" + configuration + ")");
090: }
091:
092: /**
093: * @see org.apache.avalon.framework.activity.Initializable#initialize()
094: */
095: public void initialize() throws Exception {
096: getLogger().debug("initialize()");
097: //return the configuration object with the torque values only.
098: org.apache.commons.configuration.Configuration c = Turbine
099: .getConfiguration();
100: Torque.getInstance().init(c);
101: }
102:
103: }
|