Search in sources :

Example 1 with BeanState

use of org.jboss.as.pojo.BeanState in project wildfly by wildfly.

the class BeanFactoryMetaDataConfig method addChildren.

@Override
protected void addChildren(ConfigVisitor visitor, List<ConfigVisitorNode> nodes) {
    // always check bean meta data
    nodes.add(bean);
    BeanState state = visitor.getState();
    if (state == BeanState.NOT_INSTALLED)
        nodes.add(getModule());
    if (state == BeanState.INSTANTIATED)
        nodes.addAll(getProperties());
}
Also used : BeanState(org.jboss.as.pojo.BeanState)

Example 2 with BeanState

use of org.jboss.as.pojo.BeanState 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);
    }
}
Also used : DefaultConfigVisitor(org.jboss.as.pojo.descriptor.DefaultConfigVisitor) ConfigVisitor(org.jboss.as.pojo.descriptor.ConfigVisitor) DefaultConfigVisitor(org.jboss.as.pojo.descriptor.DefaultConfigVisitor) BeanState(org.jboss.as.pojo.BeanState) BeanMetaDataConfig(org.jboss.as.pojo.descriptor.BeanMetaDataConfig) ServiceName(org.jboss.msc.service.ServiceName) ServiceTarget(org.jboss.msc.service.ServiceTarget) StartException(org.jboss.msc.service.StartException) ServiceRegistry(org.jboss.msc.service.ServiceRegistry) ServiceBuilder(org.jboss.msc.service.ServiceBuilder)

Aggregations

BeanState (org.jboss.as.pojo.BeanState)2 BeanMetaDataConfig (org.jboss.as.pojo.descriptor.BeanMetaDataConfig)1 ConfigVisitor (org.jboss.as.pojo.descriptor.ConfigVisitor)1 DefaultConfigVisitor (org.jboss.as.pojo.descriptor.DefaultConfigVisitor)1 ServiceBuilder (org.jboss.msc.service.ServiceBuilder)1 ServiceName (org.jboss.msc.service.ServiceName)1 ServiceRegistry (org.jboss.msc.service.ServiceRegistry)1 ServiceTarget (org.jboss.msc.service.ServiceTarget)1 StartException (org.jboss.msc.service.StartException)1