KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > tigris > scarab > components > TorqueComponent


1 package org.tigris.scarab.components;
2
3 import org.apache.avalon.framework.configuration.Configuration;
4 import org.apache.avalon.framework.configuration.ConfigurationException;
5 import org.apache.torque.Torque;
6 import org.apache.torque.TorqueInstance;
7 import org.apache.turbine.Turbine;
8
9
10 /* ================================================================
11  * Copyright (c) 2000-2003 CollabNet. All rights reserved.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions are
15  * met:
16  *
17  * 1. Redistributions of source code must retain the above copyright
18  * notice, this list of conditions and the following disclaimer.
19  *
20  * 2. Redistributions in binary form must reproduce the above copyright
21  * notice, this list of conditions and the following disclaimer in the
22  * documentation and/or other materials provided with the distribution.
23  *
24  * 3. The end-user documentation included with the redistribution, if
25  * any, must include the following acknowlegement: "This product includes
26  * software developed by Collab.Net <http://www.Collab.Net/>."
27  * Alternately, this acknowlegement may appear in the software itself, if
28  * and wherever such third-party acknowlegements normally appear.
29  *
30  * 4. The hosted project names must not be used to endorse or promote
31  * products derived from this software without prior written
32  * permission. For written permission, please contact info@collab.net.
33  *
34  * 5. Products derived from this software may not use the "Tigris" or
35  * "Scarab" names nor may "Tigris" or "Scarab" appear in their names without
36  * prior written permission of Collab.Net.
37  *
38  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
39  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
40  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
41  * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
42  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
44  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
45  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
46  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
47  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
48  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49  *
50  * ====================================================================
51  *
52  * This software consists of voluntary contributions made by many
53  * individuals on behalf of Collab.Net.
54  */

55
56 /**
57  * Avalon component for Torque adjusted to the needs of Scarab.
58  *
59  * @author <a HREF="mailto:dabbous@saxess.com">Hussayn dabbous</a>
60  * @version $Id: TorqueComponent.java 9298 2004-12-03 21:58:46Z dabbous $
61  */

62 public class TorqueComponent
63         extends org.apache.torque.avalon.TorqueComponent
64 {
65     public TorqueComponent()
66     {
67         super();
68     }
69
70     /**
71      * Creates a new instance.
72      *
73      * @param torqueInstance The instance of the Torque core used by
74      * this component.
75      */

76     protected TorqueComponent(TorqueInstance torqueInstance)
77     {
78         super(torqueInstance);
79     }
80
81     /**
82      * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
83      */

84     public void configure(Configuration configuration)
85             throws ConfigurationException
86     {
87         // we retrieve the configuration from Turbine runtime @see #initialize()
88
getLogger().debug("configure(" + configuration + ")");
89     }
90     /**
91      * @see org.apache.avalon.framework.activity.Initializable#initialize()
92      */

93     public void initialize()
94             throws Exception JavaDoc
95     {
96         getLogger().debug("initialize()");
97         //return the configuration object with the torque values only.
98
org.apache.commons.configuration.Configuration c = Turbine.getConfiguration();
99         Torque.getInstance().init(c);
100     }
101
102 }
103
Popular Tags