1 7 package com.inversoft.verge.repository.config; 8 9 10 import java.util.Properties ; 11 12 import javax.servlet.http.HttpServletRequest ; 13 import javax.servlet.jsp.PageContext ; 14 15 import org.apache.log4j.Logger; 16 17 import com.inversoft.beans.BeanException; 18 import com.inversoft.beans.JavaBean; 19 import com.inversoft.verge.util.WebBean; 20 21 22 33 public class ItemConfig extends WebBean implements Config { 34 35 36 private final static Logger logger = Logger.getLogger(ItemConfig.class); 37 38 private Properties props; 39 private Properties references; 40 41 42 47 public ItemConfig(String id, int scope, Class beanClass) throws BeanException { 48 super(id, scope, beanClass); 49 props = new Properties (); 50 references = new Properties (); 51 } 52 53 58 public ItemConfig(String id, int scope, String className) throws BeanException { 59 super(id, scope, className); 60 props = new Properties (); 61 references = new Properties (); 62 } 63 64 65 70 public Properties getProperties() { 71 return props; 72 } 73 74 83 protected void addProperty(String name, String value) throws BeanException { 84 85 if (logger.isDebugEnabled()) { 86 logger.debug("Adding initial property named: " + name + 87 " with value of: " + value); 88 } 89 90 getBeanProperty(name); props.setProperty(name, value); 92 } 93 94 97 public Properties getReferences() { 98 return references; 99 } 100 101 110 protected void addReference(String name, String value) throws BeanException { 111 getBeanProperty(name); references.setProperty(name, value); 113 } 114 115 122 public boolean hasProperty(String name) { 123 return props.containsKey(name); 124 } 125 126 133 public boolean hasReference(String name) { 134 return references.containsKey(name); 135 } 136 137 140 public Object getInstance(PageContext pageContext, HttpServletRequest request) { 141 throw new UnsupportedOperationException ("Not supported on configuration object"); 142 } 143 144 147 public JavaBean getJavaBean() { 148 return this; 149 } 150 } 151 | Popular Tags |