use of org.jboss.as.service.descriptor.JBossServiceDependencyConfig in project wildfly by wildfly.
the class ParsedServiceDeploymentProcessor method addDependencyLists.
private void addDependencyLists(final JBossServiceDependencyListConfig[] dependencyListConfigs, final List<ClassReflectionIndex> mBeanClassHierarchy, final MBeanServices mBeanServices) throws DeploymentUnitProcessingException {
if (dependencyListConfigs != null) {
final Service<Object> createDestroyService = mBeanServices.getCreateDestroyService();
for (final JBossServiceDependencyListConfig dependencyListConfig : dependencyListConfigs) {
final List<ObjectName> dependencyObjectNames = new ArrayList<ObjectName>(dependencyListConfig.getDependencyConfigs().length);
for (final JBossServiceDependencyConfig dependencyConfig : dependencyListConfig.getDependencyConfigs()) {
final String dependencyName = dependencyConfig.getDependencyName();
mBeanServices.addDependency(dependencyName);
final ObjectName dependencyObjectName = createDependencyObjectName(dependencyName);
dependencyObjectNames.add(dependencyObjectName);
}
final String optionalAttributeName = dependencyListConfig.getOptionalAttributeName();
if (optionalAttributeName != null) {
final Injector<Object> injector = getOptionalAttributeInjector(optionalAttributeName, mBeanClassHierarchy, createDestroyService);
final ImmediateValue<List<ObjectName>> dependencyNamesValue = new ImmediateValue<List<ObjectName>>(dependencyObjectNames);
mBeanServices.addInjectionValue(injector, dependencyNamesValue);
}
}
}
}
use of org.jboss.as.service.descriptor.JBossServiceDependencyConfig in project wildfly by wildfly.
the class ParsedServiceDeploymentProcessor method addServices.
private void addServices(final ServiceTarget target, final JBossServiceConfig mBeanConfig, final ClassLoader classLoader, final DeploymentReflectionIndex index, ServiceComponentInstantiator componentInstantiator, final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
final String mBeanClassName = mBeanConfig.getCode();
final List<ClassReflectionIndex> mBeanClassHierarchy = ReflectionUtils.getClassHierarchy(mBeanClassName, index, classLoader);
final Object mBeanInstance = newInstance(mBeanConfig, mBeanClassHierarchy, classLoader);
final String mBeanName = mBeanConfig.getName();
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final MBeanServices mBeanServices = new MBeanServices(mBeanName, mBeanInstance, mBeanClassHierarchy, target, componentInstantiator, deploymentUnit.getAttachmentList(org.jboss.as.ee.component.Attachments.WEB_SETUP_ACTIONS), classLoader, mbeanServerServiceName);
final JBossServiceDependencyConfig[] dependencyConfigs = mBeanConfig.getDependencyConfigs();
addDependencies(dependencyConfigs, mBeanClassHierarchy, mBeanServices);
final JBossServiceDependencyListConfig[] dependencyListConfigs = mBeanConfig.getDependencyConfigLists();
addDependencyLists(dependencyListConfigs, mBeanClassHierarchy, mBeanServices);
final JBossServiceAttributeConfig[] attributeConfigs = mBeanConfig.getAttributeConfigs();
addAttributes(attributeConfigs, mBeanClassHierarchy, mBeanServices, classLoader);
// register all mBean related services
mBeanServices.install();
}
use of org.jboss.as.service.descriptor.JBossServiceDependencyConfig in project wildfly by wildfly.
the class ParsedServiceDeploymentProcessor method addDependencies.
private void addDependencies(final JBossServiceDependencyConfig[] dependencyConfigs, final List<ClassReflectionIndex> mBeanClassHierarchy, final MBeanServices mBeanServices) throws DeploymentUnitProcessingException {
if (dependencyConfigs != null) {
final Service<Object> createDestroyService = mBeanServices.getCreateDestroyService();
for (final JBossServiceDependencyConfig dependencyConfig : dependencyConfigs) {
final String optionalAttributeName = dependencyConfig.getOptionalAttributeName();
if (optionalAttributeName != null) {
final Injector<Object> injector = getOptionalAttributeInjector(optionalAttributeName, mBeanClassHierarchy, createDestroyService);
final ObjectName dependencyObjectName = createDependencyObjectName(dependencyConfig.getDependencyName());
final ImmediateValue<ObjectName> dependencyNameValue = new ImmediateValue<ObjectName>(dependencyObjectName);
mBeanServices.addInjectionValue(injector, dependencyNameValue);
}
mBeanServices.addDependency(dependencyConfig.getDependencyName());
}
}
}
Aggregations