@Override public void deploy(DeploymentUnit unit) throws DeploymentException { if (unit.getAllMetaData(MessageProcessorMetaData.class).isEmpty()) { return; } PoolMetaData pool = AttachmentUtils.getAttachment(unit, "messaging", PoolMetaData.class); if (pool == null) { RubyApplicationMetaData envMetaData = unit.getAttachment(RubyApplicationMetaData.class); boolean devMode = envMetaData != null && envMetaData.isDevelopmentMode(); pool = devMode ? new PoolMetaData("messaging", 1, 2) : new PoolMetaData("messaging"); pool.setInstanceFactoryName(this.instanceFactoryName); AttachmentUtils.multipleAttach(unit, pool, "messaging"); } }
@Override public void deploy(VFSDeploymentUnit unit, RackApplicationMetaData metaData) throws DeploymentException { String beanName = AttachmentUtils.beanName(unit, RackApplicationPool.class); BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(beanName, RackApplicationPoolImpl.class.getName()); metaData.setRackApplicationPoolName(beanName); String appfactoryBeanName = metaData.getRackApplicationFactoryName(); if (appfactoryBeanName == null) { appfactoryBeanName = AttachmentUtils.beanName(unit, RackApplicationFactory.class); } String runtimePoolBeanName = metaData.getRubyRuntimePoolName(); if (runtimePoolBeanName == null) { runtimePoolBeanName = AttachmentUtils.beanName(unit, RubyRuntimePool.class, POOL_NAME); metaData.setRubyRuntimePoolName(runtimePoolBeanName); } ValueMetaData runtimePoolInjection = builder.createInject(runtimePoolBeanName); ValueMetaData appFactoryInjection = builder.createInject(appfactoryBeanName); builder.addConstructorParameter(RubyRuntimePool.class.getName(), runtimePoolInjection); builder.addConstructorParameter(RackApplicationFactory.class.getName(), appFactoryInjection); AttachmentUtils.attach(unit, builder.getBeanMetaData()); if (null == AttachmentUtils.getAttachment(unit, POOL_NAME, PoolMetaData.class)) { AttachmentUtils.multipleAttach(unit, new PoolMetaData(POOL_NAME), POOL_NAME); } }