use of org.jboss.as.service.descriptor.JBossServiceDependencyListConfig 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.JBossServiceDependencyListConfig 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 = 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, mBeanInstance);
final JBossServiceDependencyListConfig[] dependencyListConfigs = mBeanConfig.getDependencyConfigLists();
addDependencyLists(dependencyListConfigs, mBeanClassHierarchy, mBeanServices, mBeanInstance);
final JBossServiceAttributeConfig[] attributeConfigs = mBeanConfig.getAttributeConfigs();
addAttributes(attributeConfigs, mBeanClassHierarchy, mBeanServices, classLoader, mBeanInstance);
// register all mBean related services
mBeanServices.install();
}
use of org.jboss.as.service.descriptor.JBossServiceDependencyListConfig in project wildfly by wildfly.
the class ParsedServiceDeploymentProcessor method addDependencyLists.
private void addDependencyLists(final JBossServiceDependencyListConfig[] dependencyListConfigs, final List<ClassReflectionIndex> mBeanClassHierarchy, final MBeanServices mBeanServices, final Object mBeanInstance) throws DeploymentUnitProcessingException {
if (dependencyListConfigs != null) {
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 Method setter = ReflectionUtils.getSetter(mBeanClassHierarchy, optionalAttributeName);
final ObjectSupplier objectSupplier = new ObjectSupplier(dependencyObjectNames);
mBeanServices.addValue(setter, objectSupplier);
}
}
}
}
Aggregations