public ServiceComponentInstantiator(DeploymentUnit deploymentUnit, ComponentDescription componentDescription) { componentStartServiceName = componentDescription.getStartServiceName(); this.serviceRegistry = deploymentUnit.getServiceRegistry(); }
@Override public void undeploy(DeploymentUnit context) { final ServiceName weldTransactionServiceName = context.getServiceName().append(ServiceNames.WELD_TRANSACTION_SERVICES_SERVICE_NAME); final ServiceController<?> serviceController = context.getServiceRegistry().getService(weldTransactionServiceName); if (serviceController != null) { serviceController.setMode(ServiceController.Mode.REMOVE); } }
@Override public Collection<Service> getServices(DeploymentUnit rootDeploymentUnit, DeploymentUnit deploymentUnit, Module module, ResourceRoot resourceRoot) { List<Service> services = new ArrayList<>(); // ResourceInjectionServices // TODO I'm not quite sure we should use rootDeploymentUnit here services.add(new WeldResourceInjectionServices(rootDeploymentUnit.getServiceRegistry(), rootDeploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION), module, DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit))); // ClassFileServices final CompositeIndex index = deploymentUnit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX); if (index != null) { services.add(new WeldClassFileServices(index, module.getClassLoader())); } return services; }
@Override public void undeploy(final DeploymentUnit context) { final Module module = context.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE); ServiceName deploymentService = context.getServiceName(); ServiceController<?> controller = context.getServiceRegistry().getRequiredService(deploymentService); //WFLY-9666 we do this cleanup at the end of undeploy //if we do it now any code in the undeploy sequence that attempts to use EL can cause it to be re-added controller.addListener(new LifecycleListener() { @Override public void handleEvent(ServiceController<?> serviceController, LifecycleEvent lifecycleEvent) { if(lifecycleEvent == LifecycleEvent.DOWN) { FactoryFinderCache.clearClassLoader(module.getClassLoader()); controller.removeListener(this); } } }); } }
@Override public void undeploy(DeploymentUnit deploymentUnit) { AbstractSecurityDeployer<?> deployer = null; deployer = new EjbSecurityDeployer(); deployer.undeploy(deploymentUnit); // EJBs maybe included directly in war deployment ServiceName jaccServiceName = getJaccServiceName(deploymentUnit); ServiceRegistry registry = deploymentUnit.getServiceRegistry(); if(registry != null){ ServiceController<?> serviceController = registry.getService(jaccServiceName); if (serviceController != null) { serviceController.setMode(ServiceController.Mode.REMOVE); } } }
private void processMessageDrivenBeanMetaData(final DeploymentUnit deploymentUnit, final MessageDrivenBeanMetaData mdb) throws DeploymentUnitProcessingException { final EjbJarDescription ejbJarDescription = getEjbJarDescription(deploymentUnit); final String beanName = mdb.getName(); final String beanClassName = mdb.getEjbClass(); String messageListenerInterface = mdb.getMessagingType(); if (messageListenerInterface == null || messageListenerInterface.trim().isEmpty()) { // TODO: This isn't really correct to default to MessageListener messageListenerInterface = MessageListener.class.getName(); } final Properties activationConfigProps = getActivationConfigProperties(mdb.getActivationConfig()); final String defaultResourceAdapterName = this.getDefaultResourceAdapterName(deploymentUnit.getServiceRegistry()); final MessageDrivenComponentDescription mdbComponentDescription = new MessageDrivenComponentDescription(beanName, beanClassName, ejbJarDescription, deploymentUnit.getServiceName(), messageListenerInterface, activationConfigProps, defaultResourceAdapterName, mdb, defaultMdbPoolAvailable); mdbComponentDescription.setDeploymentDescriptorEnvironment(new DeploymentDescriptorEnvironment("java:comp/env/", mdb)); addComponent(deploymentUnit, mdbComponentDescription); }
ServiceController<?> controller = deploymentUnit.getServiceRegistry().getService(serviceName); if (controller != null) { serviceControllers.add(controller); ServiceRegistry registry = sub.getServiceRegistry(); List<ServiceName> componentStartServiceNames = getComponentStartServiceNames(sub);
@Override public void undeploy(DeploymentUnit deploymentUnit) { final EEModuleConfiguration moduleConfiguration = deploymentUnit.getAttachment(EE_MODULE_CONFIGURATION); if (moduleConfiguration == null) { return; } final ServiceRegistry serviceRegistry = deploymentUnit.getServiceRegistry(); boolean clusteredSingletonFound = false; for (final ComponentConfiguration configuration : moduleConfiguration.getComponentConfigurations()) { final ComponentDescription description = configuration.getComponentDescription(); if (description instanceof MessageDrivenComponentDescription) { MessageDrivenComponentDescription mdbDescription = (MessageDrivenComponentDescription) description; clusteredSingletonFound = clusteredSingletonFound || mdbDescription.isClusteredSingleton(); if (mdbDescription.isClusteredSingleton() || mdbDescription.getDeliveryGroup() != null) { serviceRegistry.getRequiredService(mdbDescription.getDeliveryControllerName()).setMode(Mode.REMOVE); } } } } }
messageListenerInterfaceName = getMessageListenerInterface(compositeIndex, messageBeanAnnotation); final String defaultResourceAdapterName = this.getDefaultResourceAdapterName(deploymentUnit.getServiceRegistry()); final MessageDrivenComponentDescription beanDescription = new MessageDrivenComponentDescription(beanName, beanClassName, ejbJarDescription, deploymentUnitServiceName, messageListenerInterfaceName, activationConfigProperties, defaultResourceAdapterName, beanMetaData, defaultMdbPoolAvailable); beanDescription.setDeploymentDescriptorEnvironment(deploymentDescriptorEnvironment);
@Override public void undeploy(DeploymentUnit context) { final ServiceName weldTransactionServiceName = context.getServiceName().append(WeldTransactionServices.SERVICE_NAME); final ServiceController<?> serviceController = context.getServiceRegistry().getService(weldTransactionServiceName); if (serviceController != null) { serviceController.setMode(ServiceController.Mode.REMOVE); } }
public void undeploy(final DeploymentUnit context) { final ServiceName serviceName = SERVICE_NAME_BASE.append(context.getName()); final ServiceController<?> controller = context.getServiceRegistry().getService(serviceName); if(controller != null) { controller.setMode(ServiceController.Mode.REMOVE); } }
@SuppressWarnings("unchecked") protected void replaceService(ServiceName name, Runnable actionOnRemove) { ServiceController<?> service = this.unit.getServiceRegistry().getService( name ); if (service != null) { if (actionOnRemove != null) { service.addListener( new RemovalListener( actionOnRemove ) ); } service.setMode( Mode.REMOVE ); } else if (actionOnRemove != null) { actionOnRemove.run(); } }
protected ServiceBuilder<?> build(final ServiceName serviceName, final Service<?> service, final boolean singleton) { ServiceBuilder<?> builder = getTarget().addService(serviceName, service); if (singleton && ClusterUtil.isClustered( getUnit().getServiceRegistry() )) { builder.addDependency( unit.getServiceName().append( HA_SINGLETON_SERVICE_SUFFIX ) ); builder.setInitialMode(Mode.PASSIVE); } else { builder.setInitialMode(Mode.ACTIVE); } return builder; }
@Override public Collection<Service> getServices(DeploymentUnit rootDeploymentUnit, DeploymentUnit deploymentUnit, Module module, ResourceRoot resourceRoot) { if (resourceRoot == null) { return Collections.emptySet(); } return Collections.singleton(new WeldEjbInjectionServices(rootDeploymentUnit.getServiceRegistry(), rootDeploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION), rootDeploymentUnit.getAttachment(org.jboss.as.ee.component.Attachments.EE_APPLICATION_DESCRIPTION), resourceRoot.getRoot(), module, DeploymentTypeMarker.isType(DeploymentType.WAR, deploymentUnit))); }
protected EJBUtilities getEJBUtilities() { // constructs final DeploymentUnit deploymentUnit = getDeploymentUnitInjector().getValue(); final ServiceController<EJBUtilities> serviceController = (ServiceController<EJBUtilities>) deploymentUnit.getServiceRegistry().getRequiredService(EJBUtilities.SERVICE_NAME); return serviceController.getValue(); }
private InjectionSource getPersistenceContextBindingSource( final DeploymentUnit deploymentUnit, final String unitName, PersistenceContextType type, SynchronizationType synchronizationType, Map properties) throws DeploymentUnitProcessingException { PersistenceUnitMetadata pu = getPersistenceUnit(deploymentUnit, unitName); String scopedPuName = pu.getScopedPersistenceUnitName(); ServiceName puServiceName = getPuServiceName(scopedPuName); // get deployment settings from top level du (jboss-all.xml is only parsed at the top level). final JPADeploymentSettings jpaDeploymentSettings = DeploymentUtils.getTopDeploymentUnit(deploymentUnit).getAttachment(JpaAttachments.DEPLOYMENT_SETTINGS_KEY); return new PersistenceContextInjectionSource(type, synchronizationType, properties, puServiceName, deploymentUnit.getServiceRegistry(), scopedPuName, EntityManager.class.getName(), pu, jpaDeploymentSettings); }
@Override public void internalUndeploy(final DeploymentUnit context) { if (isWebServiceDeployment(context)) { ServerConfigImpl config = (ServerConfigImpl)context.getServiceRegistry().getRequiredService(WSServices.CONFIG_SERVICE).getValue(); config.decrementWSDeploymentCount(); } // Cleans up reference established by AbstractDeploymentModelBuilder#propagateAttachments context.removeAttachment(WSAttachmentKeys.DEPLOYMENT_KEY); }
/** {@inheritDoc} */ public void undeploy(final DeploymentUnit deploymentUnit) { final ExtensionInfo extensionInfo = deploymentUnit.getAttachment(Attachments.EXTENSION_INFORMATION); if (extensionInfo == null) { return; } // we need to remove the extension on undeploy final ServiceController<?> extensionIndexController = deploymentUnit.getServiceRegistry().getRequiredService( Services.JBOSS_DEPLOYMENT_EXTENSION_INDEX); final ExtensionIndex extensionIndexService = (ExtensionIndex) extensionIndexController.getValue(); final ModuleIdentifier moduleIdentifier = deploymentUnit.getAttachment(Attachments.MODULE_IDENTIFIER); extensionIndexService.removeDeployedExtension(extensionInfo.getName(), moduleIdentifier); } }
/** {@inheritDoc} */ public void undeploy(final DeploymentUnit deploymentUnit) { final ExtensionInfo extensionInfo = deploymentUnit.getAttachment(Attachments.EXTENSION_INFORMATION); if (extensionInfo == null) { return; } // we need to remove the extension on undeploy final ServiceController<?> extensionIndexController = deploymentUnit.getServiceRegistry().getRequiredService( Services.JBOSS_DEPLOYMENT_EXTENSION_INDEX); final ExtensionIndex extensionIndexService = (ExtensionIndex) extensionIndexController.getValue(); final ModuleIdentifier moduleIdentifier = deploymentUnit.getAttachment(Attachments.MODULE_IDENTIFIER); extensionIndexService.removeDeployedExtension(extensionInfo.getName(), moduleIdentifier); } }
/** {@inheritDoc} */ public void undeploy(final DeploymentUnit deploymentUnit) { final ExtensionInfo extensionInfo = deploymentUnit.getAttachment(Attachments.EXTENSION_INFORMATION); if (extensionInfo == null) { return; } // we need to remove the extension on undeploy final ServiceController<?> extensionIndexController = deploymentUnit.getServiceRegistry().getRequiredService( Services.JBOSS_DEPLOYMENT_EXTENSION_INDEX); final ExtensionIndex extensionIndexService = (ExtensionIndex) extensionIndexController.getValue(); final ModuleIdentifier moduleIdentifier = deploymentUnit.getAttachment(Attachments.MODULE_IDENTIFIER); extensionIndexService.removeDeployedExtension(extensionInfo.getName(), moduleIdentifier); } }