Search in sources :

Example 1 with DefaultConfigVisitor

use of org.jboss.as.pojo.descriptor.DefaultConfigVisitor 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)

Example 2 with DefaultConfigVisitor

use of org.jboss.as.pojo.descriptor.DefaultConfigVisitor in project wildfly by wildfly.

the class ParsedKernelDeploymentProcessor method describeBean.

protected void describeBean(final Module module, final ServiceTarget serviceTarget, DeploymentReflectionIndex deploymentIndex, BeanMetaDataConfig beanConfig) {
    final BeanState state = BeanState.NOT_INSTALLED;
    final ServiceName describedServiceName = BeanMetaDataConfig.toBeanName(beanConfig.getName(), state.next());
    final DescribedPojoPhase describedService = new DescribedPojoPhase(deploymentIndex, beanConfig);
    final ServiceBuilder describedServiceBuilder = serviceTarget.addService(describedServiceName, describedService);
    describedService.registerAliases(describedServiceBuilder);
    final ConfigVisitor visitor = new DefaultConfigVisitor(describedServiceBuilder, state, module, deploymentIndex);
    beanConfig.visit(visitor);
    describedServiceBuilder.setInitialMode(beanConfig.getMode().getMode());
    describedServiceBuilder.install();
}
Also used : DescribedPojoPhase(org.jboss.as.pojo.service.DescribedPojoPhase) DefaultConfigVisitor(org.jboss.as.pojo.descriptor.DefaultConfigVisitor) ConfigVisitor(org.jboss.as.pojo.descriptor.ConfigVisitor) DefaultConfigVisitor(org.jboss.as.pojo.descriptor.DefaultConfigVisitor) ServiceName(org.jboss.msc.service.ServiceName) ServiceBuilder(org.jboss.msc.service.ServiceBuilder)

Aggregations

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