1 31 32 package org.opencms.configuration; 33 34 import org.opencms.file.types.CmsResourceTypeUnknown; 35 import org.opencms.file.types.I_CmsResourceType; 36 import org.opencms.main.CmsLog; 37 38 import org.apache.commons.digester.AbstractObjectCreationFactory; 39 import org.apache.commons.digester.ObjectCreationFactory; 40 import org.apache.commons.logging.Log; 41 42 import org.xml.sax.Attributes ; 43 44 58 public class CmsDigesterResourceTypeCreationFactory extends AbstractObjectCreationFactory 59 implements ObjectCreationFactory { 60 61 62 private static final Log LOG = CmsLog.getLog(CmsDigesterResourceTypeCreationFactory.class); 63 64 67 public CmsDigesterResourceTypeCreationFactory() { 68 69 super(); 70 } 71 72 75 public Object createObject(Attributes attributes) throws Exception { 76 77 String className = attributes.getValue(I_CmsXmlConfiguration.A_CLASS); 79 I_CmsResourceType type; 81 try { 82 if (className != null) { 83 className = className.trim(); 84 } 85 type = (I_CmsResourceType)Class.forName(className).newInstance(); 86 } catch (Exception e) { 87 type = new CmsResourceTypeUnknown(); 89 LOG.error(Messages.get().getBundle().key( 91 Messages.ERR_UNKNOWN_RESTYPE_CLASS_2, 92 className, 93 type.getClass().getName()), e); 94 } 95 return type; 96 } 97 } | Popular Tags |