use of org.jboss.as.pojo.descriptor.BeanMetaDataConfig in project wildfly by wildfly.
the class ParsedKernelDeploymentProcessor method deploy.
/**
* Process a deployment for KernelDeployment configuration.
* Will install a {@code POJO} for each configured bean.
*
* @param phaseContext the deployment unit context
* @throws DeploymentUnitProcessingException
*
*/
public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final DeploymentUnit unit = phaseContext.getDeploymentUnit();
final List<KernelDeploymentXmlDescriptor> kdXmlDescriptors = unit.getAttachment(KernelDeploymentXmlDescriptor.ATTACHMENT_KEY);
if (kdXmlDescriptors == null || kdXmlDescriptors.isEmpty())
return;
final Module module = unit.getAttachment(Attachments.MODULE);
if (module == null)
throw PojoLogger.ROOT_LOGGER.noModuleFound(unit);
final ServiceTarget serviceTarget = phaseContext.getServiceTarget();
final DeploymentReflectionIndex index = unit.getAttachment(Attachments.REFLECTION_INDEX);
if (index == null)
throw PojoLogger.ROOT_LOGGER.missingReflectionIndex(unit);
for (KernelDeploymentXmlDescriptor kdXmlDescriptor : kdXmlDescriptors) {
final List<BeanMetaDataConfig> beanConfigs = kdXmlDescriptor.getBeans();
for (final BeanMetaDataConfig beanConfig : beanConfigs) {
describeBean(module, serviceTarget, index, beanConfig);
}
// TODO -- KD::classloader, KD::aliases
}
}
use of org.jboss.as.pojo.descriptor.BeanMetaDataConfig in project wildfly by wildfly.
the class AbstractPojoPhase method startInternal.
protected void startInternal(StartContext context) throws StartException {
try {
executeInstalls();
// only after describe do we have a bean
if (getLifecycleState().isAfter(BeanState.DESCRIBED)) {
addCallbacks(true);
addCallbacks(false);
ServiceRegistry registry = context.getController().getServiceContainer();
InstancesService.addInstance(registry, context.getChildTarget(), getLifecycleState(), getBean());
}
// do we have a next phase
final AbstractPojoPhase nextPhase = createNextPhase();
if (nextPhase != null) {
final BeanState state = getLifecycleState();
final BeanState next = state.next();
final BeanMetaDataConfig beanConfig = getBeanConfig();
final ServiceName name = BeanMetaDataConfig.toBeanName(beanConfig.getName(), next);
final ServiceTarget serviceTarget = context.getChildTarget();
final ServiceBuilder serviceBuilder = serviceTarget.addService(name, nextPhase);
registerAliases(serviceBuilder, next);
final ConfigVisitor visitor = new DefaultConfigVisitor(serviceBuilder, state, getModule(), getIndex(), getBeanInfo());
beanConfig.visit(visitor);
nextPhase.setModule(getModule());
nextPhase.setBeanConfig(getBeanConfig());
nextPhase.setIndex(getIndex());
nextPhase.setBeanInfo(getBeanInfo());
nextPhase.setBean(getBean());
serviceBuilder.install();
}
} catch (Throwable t) {
throw new StartException(t);
}
}
Aggregations