public static <T extends ConfigExtension> T getExtensionByType(Config c, Class<T> type) { for (Container extension : c.getContainers()) { try { return type.cast(extension); } catch (Exception e) { // ignore, not the right type. } } return null; }
@Override public Object run(Config config) throws PropertyVetoException, TransactionFailure { config.getContainers().add(container); return null; } }, config);
@Override public Object run(Config param) throws PropertyVetoException, TransactionFailure { HttpService httpService = param.createChild(HttpService.class); AccessLog accessLog = httpService.createChild(AccessLog.class); List<VirtualServer> vsList = httpService.getVirtualServer(); httpService.setAccessLog(accessLog); VirtualServer vs = httpService.createChild(VirtualServer.class); vs.setId("server"); vs.setNetworkListeners("http-listener-1,http-listener-2"); VirtualServer vs1 = httpService.createChild(VirtualServer.class); vs1.setId("__asadmin"); vs1.setNetworkListeners("admin-listener"); vsList.add(vs); vsList.add(vs1); param.getContainers().add(httpService); return httpService; } }, param);
inhabitant.getClass())); Container newContainerConfig = inhabitant.getInitialConfig(ctx); config.getContainers().add(newContainerConfig);
public static void addIndex(Config c, ServiceLocator habitat, String name) { ServiceLocatorUtilities.addOneDescriptor(habitat, BuilderHelper.createConstantDescriptor(c, name, Config.class)); // directly referenced objects ConfigBeanProxy dirref[] = { c.getAdminService(), c.getAvailabilityService(), c.getDiagnosticService(), c.getHttpService(), c.getJavaConfig(), c.getLogService(), c.getNetworkConfig(), c.getSecurityService(), c.getThreadPools(), c.getMonitoringService(), }; for (ConfigBeanProxy cbp : dirref) { if (cbp != null) { ServiceLocatorUtilities.addOneDescriptor(habitat, BuilderHelper.createConstantDescriptor(cbp, name, ConfigSupport.getImpl(cbp).getProxyType())); } } // containers for (Container extension : c.getContainers()) { ServiceLocatorUtilities.addOneDescriptor(habitat, BuilderHelper.createConstantDescriptor(extension, name, ConfigSupport.getImpl(extension).getProxyType())); } }