KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > catalina > storeconfig > ConnectorSF


1 /**
2  * Copyright 1999-2001,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.catalina.storeconfig;
18
19 import java.io.PrintWriter JavaDoc;
20
21 import org.apache.catalina.Lifecycle;
22 import org.apache.catalina.LifecycleListener;
23 import org.apache.catalina.connector.Connector;
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26
27 /**
28  * Store Connector and Listeners
29  *
30  * @author Peter Rossbach
31  */

32 public class ConnectorSF extends StoreFactoryBase {
33
34     private static Log log = LogFactory.getLog(ConnectorSF.class);
35
36     /**
37      * Store Connector description
38      *
39      * @param aWriter
40      * @param indent
41      * @param aConnector
42      * @throws Exception
43      */

44     public void storeChilds(PrintWriter JavaDoc aWriter, int indent, Object JavaDoc aConnector,
45             StoreDescription parentDesc) throws Exception JavaDoc {
46
47         if (aConnector instanceof Connector) {
48             Connector connector = (Connector) aConnector;
49             // Store nested <Listener> elements
50
if (connector instanceof Lifecycle) {
51                 LifecycleListener listeners[] = ((Lifecycle) connector)
52                         .findLifecycleListeners();
53                 storeElementArray(aWriter, indent, listeners);
54             }
55         }
56     }
57
58     protected void printOpenTag(PrintWriter JavaDoc aWriter, int indent, Object JavaDoc bean,
59             StoreDescription aDesc) throws Exception JavaDoc {
60         aWriter.print("<");
61         aWriter.print(aDesc.getTag());
62         storeConnectorAttribtues(aWriter, indent, bean, aDesc);
63         aWriter.println(">");
64     }
65
66     protected void storeConnectorAttribtues(PrintWriter JavaDoc aWriter, int indent,
67             Object JavaDoc bean, StoreDescription aDesc) throws Exception JavaDoc {
68         if (aDesc.isAttributes()) {
69             getStoreAppender().printAttributes(aWriter, indent, false, bean,
70                     aDesc);
71             /*
72              * if (bean instanceof Connector) { StoreDescription elementDesc =
73              * getRegistry().findDescription( bean.getClass().getName() +
74              * ".[ProtocolHandler]"); if (elementDesc != null) { ProtocolHandler
75              * protocolHandler = ((Connector) bean) .getProtocolHandler(); if
76              * (protocolHandler != null)
77              * getStoreAppender().printAttributes(aWriter, indent, false,
78              * protocolHandler, elementDesc); } }
79              */

80         }
81     }
82
83     protected void printTag(PrintWriter JavaDoc aWriter, int indent, Object JavaDoc bean,
84             StoreDescription aDesc) throws Exception JavaDoc {
85         aWriter.print("<");
86         aWriter.print(aDesc.getTag());
87         storeConnectorAttribtues(aWriter, indent, bean, aDesc);
88         aWriter.println("/>");
89     }
90
91 }
Popular Tags