use of org.apache.openejb.jee.Method$JAXB.readMethod in project tomee by apache.
the class EjbJarInfoBuilder method getMethodInfos.
private List<MethodInfo> getMethodInfos(final List<Method> ms, final Map ejbds) {
if (ms == null) {
return Collections.emptyList();
}
final List<MethodInfo> mi = new ArrayList<>(ms.size());
for (final Method method : ms) {
final MethodInfo methodInfo = getMethodInfo(method, ejbds);
mi.add(methodInfo);
}
return mi;
}
use of org.apache.openejb.jee.Method$JAXB.readMethod in project tomee by apache.
the class DebuggableVmHackery method deploy.
public AppModule deploy(final AppModule appModule) throws OpenEJBException {
for (final EjbModule ejbModule : appModule.getEjbModules()) {
final EjbJar ejbJar = ejbModule.getEjbJar();
final OpenejbJar openejbJar = ejbModule.getOpenejbJar();
final Map<String, EjbDeployment> deployments = openejbJar.getDeploymentsByEjbName();
ejbJar.setRelationships(null);
final List<String> removed = new ArrayList<String>();
for (final EnterpriseBean bean : ejbJar.getEnterpriseBeans()) {
final String ejbName = bean.getEjbName();
final EjbDeployment ejbDeployment = deployments.get(ejbName);
pruneRefs(bean, ejbDeployment);
// }
if (!(bean instanceof MessageDrivenBean) && !(bean instanceof EntityBean)) {
continue;
}
ejbJar.removeEnterpriseBean(ejbName);
openejbJar.removeEjbDeployment(ejbDeployment);
removed.add(ejbName);
final AssemblyDescriptor assemblyDescriptor = ejbJar.getAssemblyDescriptor();
if (assemblyDescriptor != null) {
for (final MethodPermission permission : copy(assemblyDescriptor.getMethodPermission())) {
for (final Method method : copy(permission.getMethod())) {
if (method.getEjbName().equals(ejbName)) {
permission.getMethod().remove(method);
}
}
if (permission.getMethod().size() == 0) {
assemblyDescriptor.getMethodPermission().remove(permission);
}
}
for (final ContainerTransaction transaction : copy(assemblyDescriptor.getContainerTransaction())) {
for (final Method method : copy(transaction.getMethod())) {
if (method.getEjbName().equals(ejbName)) {
transaction.getMethod().remove(method);
}
}
if (transaction.getMethod().size() == 0) {
assemblyDescriptor.getContainerTransaction().remove(transaction);
}
}
for (final InterceptorBinding binding : copy(assemblyDescriptor.getInterceptorBinding())) {
if (binding.getEjbName().equals(ejbName)) {
assemblyDescriptor.getInterceptorBinding().remove(binding);
}
}
}
}
// Drop any ejb ref to with an ejb-link to a removed ejb
for (final EnterpriseBean bean : ejbJar.getEnterpriseBeans()) {
bean.getEjbLocalRefMap().keySet().removeAll(removed);
bean.getEjbRefMap().keySet().removeAll(removed);
}
for (final Interceptor interceptor : ejbJar.getInterceptors()) {
pruneRefs(interceptor, new EjbDeployment());
}
}
return appModule;
}
use of org.apache.openejb.jee.Method$JAXB.readMethod in project tomee by apache.
the class EjbJarInfoBuilder method copyConcurrentMethods.
private void copyConcurrentMethods(final SessionBean bean, final EjbJarInfo ejbJarInfo, final Map ejbds) {
for (final ConcurrentMethod method : bean.getConcurrentMethod()) {
final MethodConcurrencyInfo info = new MethodConcurrencyInfo();
if (method.getLock() != null) {
info.concurrencyAttribute = method.getLock().toString();
}
info.accessTimeout = toInfo(method.getAccessTimeout());
final Method m = new Method(bean.getEjbName(), null, method.getMethod().getMethodName());
m.setMethodParams(method.getMethod().getMethodParams());
info.methods.add(getMethodInfo(m, ejbds));
ejbJarInfo.methodConcurrency.add(info);
}
}
use of org.apache.openejb.jee.Method$JAXB.readMethod in project tomee by apache.
the class CheckInvalidMethodPermissionsTest method test.
@Keys({ @Key("methodPermission.ejbNameRequired"), @Key("methodPermission.noSuchEjbName") })
public EjbJar test() throws Exception {
final EjbJar ejbJar = new EjbJar();
final MethodPermission permission = new MethodPermission(new Method((String) null, (String) null));
ejbJar.getAssemblyDescriptor().getMethodPermission().add(permission);
final MethodPermission permission1 = new MethodPermission(new Method("wrongEjbName", "wrongMethodName"));
ejbJar.getAssemblyDescriptor().getMethodPermission().add(permission1);
return ejbJar;
}
use of org.apache.openejb.jee.Method$JAXB.readMethod in project tomee by apache.
the class CheckInvalidTransactionAttributeTest method xml.
@Keys(@Key(value = "xml.invalidTransactionAttribute", type = KeyType.WARNING))
public EjbJar xml() throws SecurityException, NoSuchMethodException {
final EjbJar ejbJar = new EjbJar();
final StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(CheeseEjb.class));
bean.setTransactionType(TransactionType.BEAN);
final ContainerTransaction tx = new ContainerTransaction();
tx.getMethod().add(new Method(bean.getEjbName(), CheeseEjb.class.getMethod("sayCheesePlease", null)));
tx.setTransAttribute(TransAttribute.REQUIRED);
ejbJar.getAssemblyDescriptor().getContainerTransaction().add(tx);
return ejbJar;
}
Aggregations