@Test(expected = IllegalArgumentException.class) public void testGetConcreteLogger() { addHandler("foo", true); registry.registerConcreteLogger(null,"bar"); EventLogDefinition eld = registry.getInvokableLogger("foobar"); assertEquals(eld.getLogName(), "foobar"); assertEquals(eld.isAbstract(), false); registry.registerConcreteLogger("ns","bar"); eld = registry.getInvokableLogger("nsfoobar"); assertEquals(eld.getLogName(), "nsfoobar"); assertEquals(eld.isAbstract(), false); registry.registerConcreteLogger("ns","foo"); eld = registry.getInvokableLogger("nsfoofoo"); assertEquals(eld.getLogName(), "nsfoofoo"); assertEquals(eld.isAbstract(), false); try { eld.getConcreteLogger("ns","foo"); assertFalse("IllegalArgumentException expected", true); } catch (IllegalArgumentException e) { } }
public EventLogDefinition getConcreteLogger(String serviceName, String namespace) { if (!isAbstract()) { throw new IllegalArgumentException("Cannot create concrete version of non abstract logger"); } try { EventLogDefinition result = new EventLogDefinition(); String concreteLogName = deriveConcreteLogName(namespace, serviceName); result.setLogName(concreteLogName); result.registry = registry; result.abstractDefinition = false; result.setHandler(handler.clone(concreteLogName, serviceName, namespace)); return result; } catch (IOException ioe) { throw new IllegalStateException("Unable to get concrete logger for " + serviceName, ioe); } }
EventLogDefinition { public EventLogDefinition getConcreteLogger(String serviceName, String namespace) { if (!isAbstract()) { throw new IllegalArgumentException("Cannot create concrete version of non abstract logger"); } try { EventLogDefinition result = new EventLogDefinition(); String concreteLogName = deriveConcreteLogName(namespace, serviceName); result.setLogName(concreteLogName); result.registry = registry; result.abstractDefinition = false; result.setHandler(handler.clone(concreteLogName, serviceName, namespace)); return result; } catch (IOException ioe) { throw new IllegalStateException("Unable to get concrete logger for " + serviceName, ioe); } } }
EventLogDefinition { public EventLogDefinition getConcreteLogger(String serviceName, String namespace) { if (!isAbstract()) { throw new IllegalArgumentException("Cannot create concrete version of non abstract logger"); } try { EventLogDefinition result = new EventLogDefinition(); String concreteLogName = deriveConcreteLogName(namespace, serviceName); result.setLogName(concreteLogName); result.registry = registry; result.abstractDefinition = false; result.setHandler(handler.clone(concreteLogName, serviceName, namespace)); return result; } catch (IOException ioe) { throw new IllegalStateException("Unable to get concrete logger for " + serviceName, ioe); } }  }
EventLogDefinition { public EventLogDefinition getConcreteLogger(String serviceName, String namespace) { if (!isAbstract()) { throw new IllegalArgumentException("Cannot create concrete version of non abstract logger"); } try { EventLogDefinition result = new EventLogDefinition(); String concreteLogName = deriveConcreteLogName(namespace, serviceName); result.setLogName(concreteLogName); result.registry = registry; result.abstractDefinition = false; result.setHandler(handler.clone(concreteLogName, serviceName, namespace)); return result; } catch (IOException ioe) { throw new IllegalStateException("Unable to get concrete logger for " + serviceName, ioe); } }  void setHandler(AbstractLogHandler handler); AbstractLogHandler getHandler(); void setLogName(String logName); void setRegistry(EventLoggingRegistry registry); void setAbstract(boolean abstractDefinition); String getLogName(); boolean isAbstract(); void register(); String deriveConcreteLogName(String namespace, String serviceName); EventLogDefinition getConcreteLogger(String serviceName, String namespace); }
EventLogDefinition { public EventLogDefinition getConcreteLogger(String serviceName, String namespace) { if (!isAbstract()) { throw new IllegalArgumentException("Cannot create concrete version of non abstract logger"); } try { EventLogDefinition result = new EventLogDefinition(); String concreteLogName = deriveConcreteLogName(namespace, serviceName); result.setLogName(concreteLogName); result.registry = registry; result.abstractDefinition = false; result.setHandler(handler.clone(concreteLogName, serviceName, namespace)); return result; } catch (IOException ioe) { throw new IllegalStateException("Unable to get concrete logger for " + serviceName, ioe); } }  void setHandler(AbstractLogHandler handler); AbstractLogHandler getHandler(); void setLogName(String logName); void setRegistry(EventLoggingRegistry registry); void setAbstract(boolean abstractDefinition); String getLogName(); boolean isAbstract(); void register(); String deriveConcreteLogName(String namespace, String serviceName); EventLogDefinition getConcreteLogger(String serviceName, String namespace);  }