if (module != null && servicesAttachment != null) { final ModuleClassLoader classLoader = module.getClassLoader(); final List<String> driverNames = servicesAttachment.getServiceImplementations(Driver.class.getName()); for (String driverClassName : driverNames) { try {
/** * {@inheritDoc} */ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final Map<String, List<String>> foundServices = new HashMap<String, List<String>>(); final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (deploymentRoot != null) { processRoot(deploymentRoot, foundServices); } final List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : resourceRoots) { if (!SubDeploymentMarker.isSubDeployment(resourceRoot) && ModuleRootMarker.isModuleRoot(resourceRoot)) processRoot(resourceRoot, foundServices); } deploymentUnit.putAttachment(Attachments.SERVICES, new ServicesAttachment(foundServices)); }
/** * {@inheritDoc} */ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final Map<String, List<String>> foundServices = new HashMap<String, List<String>>(); final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (deploymentRoot != null) { processRoot(deploymentRoot, foundServices); } final List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : resourceRoots) { if (!SubDeploymentMarker.isSubDeployment(resourceRoot) && ModuleRootMarker.isModuleRoot(resourceRoot)) processRoot(resourceRoot, foundServices); } deploymentUnit.putAttachment(Attachments.SERVICES, new ServicesAttachment(foundServices)); }
private boolean hasExtension(ServicesAttachment servicesAttachment, Class<?> extensionClass) { return !servicesAttachment.getServiceImplementations(extensionClass.getName()).isEmpty(); }
/** * {@inheritDoc} */ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final Map<String, List<String>> foundServices = new HashMap<String, List<String>>(); final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (deploymentRoot != null) { processRoot(deploymentRoot, foundServices); } final List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : resourceRoots) { if (!SubDeploymentMarker.isSubDeployment(resourceRoot) && ModuleRootMarker.isModuleRoot(resourceRoot)) processRoot(resourceRoot, foundServices); } deploymentUnit.putAttachment(Attachments.SERVICES, new ServicesAttachment(foundServices)); }
private boolean hasInfinispanExtensions(DeploymentUnit deploymentUnit) { ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES); if (servicesAttachment != null) { List<String> filterFactories = servicesAttachment.getServiceImplementations(CacheEventFilterFactory.class.getName()); List<String> converterFactories = servicesAttachment.getServiceImplementations(CacheEventConverterFactory.class.getName()); List<String> filterConverterFactories = servicesAttachment.getServiceImplementations(CacheEventFilterConverterFactory.class.getName()); List<String> marshallers = servicesAttachment.getServiceImplementations(Marshaller.class.getName()); List<String> keyValueFilterConverterFactories = servicesAttachment.getServiceImplementations(KeyValueFilterConverterFactory.class.getName()); return !filterFactories.isEmpty() || !marshallers.isEmpty() || !converterFactories.isEmpty() || !filterConverterFactories.isEmpty() || !keyValueFilterConverterFactories.isEmpty(); } return false; }
/** * {@inheritDoc} */ public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final Map<String, List<String>> foundServices = new HashMap<String, List<String>>(); final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ResourceRoot deploymentRoot = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT); if (deploymentRoot != null) { processRoot(deploymentRoot, foundServices); } final List<ResourceRoot> resourceRoots = deploymentUnit.getAttachmentList(Attachments.RESOURCE_ROOTS); for (ResourceRoot resourceRoot : resourceRoots) { if (!SubDeploymentMarker.isSubDeployment(resourceRoot) && ModuleRootMarker.isModuleRoot(resourceRoot)) processRoot(resourceRoot, foundServices); } deploymentUnit.putAttachment(Attachments.SERVICES, new ServicesAttachment(foundServices)); }
private void addServices(DeploymentPhaseContext ctx, ServicesAttachment servicesAttachment, Module module) { List<String> implementationNames = servicesAttachment.getServiceImplementations(ServerTask.class.getName()); ModuleClassLoader classLoader = module.getClassLoader(); for (String serviceClassName : implementationNames) { try { Class<? extends ServerTask> clazz = classLoader.loadClass(serviceClassName).asSubclass(ServerTask.class); Constructor<? extends ServerTask> ctor = clazz.getConstructor(); ServerTask instance = ctor.newInstance(); installService(ctx, serviceClassName, instance); } catch (Exception e) { throw InfinispanMessages.MESSAGES.unableToInstantiateClass(serviceClassName); } } }
private void addServices(DeploymentPhaseContext ctx, ServicesAttachment servicesAttachment, Module module) { Class<T> serviceClass = getServiceClass(); List<String> services = servicesAttachment.getServiceImplementations(serviceClass.getName()); ModuleClassLoader classLoader = module.getClassLoader(); for (String serviceName : services) { try { Class<? extends T> clazz = classLoader.loadClass(serviceName).asSubclass(serviceClass); Constructor<? extends T> ctor = clazz.getConstructor(); T instance = ctor.newInstance(); installService(ctx, serviceName, instance); } catch (Exception e) { ROOT_LOGGER.cannotInstantiateClass(serviceName, e); } } }
private void addServices(DeploymentPhaseContext ctx, ServicesAttachment servicesAttachment, Module module) { Class<T> serviceClass = getServiceClass(); List<String> implementationNames = servicesAttachment.getServiceImplementations(serviceClass.getName()); ModuleClassLoader classLoader = module.getClassLoader(); for (String serviceClassName : implementationNames) { try { Class<? extends T> clazz = classLoader.loadClass(serviceClassName).asSubclass(serviceClass); Constructor<? extends T> ctor = clazz.getConstructor(); T instance = ctor.newInstance(); installService(ctx, serviceClassName, instance); } catch (Exception e) { InfinispanMessages.MESSAGES.unableToInstantiateClass(serviceClassName); } } }
/** * Add the dependencies if the deployment contains a service activator loader entry. * @param phaseContext the deployment unit context * @throws DeploymentUnitProcessingException */ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final ResourceRoot deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT); final ModuleSpecification moduleSpecification = phaseContext.getDeploymentUnit().getAttachment( Attachments.MODULE_SPECIFICATION); if(deploymentRoot == null) return; final ServicesAttachment servicesAttachments = phaseContext.getDeploymentUnit().getAttachment(Attachments.SERVICES); if(servicesAttachments != null && !servicesAttachments.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) { moduleSpecification.addSystemDependency(MSC_DEP); } }
/** * Add the dependencies if the deployment contains a service activator loader entry. * @param phaseContext the deployment unit context * @throws DeploymentUnitProcessingException */ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final ResourceRoot deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT); final ModuleSpecification moduleSpecification = phaseContext.getDeploymentUnit().getAttachment( Attachments.MODULE_SPECIFICATION); if(deploymentRoot == null) return; final ServicesAttachment servicesAttachments = phaseContext.getDeploymentUnit().getAttachment(Attachments.SERVICES); if(servicesAttachments != null && !servicesAttachments.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) { moduleSpecification.addSystemDependency(MSC_DEP); } }
/** * Add the dependencies if the deployment contains a service activator loader entry. * @param phaseContext the deployment unit context * @throws DeploymentUnitProcessingException */ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final ResourceRoot deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT); final ModuleSpecification moduleSpecification = phaseContext.getDeploymentUnit().getAttachment( Attachments.MODULE_SPECIFICATION); if(deploymentRoot == null) return; final ServicesAttachment servicesAttachments = phaseContext.getDeploymentUnit().getAttachment(Attachments.SERVICES); if(servicesAttachments != null && !servicesAttachments.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) { moduleSpecification.addSystemDependency(MSC_DEP); } }
/** * Add the dependencies if the deployment contains a service activator loader entry. * @param phaseContext the deployment unit context * @throws DeploymentUnitProcessingException */ public void deploy(DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final ResourceRoot deploymentRoot = phaseContext.getDeploymentUnit().getAttachment(Attachments.DEPLOYMENT_ROOT); final ModuleSpecification moduleSpecification = phaseContext.getDeploymentUnit().getAttachment( Attachments.MODULE_SPECIFICATION); if(deploymentRoot == null) return; final ServicesAttachment servicesAttachments = phaseContext.getDeploymentUnit().getAttachment(Attachments.SERVICES); if(servicesAttachments != null && !servicesAttachments.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) { moduleSpecification.addSystemDependency(MSC_DEP); } }
if (module != null && servicesAttachment != null) { final ModuleClassLoader classLoader = module.getClassLoader(); final List<String> driverNames = servicesAttachment.getServiceImplementations(Driver.class.getName()); for (String driverClassName : driverNames) { try {
if (module != null && servicesAttachment != null) { final ModuleClassLoader classLoader = module.getClassLoader(); final List<String> driverNames = servicesAttachment.getServiceImplementations(Driver.class.getName()); for (String driverClassName : driverNames) { try {
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES); if (servicesAttachment == null || servicesAttachment.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) { return; // Skip it if it has not been marked for (DeploymentUnit du : duList) { ServicesAttachment duServicesAttachment = du.getAttachment(Attachments.SERVICES); for (String serv : duServicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) { serviceAcitvatorList.add(serv); for (ServiceActivator serviceActivator : module.loadService(ServiceActivator.class)) { try { for (String serv : servicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) { if (serv.compareTo(serviceActivator.getClass().getName()) == 0 && !serviceAcitvatorList.contains(serv)) { serviceActivator.activate(serviceActivatorContext);
@Override public void deploy(DeploymentPhaseContext ctx) { DeploymentUnit deploymentUnit = ctx.getDeploymentUnit(); Module module = deploymentUnit.getAttachment(Attachments.MODULE); ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES); if (module != null && servicesAttachment != null) { List<String> implementationNames = servicesAttachment.getServiceImplementations(EntryMergePolicy.class.getName()); ModuleClassLoader classLoader = module.getClassLoader(); for (String serviceClassName : implementationNames) { try { ServiceController sc = ctx.getServiceRegistry().getRequiredService(DeployedMergePolicyFactoryService.SERVICE_NAME); DeployedMergePolicyFactory factory = DeployedMergePolicyFactory.class.cast(sc.getValue()); Class<? extends EntryMergePolicy> clazz = classLoader.loadClass(serviceClassName).asSubclass(EntryMergePolicy.class); Constructor<? extends EntryMergePolicy> ctor = clazz.getConstructor(); factory.addDeployedPolicy(new DeployedMergePolicy(ctor.newInstance())); } catch (Exception e) { throw InfinispanMessages.MESSAGES.unableToInstantiateClass(serviceClassName); } } } }
final DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit(); final ServicesAttachment servicesAttachment = deploymentUnit.getAttachment(Attachments.SERVICES); if (servicesAttachment == null || servicesAttachment.getServiceImplementations(ServiceActivator.class.getName()).isEmpty()) { return; // Skip it if it has not been marked for (DeploymentUnit du : duList) { ServicesAttachment duServicesAttachment = du.getAttachment(Attachments.SERVICES); for (String serv : duServicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) { serviceAcitvatorList.add(serv); for (ServiceActivator serviceActivator : module.loadService(ServiceActivator.class)) { try { for (String serv : servicesAttachment.getServiceImplementations(ServiceActivator.class.getName())) { if (serv.compareTo(serviceActivator.getClass().getName()) == 0 && !serviceAcitvatorList.contains(serv)) { serviceActivator.activate(serviceActivatorContext);
private void loadAttachments(final ServicesAttachment servicesAttachment, Module module, DeploymentUnit deploymentUnit, DeploymentUnit topLevelDeployment) throws DeploymentUnitProcessingException { // now load extensions final DeploymentReflectionIndex index = deploymentUnit.getAttachment(Attachments.REFLECTION_INDEX); final List<String> services = servicesAttachment.getServiceImplementations(Extension.class.getName()); if (services == null) { return; } for (String service : services) { final Extension extension = loadExtension(service, index, module.getClassLoader()); if(extension == null) { continue; } Metadata<Extension> metadata = new MetadataImpl<Extension>(extension, deploymentUnit.getName()); WeldLogger.DEPLOYMENT_LOGGER.debug("Loaded portable extension " + extension); topLevelDeployment.addToAttachmentList(WeldAttachments.PORTABLE_EXTENSIONS, metadata); } }