public String getEJBName() { return this.getComponentName(); }
@Override public int hashCode() { int result = methodIntf.hashCode(); result = 31 * result + (hasJNDIBindings ? 1 : 0); result = 31 * result + getViewClassName().hashCode(); result = 31 * result + getComponentDescription().getComponentName().hashCode(); return result; }
@Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { final Method TO_STRING_METHOD; try { TO_STRING_METHOD = Object.class.getMethod("toString"); } catch (NoSuchMethodException nsme) { throw new DeploymentUnitProcessingException(nsme); } List<Method> methods = configuration.getProxyFactory().getCachedMethods(); for (Method method : methods) { if (TO_STRING_METHOD.equals(method)) { configuration.addClientInterceptor(method, new ImmediateInterceptorFactory(new ToStringMethodInterceptor(EJBComponentDescription.this.getComponentName())), InterceptorOrder.Client.TO_STRING); return; } } } });
@Override public void configure(final DeploymentPhaseContext context, final ComponentDescription description, final ComponentConfiguration configuration) throws DeploymentUnitProcessingException { final EJBComponentDescription ejbComponentDescription = (EJBComponentDescription) description; final ServiceName nonFunctionalTimerServiceName = NonFunctionalTimerService.serviceNameFor(ejbComponentDescription); final NonFunctionalTimerService nonFunctionalTimerService; if (ejbComponentDescription instanceof StatefulComponentDescription) { // for stateful beans, use a different error message that gets thrown from the NonFunctionalTimerService nonFunctionalTimerService = new NonFunctionalTimerService(EjbLogger.ROOT_LOGGER.timerServiceMethodNotAllowedForSFSB(ejbComponentDescription.getComponentName()), timerServiceRegistry); } else { nonFunctionalTimerService = new NonFunctionalTimerService(EjbLogger.ROOT_LOGGER.ejbHasNoTimerMethods(), timerServiceRegistry); } // add the non-functional timer service as a MSC service context.getServiceTarget().addService(nonFunctionalTimerServiceName, nonFunctionalTimerService).install(); // set the timer service in the EJB component ejbComponentDescription.setTimerService(nonFunctionalTimerService); // now we want the EJB component to depend on this non-functional timer service to start configuration.getStartDependencies().add(new DependencyConfigurator<ComponentStartService>() { @Override public void configureDependency(ServiceBuilder<?> serviceBuilder, ComponentStartService service) throws DeploymentUnitProcessingException { serviceBuilder.requires(nonFunctionalTimerServiceName); } }); } });
private void registerRemoteBinding(final EJBComponentDescription componentDescription, final ViewDescription viewDescription, final String jndiName) { final EEModuleDescription moduleDescription = componentDescription.getModuleDescription(); final InjectedValue<ClassLoader> viewClassLoader = new InjectedValue<ClassLoader>(); moduleDescription.getBindingConfigurations().add(new BindingConfiguration(jndiName, new RemoteViewInjectionSource(null, moduleDescription.getEarApplicationName(), moduleDescription.getModuleName(), moduleDescription.getDistinctName(), componentDescription.getComponentName(), viewDescription.getViewClassName(), componentDescription.isStateful(), viewClassLoader, appclient))); componentDescription.getConfigurators().add(new ComponentConfigurator() { public void configure(DeploymentPhaseContext context, ComponentDescription description, ComponentConfiguration configuration) throws DeploymentUnitProcessingException { viewClassLoader.setValue(Values.immediateValue(configuration.getModuleClassLoader())); } }); } private void registerControlPointBinding(final EJBComponentDescription componentDescription, final ViewDescription viewDescription, final String jndiName, final DeploymentUnit deploymentUnit) {
@Override protected void handleDeploymentDescriptor(final DeploymentUnit deploymentUnit, final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> componentClass, final EJBComponentDescription description) throws DeploymentUnitProcessingException { String securityDomain = getJBossAppSecurityDomain(deploymentUnit); String globalSecurityDomain = null; final EjbJarMetaData ejbJarMetaData = deploymentUnit.getAttachment(EjbDeploymentAttachmentKeys.EJB_JAR_METADATA); if (ejbJarMetaData != null) { final AssemblyDescriptorMetaData assemblyMetadata = ejbJarMetaData.getAssemblyDescriptor(); if (assemblyMetadata != null) { final List<EJBBoundSecurityMetaData> securityMetaDatas = assemblyMetadata.getAny(EJBBoundSecurityMetaData.class); if (securityMetaDatas != null) { for (final EJBBoundSecurityMetaData securityMetaData : securityMetaDatas) { if (securityMetaData.getEjbName().equals(description.getComponentName())) { securityDomain = securityMetaData.getSecurityDomain(); break; } // check global security domain if (securityMetaData.getEjbName().equals("*")) { globalSecurityDomain = securityMetaData.getSecurityDomain(); continue; } } } } } if (securityDomain != null) description.setSecurityDomain(securityDomain); else if (globalSecurityDomain != null) description.setSecurityDomain(globalSecurityDomain); }
if (securityMetaDatas != null) { for (final EJBBoundSecurityMetaData securityMetaData : securityMetaDatas) { if (securityMetaData.getEjbName().equals(description.getComponentName())) { missingMethodPermissionsDenyAccess = securityMetaData.getMissingMethodPermissionsDenyAccess(); break;
@Override protected InjectionSource createInjectionSource(final ServiceName serviceName, Value<ClassLoader> viewClassLoader, boolean appclient) { if(methodIntf != MethodIntf.REMOTE && methodIntf != MethodIntf.HOME) { return super.createInjectionSource(serviceName, viewClassLoader, appclient); } else { final EJBComponentDescription componentDescription = getComponentDescription(); final EEModuleDescription desc = componentDescription.getModuleDescription(); final String earApplicationName = desc.getEarApplicationName(); return new RemoteViewInjectionSource(serviceName, earApplicationName, desc.getModuleName(), desc.getDistinctName(), componentDescription.getComponentName(), getViewClassName() , componentDescription.isStateful(),viewClassLoader, appclient); } }
remoteFactory = new RemoteViewManagedReferenceFactory(earApplicationName, moduleDescription.getModuleName(), moduleDescription.getDistinctName(), componentDescription.getComponentName(), description.getViewClassName(), componentDescription.isStateful(), viewClassLoader, appclient);
throw EjbLogger.ROOT_LOGGER.failToLoadComponentClass(e, ejbComponentDescription.getComponentClassName()); final List<InterceptorBindingMetaData> bindingsApplicableForCurrentEJB = bindingsPerEJB.get(ejbComponentDescription.getComponentName()); final Map<Method, List<InterceptorBindingMetaData>> methodInterceptors = new HashMap<Method, List<InterceptorBindingMetaData>>(); final List<InterceptorBindingMetaData> classLevelBindings = new ArrayList<InterceptorBindingMetaData>();
final InjectedValue<ClassLoader> viewClassLoader = new InjectedValue<ClassLoader>(); final InjectedValue<ControlPoint> controlPointInjectedValue = new InjectedValue<>(); final RemoteViewInjectionSource delegate = new RemoteViewInjectionSource(null, moduleDescription.getEarApplicationName(), moduleDescription.getModuleName(), moduleDescription.getDistinctName(), componentDescription.getComponentName(), viewDescription.getViewClassName(), componentDescription.isStateful(), viewClassLoader, appclient); final ServiceName depName = ControlPointService.serviceName(deploymentUnit.getParent() == null ? deploymentUnit.getName() : deploymentUnit.getParent().getName(), EJBComponentSuspendDeploymentUnitProcessor.ENTRY_POINT_NAME + deploymentUnit.getName() + "." + componentDescription.getComponentName()); componentDescription.getConfigurators().add((context, description, configuration) -> { viewClassLoader.setValue(Values.immediateValue(configuration.getModuleClassLoader()));
if (securityMetaDatas != null) { for (EJBBoundSecurityMetaData securityMetaData : securityMetaDatas) { if (securityMetaData.getEjbName().equals(componentConfiguration.getComponentName())) { principal = securityMetaData.getRunAsPrincipal(); break;
throw EjbLogger.ROOT_LOGGER.failedToAnalyzeRemoteInterface(e, componentDescription.getComponentName()); throw EjbLogger.ROOT_LOGGER.failedToAnalyzeRemoteInterface(e, componentDescription.getComponentName());
public String getEJBName() { return this.getComponentName(); }
@Override public int hashCode() { int result = methodIntf.hashCode(); result = 31 * result + (hasJNDIBindings ? 1 : 0); result = 31 * result + getViewClassName().hashCode(); result = 31 * result + getComponentDescription().getComponentName().hashCode(); return result; }
private void validateAndMarkBeanAsClustered(final EJBComponentDescription ejbComponentDescription, final ClusteringInfo clusteringInfo, final DeploymentUnit deploymentUnit) throws DeploymentUnitProcessingException { // https://issues.jboss.org/browse/AS7-2887 Disallow @Clustered on certain EJB types if (ejbComponentDescription instanceof MessageDrivenComponentDescription) { throw EjbMessages.MESSAGES.clusteredAnnotationIsNotApplicableForMDB(deploymentUnit, ejbComponentDescription.getComponentName(), ejbComponentDescription.getComponentClassName()); } if (ejbComponentDescription instanceof EntityBeanComponentDescription) { throw EjbMessages.MESSAGES.clusteredAnnotationIsNotApplicableForEntityBean(deploymentUnit, ejbComponentDescription.getComponentName(), ejbComponentDescription.getComponentClassName()); } if (ejbComponentDescription instanceof SingletonComponentDescription) { throw EjbMessages.MESSAGES.clusteredAnnotationNotYetImplementedForSingletonBean(deploymentUnit, ejbComponentDescription.getComponentName(), ejbComponentDescription.getComponentClassName()); } // make sure it's a session bean if (!(ejbComponentDescription instanceof SessionBeanComponentDescription)) { throw EjbMessages.MESSAGES.clusteredAnnotationIsNotApplicableForBean(deploymentUnit, ejbComponentDescription.getComponentName(), ejbComponentDescription.getComponentClassName()); } // mark the bean as clustered ((SessionBeanComponentDescription) ejbComponentDescription).setClustering(clusteringInfo); } }
@Override public void configure(DeploymentPhaseContext context, ComponentConfiguration componentConfiguration, ViewDescription description, ViewConfiguration configuration) throws DeploymentUnitProcessingException { final Method TO_STRING_METHOD; try { TO_STRING_METHOD = Object.class.getMethod("toString"); } catch (NoSuchMethodException nsme) { throw new DeploymentUnitProcessingException(nsme); } List<Method> methods = configuration.getProxyFactory().getCachedMethods(); for (Method method : methods) { if (TO_STRING_METHOD.equals(method)) { configuration.addClientInterceptor(method, new ImmediateInterceptorFactory(new ToStringMethodInterceptor(EJBComponentDescription.this.getComponentName())), InterceptorOrder.Client.TO_STRING); return; } } } });
private void registerRemoteBinding(final EJBComponentDescription componentDescription, final ViewDescription viewDescription, final String jndiName) { final EEModuleDescription moduleDescription = componentDescription.getModuleDescription(); final InjectedValue<ClassLoader> viewClassLoader = new InjectedValue<ClassLoader>(); moduleDescription.getBindingConfigurations().add(new BindingConfiguration(jndiName, new RemoteViewInjectionSource(null, moduleDescription.getEarApplicationName(), moduleDescription.getModuleName(), moduleDescription.getDistinctName(), componentDescription.getComponentName(), viewDescription.getViewClassName(), componentDescription.isStateful(), viewClassLoader))); componentDescription.getConfigurators().add(new ComponentConfigurator() { public void configure(DeploymentPhaseContext context, ComponentDescription description, ComponentConfiguration configuration) throws DeploymentUnitProcessingException { viewClassLoader.setValue(Values.immediateValue(configuration.getModuleClassLoader())); } }); }
if (securityMetaDatas != null) { for (final EJBBoundSecurityMetaData securityMetaData : securityMetaDatas) { if (securityMetaData.getEjbName().equals(description.getComponentName())) { missingMethodPermissionsDenyAccess = securityMetaData.getMissingMethodPermissionsDenyAccess(); break;
@Override protected InjectionSource createInjectionSource(final ServiceName serviceName, Value<ClassLoader> viewClassLoader) { if(methodIntf != MethodIntf.REMOTE && methodIntf != MethodIntf.HOME) { return super.createInjectionSource(serviceName, viewClassLoader); } else { final EJBComponentDescription componentDescription = getComponentDescription(); final EEModuleDescription desc = componentDescription.getModuleDescription(); final String earApplicationName = desc.getEarApplicationName(); return new RemoteViewInjectionSource(serviceName, earApplicationName, desc.getModuleName(), desc.getDistinctName(), componentDescription.getComponentName(), getViewClassName() , componentDescription.isStateful(),viewClassLoader); } }