private void removeContainerTransactionFor(MethodDescriptor methodDescriptor) { getMethodContainerTransactions().remove(methodDescriptor); }
/** * Return true if any of my ejb's methods have been assigned transaction attributes. */ public boolean hasContainerTransactions() { for (Iterator itr = this.getEjbs().iterator(); itr.hasNext();) { EjbDescriptor nextEjbDescriptor = (EjbDescriptor) itr.next(); if (!nextEjbDescriptor.getMethodContainerTransactions().isEmpty()) { return true; } } return false; }
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; }
private boolean needToConvertMethodContainerTransactions() { if (this.getEjbBundleDescriptor() != null) { for (Enumeration e = this.getMethodContainerTransactions().keys(); e.hasMoreElements();) { MethodDescriptor md = (MethodDescriptor) e.nextElement(); if (!md.isExact()) { return true; } } } return false; }
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)); } } } }
void doMethodDescriptorConversions() throws Exception { // container transactions first Hashtable transactions = this.getMethodContainerTransactions(); //_logger.log(Level.FINE,"Pre conversion = " + transactions); Hashtable convertedTransactions = new Hashtable(); Collection transactionMethods = this.getTransactionMethodDescriptors(); for (Enumeration e = transactions.keys(); e.hasMoreElements();) { MethodDescriptor md = (MethodDescriptor) e.nextElement(); ContainerTransaction ct = (ContainerTransaction) transactions.get(md); for (Enumeration mds = md.doStyleConversion(this, transactionMethods).elements(); mds.hasMoreElements();) { MethodDescriptor next = (MethodDescriptor) mds.nextElement(); convertedTransactions.put(next, new ContainerTransaction(ct)); } } //_logger.log(Level.FINE,"Post conversion = " + convertedTransactions); setMethodContainerTransactions(convertedTransactions); convertMethodPermissions(); }
/** * Fetches the assigned container transaction object for the given method object or null. */ public ContainerTransaction getContainerTransactionFor(MethodDescriptor methodDescriptor) { ContainerTransaction containerTransaction = null; if (this.needToConvertMethodContainerTransactions()) { this.convertMethodContainerTransactions(); } containerTransaction = (ContainerTransaction) this.getMethodContainerTransactions().get(methodDescriptor); if (containerTransaction == null) { if (this.isBoundsChecking() && usesDefaultTransaction) { containerTransaction = new ContainerTransaction(ContainerTransaction.REQUIRED, ""); this.getMethodContainerTransactions().put(methodDescriptor, containerTransaction); } else { containerTransaction = null; } } return containerTransaction; }
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)
/** * Sets the container transaction for the given method descriptor. * Throws an Illegal argument if this ejb has transaction type BEAN_TRANSACTION_TYPE. */ public void setContainerTransactionFor(MethodDescriptor methodDescriptor, ContainerTransaction containerTransaction) { ContainerTransaction oldValue = this.getContainerTransactionFor(methodDescriptor); if (oldValue == null || (oldValue != null && !(oldValue.equals(containerTransaction)))) { String transactionType = this.getTransactionType(); if (transactionType == null) { setTransactionType(CONTAINER_TRANSACTION_TYPE); transactionType = CONTAINER_TRANSACTION_TYPE; } else if (BEAN_TRANSACTION_TYPE.equals(transactionType)) { throw new IllegalArgumentException(localStrings.getLocalString( "enterprise.deployment.exceptiontxattrbtnotspecifiedinbeanwithtxtype", "Method level transaction attributes may not be specified on a bean with transaction type {0}", new Object[]{EjbSessionDescriptor.BEAN_TRANSACTION_TYPE})); } //_logger.log(Level.FINE,"put " + methodDescriptor + " " + containerTransaction); getMethodContainerTransactions().put(methodDescriptor, containerTransaction); } }
/** * receives notification of the end of an XML element by the Parser * * @param element the xml tag identification * @return true if this node is done processing the XML sub tree */ public boolean endElement(XMLElement element) { boolean doneWithNode = super.endElement(element); if (doneWithNode) { ContainerTransaction ct = new ContainerTransaction(trans_attribute, description); for (Iterator methodsIterator = methods.iterator();methodsIterator.hasNext();) { MethodDescriptor md = (MethodDescriptor) methodsIterator.next(); EjbBundleDescriptor bundle = (EjbBundleDescriptor) getParentNode().getDescriptor(); EjbDescriptor ejb = bundle.getEjbByName(md.getEjbName(), true); ejb.getMethodContainerTransactions().put(md, ct); } } return doneWithNode; }
/** * write the descriptor class to a DOM tree and return it * * @param parent node in the DOM tree * @param node name for the root element of this xml fragment * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, EjbDescriptor ejb) { Map methodToTransactions = ejb.getMethodContainerTransactions(); MethodNode mn = new MethodNode(); for (Iterator e=methodToTransactions.keySet().iterator();e.hasNext();) { MethodDescriptor md = (MethodDescriptor) e.next(); Node ctNode = super.writeDescriptor(parent, nodeName, ejb); ContainerTransaction ct = (ContainerTransaction) methodToTransactions.get(md); appendTextChild(ctNode, EjbTagNames.DESCRIPTION, ct.getDescription()); mn.writeDescriptor(ctNode, EjbTagNames.METHOD, md, ejb.getName()); appendTextChild(ctNode, EjbTagNames.TRANSACTION_ATTRIBUTE, ct.getTransactionAttribute()); } return null; } }
aVisitor.accept(roleRef); for (Iterator e = getMethodContainerTransactions().keySet().iterator(); e.hasNext();) { MethodDescriptor md = (MethodDescriptor) e.next(); ContainerTransaction ct = (ContainerTransaction) getMethodContainerTransactions().get(md); aVisitor.accept(md, ct);
public void addEjbDescriptor(EjbDescriptor other) { setEjbBundleDescriptor(other.bundleDescriptor); this.transactionType = other.transactionType; this.methodContainerTransactions = new Hashtable(other.getMethodContainerTransactions()); this.permissionedMethodsByPermission = new Hashtable(other.getPermissionedMethodsByPermission()); if (other.env == null) {