use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class EjbDescriptor method setMethodContainerTransactions.
/**
* Sets the container transactions for all the method descriptors of this ejb. The Hashtable is keyed
* by method descriptor and the values are the corresponding container transaction objects..
* Throws an Illegal argument if this ejb has transaction type BEAN_TRANSACTION_TYPE.
* @param methodContainerTransactions
*/
public void setMethodContainerTransactions(Hashtable methodContainerTransactions) {
if (methodContainerTransactions != null) {
for (Enumeration e = methodContainerTransactions.keys(); e.hasMoreElements(); ) {
MethodDescriptor methodDescriptor = (MethodDescriptor) e.nextElement();
ContainerTransaction containerTransaction = (ContainerTransaction) methodContainerTransactions.get(methodDescriptor);
setContainerTransactionFor(methodDescriptor, containerTransaction);
}
}
}
use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class EjbDescriptor method convertMethodContainerTransactionsOfStyle.
private void convertMethodContainerTransactionsOfStyle(int requestedStyleForConversion, Hashtable convertedMethods) {
Collection transactionMethods = this.getTransactionMethodDescriptors();
Hashtable transactions = this.getMethodContainerTransactions();
for (Enumeration e = transactions.keys(); e.hasMoreElements(); ) {
MethodDescriptor md = (MethodDescriptor) e.nextElement();
if (md.getStyle() == requestedStyleForConversion) {
ContainerTransaction ct = (ContainerTransaction) getMethodContainerTransactions().get(md);
for (Enumeration mds = md.doStyleConversion(this, transactionMethods).elements(); mds.hasMoreElements(); ) {
MethodDescriptor next = (MethodDescriptor) mds.nextElement();
convertedMethods.put(next, new ContainerTransaction(ct));
}
}
}
}
use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class EjbDescriptor method getStyledPermissionedMethodsByPermission.
/**
* @return a map of permission to style 1 or 2 method descriptors
*/
public Map getStyledPermissionedMethodsByPermission() {
if (styledMethodDescriptors == null) {
return null;
}
// the current info is structured as MethodDescriptors as keys to
// method permission, let's reverse this to make the Map using the
// method permission as a key.
Map styledMethodDescriptorsByPermission = new HashMap();
for (Iterator mdIterator = styledMethodDescriptors.keySet().iterator(); mdIterator.hasNext(); ) {
MethodDescriptor md = (MethodDescriptor) mdIterator.next();
Set methodPermissions = (Set) styledMethodDescriptors.get(md);
for (Iterator mpIterator = methodPermissions.iterator(); mpIterator.hasNext(); ) {
MethodPermission mp = (MethodPermission) mpIterator.next();
Set methodDescriptors = (Set) styledMethodDescriptorsByPermission.get(mp);
if (methodDescriptors == null) {
methodDescriptors = new HashSet();
}
methodDescriptors.add(md);
styledMethodDescriptorsByPermission.put(mp, methodDescriptors);
}
}
return styledMethodDescriptorsByPermission;
}
use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class EjbDescriptor method getBusinessMethodDescriptorFor.
/**
* @param m
* @param methodIntf
* @return the MethodDescriptor for the given Method object
*/
public MethodDescriptor getBusinessMethodDescriptorFor(Method m, String methodIntf) {
Set businessMethodDescriptors = getBusinessMethodDescriptors();
MethodDescriptor methodDesc = new MethodDescriptor(m, methodIntf);
MethodDescriptor match = null;
for (Object next : businessMethodDescriptors) {
MethodDescriptor nextMethodDesc = (MethodDescriptor) next;
if (nextMethodDesc.equals(methodDesc)) {
match = nextMethodDesc;
break;
}
}
return match;
}
use of com.sun.enterprise.deployment.MethodDescriptor in project Payara by payara.
the class EjbDescriptor method convertMethodPermissions.
/**
* convert all style 1 and style 2 method descriptors contained in
* our tables into style 3 method descriptors.
*/
private void convertMethodPermissions() {
if (styledMethodDescriptors == null)
return;
Set allMethods = getMethodDescriptors();
Set unpermissionedMethods = getMethodDescriptors();
Set methodDescriptors = styledMethodDescriptors.keySet();
for (Iterator styledMdItr = methodDescriptors.iterator(); styledMdItr.hasNext(); ) {
MethodDescriptor styledMd = (MethodDescriptor) styledMdItr.next();
// Get the new permissions we are trying to set for this
// method(s)
Set newPermissions = (Set) styledMethodDescriptors.get(styledMd);
// Convert to style 3 method descriptors
Vector mds = styledMd.doStyleConversion(this, allMethods);
for (Iterator mdItr = mds.iterator(); mdItr.hasNext(); ) {
MethodDescriptor md = (MethodDescriptor) mdItr.next();
// remove it from the list of unpermissioned methods.
// it will be used at the end to set all remaining methods
// with the unchecked method permission
unpermissionedMethods.remove(md);
// method descriptor and update the table
for (Iterator newPermissionsItr = newPermissions.iterator(); newPermissionsItr.hasNext(); ) {
MethodPermission newMp = (MethodPermission) newPermissionsItr.next();
updateMethodPermissionForMethod(newMp, md);
}
}
}
// All remaining methods should now be defined as unchecked...
MethodPermission mp = MethodPermission.getUncheckedMethodPermission();
Iterator iterator = unpermissionedMethods.iterator();
while (iterator.hasNext()) {
MethodDescriptor md = (MethodDescriptor) iterator.next();
if (getMethodPermissions(md).isEmpty()) {
addMethodPermissionForMethod(mp, md);
}
}
// finally we reset the list of method descriptors that need style conversion
styledMethodDescriptors = null;
}
Aggregations