use of com.sun.enterprise.deployment.MethodPermission in project Payara by payara.
the class EjbDescriptor method print.
/**
* Returns a formatted String of the attributes of this object.
* @param toStringBuffer
*/
@Override
public void print(StringBuffer toStringBuffer) {
super.print(toStringBuffer);
toStringBuffer.append("\n homeClassName ").append(homeClassName);
toStringBuffer.append("\n remoteClassName ").append(remoteClassName);
toStringBuffer.append("\n remoteBusinessIntfs ").append(remoteBusinessClassNames).append("\n");
toStringBuffer.append("\n localhomeClassName ").append(localHomeClassName);
toStringBuffer.append("\n localClassName ").append(localClassName);
toStringBuffer.append("\n localBusinessIntfs ").append(localBusinessClassNames);
toStringBuffer.append("\n isLocalBean ").append(isLocalBean()).append("\n");
toStringBuffer.append("\n jndiName ").append(jndiName).append("\n");
toStringBuffer.append("\n ejbClassName ").append(ejbClassName);
toStringBuffer.append("\n transactionType ").append(transactionType);
toStringBuffer.append("\n methodContainerTransactions ").append(getMethodContainerTransactions());
toStringBuffer.append("\n environmentProperties ");
if (environmentProperties != null)
printDescriptorSet(environmentProperties, toStringBuffer);
toStringBuffer.append("\n ejbReferences ");
if (ejbReferences != null)
printDescriptorSet(ejbReferences, toStringBuffer);
toStringBuffer.append("\n resourceEnvReferences ");
if (resourceEnvReferences != null)
printDescriptorSet(resourceEnvReferences, toStringBuffer);
toStringBuffer.append("\n messageDestReferences ");
if (messageDestReferences != null)
printDescriptorSet(messageDestReferences, toStringBuffer);
toStringBuffer.append("\n resourceReferences ");
if (resourceReferences != null)
printDescriptorSet(resourceReferences, toStringBuffer);
toStringBuffer.append("\n serviceReferences ");
if (serviceReferences != null)
printDescriptorSet(serviceReferences, toStringBuffer);
toStringBuffer.append("\n roleReferences ");
if (roleReferences != null)
printDescriptorSet(roleReferences, toStringBuffer);
for (Iterator e = this.getPermissionedMethodsByPermission().keySet().iterator(); e.hasNext(); ) {
MethodPermission nextPermission = (MethodPermission) e.next();
toStringBuffer.append("\n method-permission->method: ");
nextPermission.print(toStringBuffer);
toStringBuffer.append(" -> ").append(this.getPermissionedMethodsByPermission().get(nextPermission));
}
}
use of com.sun.enterprise.deployment.MethodPermission in project Payara by payara.
the class EjbDescriptor method updateMethodPermissionForMethod.
/**
* Update a method descriptor set of method permission with a new method permission
* The new method permission is added to the list of existing method permissions
* given it respect the EJB 2.0 paragraph 21.3.2 on priorities of method permissions
*
* @param mp is the method permission to be added
* @param md is the method descriptor (style3 only) to add the method permission to
*/
private void updateMethodPermissionForMethod(MethodPermission mp, MethodDescriptor md) {
// Get the current set of method permissions for that method
Set oldPermissions = getMethodPermissions(md);
if (oldPermissions.isEmpty()) {
// this is easy, just add the new one
addMethodPermissionForMethod(mp, md);
return;
}
if (mp.isExcluded()) {
// remove all existing method permission...
for (Iterator oldPermissionsItr = oldPermissions.iterator(); oldPermissionsItr.hasNext(); ) {
MethodPermission oldMp = (MethodPermission) oldPermissionsItr.next();
removePermissionedMethod(oldMp, md);
}
// add the excluded
addMethodPermissionForMethod(mp, md);
} else {
if (mp.isUnchecked()) {
// particular method has an excluded method permision, we do not add it
for (Iterator oldPermissionsItr = oldPermissions.iterator(); oldPermissionsItr.hasNext(); ) {
MethodPermission oldMp = (MethodPermission) oldPermissionsItr.next();
if (!oldMp.isExcluded()) {
removePermissionedMethod(oldMp, md);
addMethodPermissionForMethod(mp, md);
}
}
} else {
// and add it to the current list of role based permission
for (Iterator oldPermissionsItr = oldPermissions.iterator(); oldPermissionsItr.hasNext(); ) {
MethodPermission oldMp = (MethodPermission) oldPermissionsItr.next();
if (!oldMp.isExcluded()) {
if (!oldMp.isUnchecked()) {
addMethodPermissionForMethod(mp, md);
}
}
}
}
}
}
use of com.sun.enterprise.deployment.MethodPermission in project Payara by payara.
the class EjbDescriptor method removeRole.
void removeRole(Role role) {
// this.getPermissionedRoles().remove(role);
this.getPermissionedMethodsByPermission().remove(new MethodPermission(role));
Set roleReferences = new HashSet(this.getRoleReferences());
for (Iterator itr = roleReferences.iterator(); itr.hasNext(); ) {
RoleReference roleReference = (RoleReference) itr.next();
if (roleReference.getRole().equals(role)) {
roleReference.setValue("");
}
}
}
use of com.sun.enterprise.deployment.MethodPermission in project Payara by payara.
the class EjbDescriptor method getMethodPermissions.
private Set getMethodPermissions(MethodDescriptor methodDescriptor) {
Set methodPermissionsForMethod = new HashSet();
for (Iterator e = this.getPermissionedMethodsByPermission().keySet().iterator(); e.hasNext(); ) {
MethodPermission nextPermission = (MethodPermission) e.next();
Set permissionedMethods = (Set) this.getPermissionedMethodsByPermission().get(nextPermission);
for (Iterator itr = permissionedMethods.iterator(); itr.hasNext(); ) {
MethodDescriptor md = (MethodDescriptor) itr.next();
if (md.equals(methodDescriptor)) {
methodPermissionsForMethod.add(nextPermission);
}
}
}
return methodPermissionsForMethod;
}
use of com.sun.enterprise.deployment.MethodPermission in project Payara by payara.
the class EjbDescriptor method getAllMethodDescriptors.
Set getAllMethodDescriptors() {
Set allMethodDescriptors = new HashSet();
for (Enumeration e = getMethodContainerTransactions().keys(); e.hasMoreElements(); ) {
allMethodDescriptors.add(e.nextElement());
}
for (Iterator e = this.getPermissionedMethodsByPermission().keySet().iterator(); e.hasNext(); ) {
MethodPermission nextPermission = (MethodPermission) e.next();
Set permissionedMethods = (Set) this.getPermissionedMethodsByPermission().get(nextPermission);
for (Iterator itr = permissionedMethods.iterator(); itr.hasNext(); ) {
allMethodDescriptors.add(itr.next());
}
}
return allMethodDescriptors;
}
Aggregations