use of com.sun.enterprise.deployment.annotation.context.EjbContext in project Payara by payara.
the class DeclareRolesHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
DeclareRoles rolesRefAn = (DeclareRoles) ainfo.getAnnotation();
for (EjbContext ejbContext : ejbContexts) {
EjbDescriptor ejbDescriptor = ejbContext.getDescriptor();
for (String roleName : rolesRefAn.value()) {
if (ejbDescriptor.getRoleReferenceByName(roleName) == null) {
RoleReference roleRef = new RoleReference(roleName, "");
roleRef.setRoleName(roleName);
roleRef.setSecurityRoleLink(new SecurityRoleDescriptor(roleName, ""));
ejbDescriptor.addRoleReference(roleRef);
}
Role role = new Role(roleName);
ejbDescriptor.getEjbBundleDescriptor().addRole(role);
}
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.annotation.context.EjbContext in project Payara by payara.
the class RunAsHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
RunAs runAsAn = (RunAs) ainfo.getAnnotation();
for (EjbContext ejbContext : ejbContexts) {
EjbDescriptor ejbDesc = ejbContext.getDescriptor();
// override by xml
if (ejbDesc.getUsesCallerIdentity() != null) {
continue;
}
String roleName = runAsAn.value();
Role role = new Role(roleName);
// add Role if not exists
ejbDesc.getEjbBundleDescriptor().addRole(role);
RunAsIdentityDescriptor runAsDesc = new RunAsIdentityDescriptor();
runAsDesc.setRoleName(roleName);
ejbDesc.setUsesCallerIdentity(false);
if (ejbDesc.getRunAsIdentity() == null) {
ejbDesc.setRunAsIdentity(runAsDesc);
}
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.annotation.context.EjbContext in project Payara by payara.
the class DeclareRolesHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
DeclareRoles rolesRefAn = (DeclareRoles) ainfo.getAnnotation();
for (EjbContext ejbContext : ejbContexts) {
EjbDescriptor ejbDescriptor = ejbContext.getDescriptor();
for (String roleName : rolesRefAn.value()) {
if (ejbDescriptor.getRoleReferenceByName(roleName) == null) {
RoleReference roleRef = new RoleReference(roleName, "");
roleRef.setRolename(roleName);
roleRef.setSecurityRoleLink(new SecurityRoleDescriptor(roleName, ""));
ejbDescriptor.addRoleReference(roleRef);
}
Role role = new Role(roleName);
ejbDescriptor.getEjbBundleDescriptor().addRole(role);
}
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.annotation.context.EjbContext in project Payara by payara.
the class RunAsHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
RunAs runAsAn = (RunAs) ainfo.getAnnotation();
for (EjbContext ejbContext : ejbContexts) {
EjbDescriptor ejbDesc = ejbContext.getDescriptor();
// override by xml
if (ejbDesc.getUsesCallerIdentity() != null) {
continue;
}
String roleName = runAsAn.value();
Role role = new Role(roleName);
// add Role if not exists
ejbDesc.getEjbBundleDescriptor().addRole(role);
RunAsIdentityDescriptor runAsDesc = new RunAsIdentityDescriptor();
runAsDesc.setRoleName(roleName);
ejbDesc.setUsesCallerIdentity(false);
if (ejbDesc.getRunAsIdentity() == null) {
ejbDesc.setRunAsIdentity(runAsDesc);
}
}
return getDefaultProcessedResult();
}
use of com.sun.enterprise.deployment.annotation.context.EjbContext in project Payara by payara.
the class AroundInvokeHandler method processAnnotation.
protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo, EjbContext[] ejbContexts) throws AnnotationProcessorException {
for (EjbContext next : ejbContexts) {
EjbDescriptor ejbDescriptor = (EjbDescriptor) next.getDescriptor();
ejbDescriptor.addAroundInvokeDescriptor(getAroundInvocationDescriptor(ainfo));
}
return getDefaultProcessedResult();
}
Aggregations