1 16 package org.apache.catalina.storeconfig; 17 18 import java.io.PrintWriter ; 19 20 import org.apache.catalina.deploy.ContextEjb; 21 import org.apache.catalina.deploy.ContextEnvironment; 22 import org.apache.catalina.deploy.ContextLocalEjb; 23 import org.apache.catalina.deploy.ContextResource; 24 import org.apache.catalina.deploy.ContextResourceEnvRef; 25 import org.apache.catalina.deploy.ContextResourceLink; 26 import org.apache.catalina.deploy.NamingResources; 27 import org.apache.commons.logging.Log; 28 import org.apache.commons.logging.LogFactory; 29 30 36 public class NamingResourcesSF extends StoreFactoryBase { 37 private static Log log = LogFactory.getLog(NamingResourcesSF.class); 38 39 45 public void store(PrintWriter aWriter, int indent, Object aElement) 46 throws Exception { 47 StoreDescription elementDesc = getRegistry().findDescription( 48 aElement.getClass()); 49 if (elementDesc != null) { 50 if (log.isDebugEnabled()) 51 log.debug("store " + elementDesc.getTag() + "( " + aElement 52 + " )"); 53 storeChilds(aWriter, indent, aElement, elementDesc); 54 } else { 55 if (log.isWarnEnabled()) 56 log.warn("Descriptor for element" + aElement.getClass() 57 + " not configured!"); 58 } 59 } 60 61 80 public void storeChilds(PrintWriter aWriter, int indent, Object aElement, 81 StoreDescription elementDesc) throws Exception { 82 83 if (aElement instanceof NamingResources) { 84 NamingResources resources = (NamingResources) aElement; 85 ContextEjb[] ejbs = resources.findEjbs(); 87 storeElementArray(aWriter, indent, ejbs); 88 ContextEnvironment[] envs = resources.findEnvironments(); 90 storeElementArray(aWriter, indent, envs); 91 ContextLocalEjb[] lejbs = resources.findLocalEjbs(); 93 storeElementArray(aWriter, indent, lejbs); 94 95 ContextResource[] dresources = resources.findResources(); 97 storeElementArray(aWriter, indent, dresources); 98 99 ContextResourceEnvRef[] resEnv = resources.findResourceEnvRefs(); 101 storeElementArray(aWriter, indent, resEnv); 102 103 ContextResourceLink[] resourceLinks = resources.findResourceLinks(); 105 storeElementArray(aWriter, indent, resourceLinks); 106 } 107 } 108 } 109 110 | Popular Tags |