private ObjectName createDependencyObjectName(final String dependencyName) throws DeploymentUnitProcessingException { try { return new ObjectName(dependencyName); } catch (MalformedObjectNameException exception) { throw SarLogger.ROOT_LOGGER.malformedDependencyName(exception, dependencyName); } }
private static Object newValue(final Class<?> type, final String value) { final PropertyEditor editor = PropertyEditorFinder.getInstance().find(type); if (editor == null) { SarLogger.ROOT_LOGGER.propertyNotFound(type); return null; } editor.setAsText(value); return editor.getValue(); }
/** * Process a deployment for JbossService configuration. Will install a {@code JBossService} for * each configured service. * * @param phaseContext the deployment unit context * @throws DeploymentUnitProcessingException */ @Override public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final JBossServiceXmlDescriptor serviceXmlDescriptor = deploymentUnit.getAttachment(JBossServiceXmlDescriptor.ATTACHMENT_KEY); if (serviceXmlDescriptor == null) { // Skip deployments without a service xml descriptor return; } // assert module final Module module = deploymentUnit.getAttachment(Attachments.MODULE); if (module == null) throw SarLogger.ROOT_LOGGER.failedToGetAttachment("module", deploymentUnit); // assert reflection index final DeploymentReflectionIndex reflectionIndex = deploymentUnit.getAttachment(Attachments.REFLECTION_INDEX); if (reflectionIndex == null) throw SarLogger.ROOT_LOGGER.failedToGetAttachment("reflection index", deploymentUnit); // install services final ClassLoader classLoader = module.getClassLoader(); final List<JBossServiceConfig> serviceConfigs = serviceXmlDescriptor.getServiceConfigs(); final ServiceTarget target = phaseContext.getServiceTarget(); final Map<String, ServiceComponentInstantiator> serviceComponents = deploymentUnit.getAttachment(ServiceAttachments.SERVICE_COMPONENT_INSTANTIATORS); for (final JBossServiceConfig serviceConfig : serviceConfigs) { addServices( target, serviceConfig, classLoader, reflectionIndex, serviceComponents != null ? serviceComponents.get(serviceConfig.getName()) : null, phaseContext); } }
private static ServiceName newServiceName(final String name) { if (name == null) { throw SarLogger.ROOT_LOGGER.nullVar("name"); } return MBEAN_SERVICE_NAME_BASE.append(name); }