/** * @param componentName The component name to find. (NotNull) * @return The determination, true or false. */ public static boolean proveComponentByName(String componentName) { return SingletonLaContainerFactory.getContainer().hasComponentDef(componentName); }
/** * @param componentType The component type to find. (NotNull) * @return The determination, true or false. */ public static boolean hasComponent(Class<?> componentType) { return SingletonLaContainerFactory.getContainer().hasComponentDef(componentType); }
protected boolean hasActionDef(LaContainer root, String componentName) { try { return root.hasComponentDef(componentName); } catch (NoClassDefFoundError e) { // basically only when HotDeploy // e.g. /sealand/ => sealand.SeaLandAction // /Sea/land/ has been already handled before (should be 404) throwActionClassPackageMismatchException(componentName, e); return false; } }
protected boolean hasActionDef(LaContainer root, String componentName) { try { return root.hasComponentDef(componentName); } catch (NoClassDefFoundError e) { // basically only when HotDeploy // e.g. /sealand/ => sealand.SeaLandAction // /Sea/land/ has been already handled before (should be 404) throwActionClassPackageMismatchException(componentName, e); return false; } }
/** * @param componentType The component type to find. (NotNull) * @return The determination, true or false. */ public static boolean hasComponent(Class<?> componentType) { return SingletonLaContainerFactory.getContainer().hasComponentDef(componentType); }
/** * @param componentName The component name to find. (NotNull) * @return The determination, true or false. */ public static boolean proveComponentByName(String componentName) { return SingletonLaContainerFactory.getContainer().hasComponentDef(componentName); }
protected LaContainerBuilder createDefaultBuilder(final LaContainer configurationContainer) { if (configurationContainer.hasComponentDef(DEFAULT_BUILDER_NAME)) { return (LaContainerBuilder) configurationContainer.getComponent(DEFAULT_BUILDER_NAME); } if (configurationContainer.hasComponentDef(ResourceResolver.class) && defaultBuilder instanceof AbstractLaContainerBuilder) { final ResourceResolver resolver = (ResourceResolver) configurationContainer.getComponent(ResourceResolver.class); ((AbstractLaContainerBuilder) defaultBuilder).setResourceResolver(resolver); } return defaultBuilder; }
protected Object resolveSimpleComponent(String exp, Map<String, ? extends Object> contextMap, LaContainer container, Class<?> resultType) { if (!LdiSrl.containsAny(exp, ".", ",", SQ, DQ, "@", "#")) { // main except, just in case if (container.hasComponentDef(exp)) { return container.getComponent(exp); } } return null; }
protected void setupDeployer(final LaContainer configurationContainer) { if (configurationContainer.hasComponentDef(ComponentDeployerFactory.Provider.class)) { ComponentDeployerFactory.setProvider( (ComponentDeployerFactory.Provider) configurationContainer.getComponent(ComponentDeployerFactory.Provider.class)); } }
protected void setupBehavior(final LaContainer configurationContainer) { if (configurationContainer.hasComponentDef(LaContainerBehavior.Provider.class)) { LaContainerBehavior.setProvider( (LaContainerBehavior.Provider) configurationContainer.getComponent(LaContainerBehavior.Provider.class)); } }
protected void setupAssembler(final LaContainer configurationContainer) { if (configurationContainer.hasComponentDef(AssemblerFactory.Provider.class)) { AssemblerFactory .setProvider((AssemblerFactory.Provider) configurationContainer.getComponent(AssemblerFactory.Provider.class)); } } }
protected static void showBoot() { logger.info("Lasta Di boot successfully."); logger.info(" SmartDeploy Mode: {}", SmartDeployUtil.getDeployMode(container)); if (getContainer().hasComponentDef(NamingConvention.class)) { // just in case final NamingConvention convention = getContainer().getComponent(NamingConvention.class); final StringBuilder sb = new StringBuilder(); for (String rootPkg : convention.getRootPackageNames()) { if (sb.length() > 0) { sb.append(", "); } sb.append(rootPkg); } logger.info(" Smart Package: {}", sb.toString()); } }
protected LaContainerProvider createProvider(final LaContainer configurationContainer) { if (configurationContainer.hasComponentDef(LaContainerProvider.class)) { return (LaContainerProvider) configurationContainer.getComponent(LaContainerProvider.class); } else if (provider instanceof LaContainerDefaultProvider) { final LaContainerDefaultProvider dp = (LaContainerDefaultProvider) provider; if (configurationContainer.hasComponentDef(PathResolver.class)) { dp.setPathResolver((PathResolver) configurationContainer.getComponent(PathResolver.class)); } if (configurationContainer.hasComponentDef(ExternalContext.class)) { dp.setExternalContext((ExternalContext) configurationContainer.getComponent(ExternalContext.class)); } if (configurationContainer.hasComponentDef(ExternalContextComponentDefRegister.class)) { dp.setExternalContextComponentDefRegister((ExternalContextComponentDefRegister) configurationContainer .getComponent(ExternalContextComponentDefRegister.class)); } } return provider; }
@Override protected LaContainerProvider createProvider(LaContainer configurationContainer) { final LaContainerFactoryCoolProvider provider = newLaContainerFactoryCoolProvider(); if (configurationContainer.hasComponentDef(PathResolver.class)) { provider.setPathResolver((PathResolver) configurationContainer.getComponent(PathResolver.class)); } if (configurationContainer.hasComponentDef(ExternalContext.class)) { provider.setExternalContext((ExternalContext) configurationContainer.getComponent(ExternalContext.class)); } if (configurationContainer.hasComponentDef(ExternalContextComponentDefRegister.class)) { provider.setExternalContextComponentDefRegister( (ExternalContextComponentDefRegister) configurationContainer.getComponent(ExternalContextComponentDefRegister.class)); } return provider; }
protected LaContainerBuilder getBuilder(String ext) { final String componentName = ext + "Redefined"; final LaContainer configurationContainer = LaContainerFactory.getConfigurationContainer(); if (configurationContainer != null && configurationContainer.hasComponentDef(componentName)) { return (LaContainerBuilder) configurationContainer.getComponent(componentName); } return LaContainerFactory.getDefaultBuilder(); }
protected void bind(final String[] names, final Object obj) throws NamingException { final StringBuffer buf = new StringBuffer(100); try { LaContainer context = SingletonLaContainerFactory.getContainer(); for (int i = 0; i < names.length - 1; ++i) { buf.append(names[i]); context = (LaContainer) context.getComponent(names[i]); buf.append('/'); } final String name = names[names.length - 1]; buf.append(name); if (context.hasComponentDef(name)) { throw new NameAlreadyBoundException(new String(buf)); } context.register(obj, name); } catch (final ComponentNotFoundException e) { throw createNamingException(new String(buf), e); } catch (final SRuntimeException e) { throw createNamingException(e.getMessage(), e); } }
ComponentDef redefine(ComponentDef componentDef, String path) { String name = componentDef.getComponentName(); String diconPath = constructRedifinitionDiconPath(path, name); if (!LaContainerBuilderUtils.resourceExists(diconPath, this)) { return componentDef; } LaContainer container = LaContainerFactory.create(diconPath); if (!container.hasComponentDef(name)) { throw new RuntimeException("Can't find component definition named '" + name + "' in " + diconPath); } return container.getComponentDef(name); }
public LaContainer create(String path) { final LaContainer configurationContainer = LaContainerFactory.getConfigurationContainer(); final ClassLoader classLoader; if (configurationContainer != null && configurationContainer.hasComponentDef(ClassLoader.class)) { classLoader = (ClassLoader) configurationContainer.getComponent(ClassLoader.class); } else { classLoader = Thread.currentThread().getContextClassLoader(); } final LaContainer container = LdiStringUtil.isEmpty(path) ? new LaContainerImpl() : build(path, classLoader); if (container.isInitializeOnCreate()) { container.init(); } return container; }
protected static void doConfigure(String configFile) { show("...Reading {}", configFile); // first configuration so no indent (see LaContainerDefaultProvider) final LaContainerBuilder builder = newConfigurationContainerBuilder(); configurationContainer = builder.build(configFile); configurationContainer.init(); final Configurator configurator; if (configurationContainer.hasComponentDef(Configurator.class)) { configurator = (Configurator) configurationContainer.getComponent(Configurator.class); } else { configurator = newDefaultConfigurator(); } configurator.configure(configurationContainer); }
return; if (container.getRoot().hasComponentDef(clazz)) { if (clazz.isInterface() || LdiModifierUtil.isAbstract(clazz)) { return;