1 16 17 package org.apache.catalina.storeconfig; 18 19 import java.io.PrintWriter ; 20 21 import org.apache.catalina.Loader; 22 import org.apache.catalina.loader.WebappLoader; 23 import org.apache.commons.logging.Log; 24 import org.apache.commons.logging.LogFactory; 25 26 31 public class LoaderSF extends StoreFactoryBase { 32 33 private static Log log = LogFactory.getLog(LoaderSF.class); 34 35 41 public void store(PrintWriter aWriter, int indent, Object aElement) 42 throws Exception { 43 StoreDescription elementDesc = getRegistry().findDescription( 44 aElement.getClass()); 45 if (elementDesc != null) { 46 Loader loader = (Loader) aElement; 47 if (!isDefaultLoader(loader)) { 48 if (log.isDebugEnabled()) 49 log.debug("store " + elementDesc.getTag() + "( " + aElement 50 + " )"); 51 getStoreAppender().printIndent(aWriter, indent + 2); 52 getStoreAppender().printTag(aWriter, indent + 2, loader, 53 elementDesc); 54 } 55 } else { 56 if (log.isWarnEnabled()) { 57 log 58 .warn("Descriptor for element" 59 + aElement.getClass() 60 + " not configured or element class not StandardManager!"); 61 } 62 } 63 } 64 65 72 protected boolean isDefaultLoader(Loader loader) { 73 74 if (!(loader instanceof WebappLoader)) { 75 return (false); 76 } 77 WebappLoader wloader = (WebappLoader) loader; 78 if ((wloader.getDelegate() != false) 79 || !wloader.getLoaderClass().equals( 80 "org.apache.catalina.loader.WebappClassLoader")) { 81 return (false); 82 } 83 return (true); 84 } 85 } | Popular Tags |