protected void doInit() { if (inited) { return; } final ExternalContextComponentDefRegister register = getRoot().getExternalContextComponentDefRegister(); if (register != null) { register.registerComponentDefs(this); } final ClassLoader currentLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); try { for (int i = 0; i < getChildSize(); ++i) { getChild(i).init(); } for (int i = 0; i < getComponentDefSize(); ++i) { getComponentDef(i).init(); } inited = true; } finally { Thread.currentThread().setContextClassLoader(currentLoader); } }
protected ComponentDef doGetComponentDef(LaContainer container, Object key) { ComponentDef cd = super.getComponentDef(container, key); if (cd != null) { return cd; } if (container != container.getRoot()) { return null; } cd = getComponentDefFromCache(key); if (cd != null) { return cd; } if (key instanceof Class<?>) { cd = createComponentDef((Class<?>) key); } else if (key instanceof String) { cd = createComponentDef((String) key); if (cd != null && !key.equals(cd.getComponentName())) { logger.log("WSSR0011", new Object[] { key, cd.getComponentClass().getName(), cd.getComponentName() }); cd = null; } } else { throw new IllegalArgumentException("Illegal component key: " + key); } if (cd != null) { register(cd); ComponentUtil.putRegisterLog(cd); cd.init(); } return cd; }
protected ComponentDef getComponentDef(LaContainer container, Object key) { synchronized (container.getRoot()) { ComponentDef cd = super.getComponentDef(container, key); if (cd != null) { return cd; } if (container != container.getRoot()) { return null; } if (key instanceof Class) { cd = createComponentDef((Class<?>) key); } else if (key instanceof String) { cd = createComponentDef((String) key); if (cd != null && !key.equals(cd.getComponentName())) { logger.log("WSSR0011", new Object[] { key, cd.getComponentClass().getName(), cd.getComponentName() }); cd = null; } } else { throw new IllegalArgumentException("key"); } if (cd != null) { SingletonLaContainerFactory.getContainer().register(cd); ComponentUtil.putRegisterLog(cd); cd.init(); } return cd; } }