Java 类org.apache.log4j.or.RendererMap 实例源码

项目:cacheonix-core    文件:PropertyConfigurator.java   
/**
    Parse non-root elements, such non-root categories and renderers.
 */
 protected
 void parseCatsAndRenderers(Properties props, LoggerRepository hierarchy) {
   Enumeration enumeration = props.propertyNames();
   while(enumeration.hasMoreElements()) {
     String key = (String) enumeration.nextElement();
     if(key.startsWith(CATEGORY_PREFIX) || key.startsWith(LOGGER_PREFIX)) {
String loggerName = null;
if(key.startsWith(CATEGORY_PREFIX)) {
  loggerName = key.substring(CATEGORY_PREFIX.length());
} else if(key.startsWith(LOGGER_PREFIX)) {
  loggerName = key.substring(LOGGER_PREFIX.length());
}
String value =  OptionConverter.findAndSubst(key, props);
Logger logger = hierarchy.getLogger(loggerName, loggerFactory);
synchronized(logger) {
  parseCategory(props, logger, key, loggerName, value);
  parseAdditivityForLogger(props, logger, loggerName);
}
     } else if(key.startsWith(RENDERER_PREFIX)) {
String renderedClass = key.substring(RENDERER_PREFIX.length());
String renderingClass = OptionConverter.findAndSubst(key, props);
if(hierarchy instanceof RendererSupport) {
  RendererMap.addRenderer((RendererSupport) hierarchy, renderedClass,
              renderingClass);
}
     }
   }
 }
项目:cacheonix-core    文件:Hierarchy.java   
/**
   Create a new logger hierarchy.

   @param root The root of the new hierarchy.

 */
public
Hierarchy(Logger root) {
  ht = new Hashtable();
  listeners = new Vector(1);
  this.root = root;
  // Enable all level levels by default.
  setThreshold(Level.ALL);
  this.root.setHierarchy(this);
  rendererMap = new RendererMap();
  defaultFactory = new DefaultCategoryFactory();
}
项目:cacheonix-core    文件:DOMConfigurator.java   
protected 
void parseRenderer(Element element) {
  String renderingClass = subst(element.getAttribute(RENDERING_CLASS_ATTR));
  String renderedClass = subst(element.getAttribute(RENDERED_CLASS_ATTR));
  if(repository instanceof RendererSupport) {
    RendererMap.addRenderer((RendererSupport) repository, renderedClass, 
          renderingClass);
  }
}
项目:cacheonix-core    文件:ORTestCase.java   
public
void test1() {
  RendererMap map = new RendererMap();
  ObjectRenderer dr = map.getDefaultRenderer();
  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, dr);
}
项目:cacheonix-core    文件:ORTestCase.java   
public
void test2() {
  RendererMap map = new RendererMap();
  map.put(Integer.class, ior);
  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, ior);

}
项目:cacheonix-core    文件:ORTestCase.java   
public
void test3() {
  RendererMap map = new RendererMap();
  map.put(Number.class, ior);
  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, ior);
}
项目:cacheonix-core    文件:ORTestCase.java   
public
void test4() {
  RendererMap map = new RendererMap();
  map.put(Object.class, oor);
  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, oor);
}
项目:cacheonix-core    文件:ORTestCase.java   
public
void test5() {
  RendererMap map = new RendererMap();

  map.put(Object.class, oor);
  map.put(Number.class, nor);
  map.put(Integer.class, ior);

  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, ior);
}
项目:cacheonix-core    文件:ORTestCase.java   
public
void test6() {
  RendererMap map = new RendererMap();

  map.put(Object.class, oor);
  map.put(Number.class, nor);

  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, nor);
}
项目:cacheonix-core    文件:ORTestCase.java   
public
void test7() throws Exception {
  RendererMap map = new RendererMap();
  Class comparable = null; 
  try {
      comparable = getClass().forName("java.lang.Comparable");
  } catch(Exception ex) {
      //  likely JDK 1.1
      return;
  }
  map.put(comparable, cor);
  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, cor);
}
项目:cacheonix-core    文件:ORTestCase.java   
public
void test8() {
  RendererMap map = new RendererMap();
  map.put(Serializable.class, sor); 
  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, sor);
}
项目:cacheonix-core    文件:ORTestCase.java   
public
void test9() {
  RendererMap map = new RendererMap();
  map.put(Y.class, yor); 
  ObjectRenderer r = map.get(B.class);
  assertEquals(r, yor);
}
项目:cacheonix-core    文件:ORTestCase.java   
public
void test10() {
  RendererMap map = new RendererMap();
  map.put(X.class, xor); 
  ObjectRenderer r = map.get(B.class);
  assertEquals(r, xor);
}
项目:daq-eclipse    文件:Hierarchy.java   
/**
   Create a new logger hierarchy.

   @param root The root of the new hierarchy.

 */
public
Hierarchy(Logger root) {
  ht = new Hashtable();
  listeners = new Vector(1);
  this.root = root;
  // Enable all level levels by default.
  setThreshold(Level.ALL);
  this.root.setHierarchy(this);
  rendererMap = new RendererMap();
  defaultFactory = new DefaultCategoryFactory();
}
项目:daq-eclipse    文件:DOMConfigurator.java   
protected 
void parseRenderer(Element element) {
  String renderingClass = subst(element.getAttribute(RENDERING_CLASS_ATTR));
  String renderedClass = subst(element.getAttribute(RENDERED_CLASS_ATTR));
  if(repository instanceof RendererSupport) {
    RendererMap.addRenderer((RendererSupport) repository, renderedClass, 
          renderingClass);
  }
}
项目:nabs    文件:PropertyConfigurator.java   
/**
    Parse non-root elements, such non-root categories and renderers.
 */
 protected
 void parseCatsAndRenderers(Properties props, LoggerRepository hierarchy) {
   Enumeration enumeration = props.propertyNames();
   while(enumeration.hasMoreElements()) {
     String key = (String) enumeration.nextElement();
     if(key.startsWith(CATEGORY_PREFIX) || key.startsWith(LOGGER_PREFIX)) {
String loggerName = null;
if(key.startsWith(CATEGORY_PREFIX)) {
  loggerName = key.substring(CATEGORY_PREFIX.length());
} else if(key.startsWith(LOGGER_PREFIX)) {
  loggerName = key.substring(LOGGER_PREFIX.length());
}
String value =  OptionConverter.findAndSubst(key, props);
Logger logger = hierarchy.getLogger(loggerName, loggerFactory);
synchronized(logger) {
  parseCategory(props, logger, key, loggerName, value);
  parseAdditivityForLogger(props, logger, loggerName);
}
     } else if(key.startsWith(RENDERER_PREFIX)) {
String renderedClass = key.substring(RENDERER_PREFIX.length());
String renderingClass = OptionConverter.findAndSubst(key, props);
if(hierarchy instanceof RendererSupport) {
  RendererMap.addRenderer((RendererSupport) hierarchy, renderedClass,
              renderingClass);
}
     }
   }
 }
项目:nabs    文件:Hierarchy.java   
/**
   Create a new logger hierarchy.

   @param root The root of the new hierarchy.

 */
public
Hierarchy(Logger root) {
  ht = new Hashtable();
  listeners = new Vector(1);
  this.root = root;
  // Enable all level levels by default.
  setThreshold(Level.ALL);
  this.root.setHierarchy(this);
  rendererMap = new RendererMap();
  defaultFactory = new DefaultCategoryFactory();
}
项目:nabs    文件:DOMConfigurator.java   
protected 
void parseRenderer(Element element) {
  String renderingClass = subst(element.getAttribute(RENDERING_CLASS_ATTR));
  String renderedClass = subst(element.getAttribute(RENDERED_CLASS_ATTR));
  if(repository instanceof RendererSupport) {
    RendererMap.addRenderer((RendererSupport) repository, renderedClass, 
          renderingClass);
  }
}
项目:cacheonix-core    文件:RendererSupport.java   
public
RendererMap getRendererMap();
项目:cacheonix-core    文件:Hierarchy.java   
/**
   Get the renderer map for this hierarchy.
*/
public
RendererMap getRendererMap() {
  return rendererMap;
}
项目:daq-eclipse    文件:PropertyConfigurator.java   
/**
    Parse non-root elements, such non-root categories and renderers.
 */
 protected
 void parseCatsAndRenderers(Properties props, LoggerRepository hierarchy) {
   Enumeration enumeration = props.propertyNames();
   while(enumeration.hasMoreElements()) {
     String key = (String) enumeration.nextElement();
     if(key.startsWith(CATEGORY_PREFIX) || key.startsWith(LOGGER_PREFIX)) {
String loggerName = null;
if(key.startsWith(CATEGORY_PREFIX)) {
  loggerName = key.substring(CATEGORY_PREFIX.length());
} else if(key.startsWith(LOGGER_PREFIX)) {
  loggerName = key.substring(LOGGER_PREFIX.length());
}
String value =  OptionConverter.findAndSubst(key, props);
Logger logger = hierarchy.getLogger(loggerName, loggerFactory);
synchronized(logger) {
  parseCategory(props, logger, key, loggerName, value);
  parseAdditivityForLogger(props, logger, loggerName);
}
     } else if(key.startsWith(RENDERER_PREFIX)) {
String renderedClass = key.substring(RENDERER_PREFIX.length());
String renderingClass = OptionConverter.findAndSubst(key, props);
if(hierarchy instanceof RendererSupport) {
  RendererMap.addRenderer((RendererSupport) hierarchy, renderedClass,
              renderingClass);
}
     } else if (key.equals(THROWABLE_RENDERER_PREFIX)) {
         if (hierarchy instanceof ThrowableRendererSupport) {
           ThrowableRenderer tr = (ThrowableRenderer)
                 OptionConverter.instantiateByKey(props,
                         THROWABLE_RENDERER_PREFIX,
                         org.apache.log4j.spi.ThrowableRenderer.class,
                         null);
           if(tr == null) {
               LogLog.error(
                   "Could not instantiate throwableRenderer.");
           } else {
               PropertySetter setter = new PropertySetter(tr);
               setter.setProperties(props, THROWABLE_RENDERER_PREFIX + ".");
               ((ThrowableRendererSupport) hierarchy).setThrowableRenderer(tr);

           }
         }
     }
   }
 }
项目:daq-eclipse    文件:RendererSupport.java   
public
RendererMap getRendererMap();
项目:daq-eclipse    文件:Hierarchy.java   
/**
   Get the renderer map for this hierarchy.
*/
public
RendererMap getRendererMap() {
  return rendererMap;
}
项目:nabs    文件:RendererSupport.java   
public
RendererMap getRendererMap();
项目:nabs    文件:Hierarchy.java   
/**
   Get the renderer map for this hierarchy.
*/
public
RendererMap getRendererMap() {
  return rendererMap;
}