1 16 17 package org.apache.catalina.storeconfig; 18 19 import java.io.PrintWriter ; 20 21 import org.apache.catalina.Lifecycle; 22 import org.apache.catalina.LifecycleListener; 23 import org.apache.catalina.Service; 24 import org.apache.catalina.core.StandardServer; 25 import org.apache.catalina.deploy.NamingResources; 26 import org.apache.catalina.mbeans.ServerLifecycleListener; 27 import org.apache.commons.logging.Log; 28 import org.apache.commons.logging.LogFactory; 29 30 36 public class StandardServerSF extends StoreFactoryBase { 37 38 private static Log log = LogFactory.getLog(StandardServerSF.class); 39 40 55 public void store(PrintWriter aWriter, int indent, Object aServer) 56 throws Exception { 57 storeXMLHead(aWriter); 58 super.store(aWriter, indent, aServer); 59 } 60 61 69 public void storeChilds(PrintWriter aWriter, int indent, Object aObject, 70 StoreDescription parentDesc) throws Exception { 71 if (aObject instanceof StandardServer) { 72 StandardServer server = (StandardServer) aObject; 73 if (server instanceof Lifecycle) { 75 LifecycleListener listeners[] = ((Lifecycle) server) 76 .findLifecycleListeners(); 77 storeElementArray(aWriter, indent, listeners); 78 LifecycleListener listener = null; 79 for (int i = 0; listener == null && i < listeners.length; i++) 80 if (listeners[i] instanceof ServerLifecycleListener) 81 listener = listeners[i]; 82 if (listener != null) { 83 StoreDescription elementDesc = getRegistry() 84 .findDescription( 85 StandardServer.class.getName() 86 + ".[ServerLifecycleListener]"); 87 if (elementDesc != null) { 88 elementDesc.getStoreFactory().store(aWriter, indent, 89 listener); 90 } 91 } 92 } 93 NamingResources globalNamingResources = server 95 .getGlobalNamingResources(); 96 StoreDescription elementDesc = getRegistry().findDescription( 97 NamingResources.class.getName() 98 + ".[GlobalNamingResources]"); 99 if (elementDesc != null) { 100 elementDesc.getStoreFactory().store(aWriter, indent, 101 globalNamingResources); 102 } 103 Service services[] = server.findServices(); 105 storeElementArray(aWriter, indent, services); 106 } 107 } 108 109 } | Popular Tags |