Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* JBoss, Home of Professional Open Source.
* Copyright 2010, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.as.ejb3.component;
import static java.security.AccessController.doPrivileged;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.Policy;
import java.security.Principal;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
import java.security.ProtectionDomain;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import javax.ejb.EJBHome;
import javax.ejb.EJBLocalHome;
import javax.ejb.TimerService;
import javax.ejb.TransactionAttributeType;
import javax.ejb.TransactionManagementType;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.security.jacc.EJBRoleRefPermission;
import javax.transaction.Status;
import javax.transaction.SystemException;
import javax.transaction.TransactionManager;
import javax.transaction.TransactionSynchronizationRegistry;
import javax.transaction.UserTransaction;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import org.jboss.as.core.security.ServerSecurityManager;
import org.jboss.as.ee.component.BasicComponent;
import org.jboss.as.ee.component.ComponentView;
import org.jboss.as.ejb3.component.allowedmethods.AllowedMethodsInformation;
import org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory;
import org.jboss.as.ejb3.component.invocationmetrics.InvocationMetrics;
import org.jboss.as.ejb3.context.CurrentInvocationContext;
import org.jboss.as.ejb3.logging.EjbLogger;
import org.jboss.as.ejb3.security.EJBSecurityMetaData;
import org.jboss.as.ejb3.security.JaccInterceptor;
import org.jboss.as.ejb3.suspend.EJBSuspendHandlerService;
import org.jboss.as.ejb3.timerservice.TimerServiceImpl;
import org.jboss.as.ejb3.tx.ApplicationExceptionDetails;
import org.jboss.as.naming.ManagedReference;
import org.jboss.as.naming.context.NamespaceContextSelector;
import org.jboss.as.server.CurrentServiceContainer;
import org.jboss.as.server.suspend.ServerActivityCallback;
import org.jboss.ejb.client.Affinity;
import org.jboss.ejb.client.EJBClient;
import org.jboss.ejb.client.EJBHomeLocator;
import org.jboss.invocation.InterceptorContext;
import org.jboss.invocation.InterceptorFactory;
import org.jboss.invocation.proxy.MethodIdentifier;
import org.jboss.msc.service.ServiceContainer;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceName;
import org.wildfly.extension.requestcontroller.ControlPoint;
import org.wildfly.security.auth.server.SecurityDomain;
import org.wildfly.security.auth.server.SecurityIdentity;
import org.wildfly.security.authz.Roles;
import org.wildfly.security.manager.WildFlySecurityManager;
import org.wildfly.transaction.client.ContextTransactionManager;
import org.wildfly.transaction.client.ContextTransactionSynchronizationRegistry;
/**
* @author Carlo de Wolf
*/
public abstract class EJBComponent extends BasicComponent implements ServerActivityCallback {
private static final ApplicationExceptionDetails APPLICATION_EXCEPTION = new ApplicationExceptionDetails("java.lang.Exception", true, false);
private final Map txAttrs;
private final Map txTimeouts;
private final Map txExplicitAttrs;
private final EJBUtilities utilities;
private final boolean isBeanManagedTransaction;
private final Map, ApplicationExceptionDetails> applicationExceptions;
private final EJBSecurityMetaData securityMetaData;
private final Map viewServices;
private final ServiceName ejbLocalHomeViewServiceName;
private final ServiceName ejbHomeViewServiceName;
private final ServiceName ejbObjectViewServiceName;
private final ServiceName ejbLocalObjectViewServiceName;
private final TimerService timerService;
private final Map timeoutInterceptors;
private final Method timeoutMethod;
private final String applicationName;
private final String earApplicationName;
private final String moduleName;
private final String distinctName;
private final String policyContextID;
private final InvocationMetrics invocationMetrics = new InvocationMetrics();
private final EJBSuspendHandlerService ejbSuspendHandlerService;
private final ShutDownInterceptorFactory shutDownInterceptorFactory;
private final UserTransaction userTransaction;
private final ServerSecurityManager serverSecurityManager;
private final ControlPoint controlPoint;
private final AtomicBoolean exceptionLoggingEnabled;
private final PrivilegedAction getCaller = new PrivilegedAction() {
@Override
public Principal run() {
return serverSecurityManager.getCallerPrincipal();
}
};
private final SecurityDomain securityDomain;
private final boolean enableJacc;
private SecurityIdentity incomingRunAsIdentity;
private final Function> identityOutflowFunction;
private final boolean securityRequired;
/**
* Construct a new instance.
*
* @param ejbComponentCreateService the component configuration
*/
protected EJBComponent(final EJBComponentCreateService ejbComponentCreateService) {
super(ejbComponentCreateService);
this.applicationExceptions = Collections.unmodifiableMap(ejbComponentCreateService.getApplicationExceptions().getApplicationExceptions());
this.utilities = ejbComponentCreateService.getEJBUtilities();
final Map txAttrs = ejbComponentCreateService.getTxAttrs();
if (txAttrs == null || txAttrs.isEmpty()) {
this.txAttrs = Collections.emptyMap();
this.txExplicitAttrs = Collections.emptyMap();
} else {
this.txAttrs = txAttrs;
this.txExplicitAttrs = ejbComponentCreateService.getExplicitTxAttrs();
}
final Map txTimeouts = ejbComponentCreateService.getTxTimeouts();
if (txTimeouts == null || txTimeouts.isEmpty()) {
this.txTimeouts = Collections.emptyMap();
} else {
this.txTimeouts = txTimeouts;
}
isBeanManagedTransaction = TransactionManagementType.BEAN.equals(ejbComponentCreateService.getTransactionManagementType());
// security metadata
this.securityMetaData = ejbComponentCreateService.getSecurityMetaData();
this.viewServices = ejbComponentCreateService.getViewServices();
this.timerService = ejbComponentCreateService.getTimerService();
this.timeoutMethod = ejbComponentCreateService.getTimeoutMethod();
this.ejbLocalHomeViewServiceName = ejbComponentCreateService.getEjbLocalHome();
this.ejbHomeViewServiceName = ejbComponentCreateService.getEjbHome();
this.applicationName = ejbComponentCreateService.getApplicationName();
this.earApplicationName = ejbComponentCreateService.getEarApplicationName();
this.distinctName = ejbComponentCreateService.getDistinctName();
this.policyContextID = ejbComponentCreateService.getPolicyContextID();
this.moduleName = ejbComponentCreateService.getModuleName();
this.ejbObjectViewServiceName = ejbComponentCreateService.getEjbObject();
this.ejbLocalObjectViewServiceName = ejbComponentCreateService.getEjbLocalObject();
this.timeoutInterceptors = Collections.unmodifiableMap(ejbComponentCreateService.getTimeoutInterceptors());
this.shutDownInterceptorFactory = ejbComponentCreateService.getShutDownInterceptorFactory();
this.ejbSuspendHandlerService = ejbComponentCreateService.getEJBSuspendHandler();
this.userTransaction = ejbComponentCreateService.getUserTransaction();
this.serverSecurityManager = ejbComponentCreateService.getServerSecurityManager();
this.controlPoint = ejbComponentCreateService.getControlPoint();
this.exceptionLoggingEnabled = ejbComponentCreateService.getExceptionLoggingEnabled();
this.securityDomain = ejbComponentCreateService.getSecurityDomain();
this.enableJacc = ejbComponentCreateService.isEnableJacc();
this.incomingRunAsIdentity = null;
this.identityOutflowFunction = ejbComponentCreateService.getIdentityOutflowFunction();
this.securityRequired = ejbComponentCreateService.isSecurityRequired();
}
protected T createViewInstanceProxy(final Class viewInterface, final Map