use of com.sun.enterprise.deployment.node.MethodNode in project Payara by payara.
the class ScheduledTimerNode method writeDescriptor.
@Override
public Node writeDescriptor(Node parent, String nodeName, ScheduledTimerDescriptor desc) {
Node timerNode = super.writeDescriptor(parent, nodeName, descriptor);
Node scheduleNode = appendChild(timerNode, EjbTagNames.TIMER_SCHEDULE);
appendTextChild(scheduleNode, EjbTagNames.TIMER_SECOND, desc.getSecond());
appendTextChild(scheduleNode, EjbTagNames.TIMER_MINUTE, desc.getMinute());
appendTextChild(scheduleNode, EjbTagNames.TIMER_HOUR, desc.getHour());
appendTextChild(scheduleNode, EjbTagNames.TIMER_DAY_OF_MONTH, desc.getDayOfMonth());
appendTextChild(scheduleNode, EjbTagNames.TIMER_MONTH, desc.getMonth());
appendTextChild(scheduleNode, EjbTagNames.TIMER_DAY_OF_WEEK, desc.getDayOfWeek());
appendTextChild(scheduleNode, EjbTagNames.TIMER_YEAR, desc.getYear());
try {
DatatypeFactory dFactory = DatatypeFactory.newInstance();
GregorianCalendar cal = new GregorianCalendar();
if (desc.getStart() != null) {
cal.setTime(desc.getStart());
XMLGregorianCalendar xmlGreg = dFactory.newXMLGregorianCalendar(cal);
appendTextChild(timerNode, EjbTagNames.TIMER_START, xmlGreg.toXMLFormat());
}
if (desc.getEnd() != null) {
cal.setTime(desc.getEnd());
XMLGregorianCalendar xmlGreg = dFactory.newXMLGregorianCalendar(cal);
appendTextChild(timerNode, EjbTagNames.TIMER_END, xmlGreg.toXMLFormat());
}
} catch (Exception e) {
DOLUtils.getDefaultLogger().log(Level.WARNING, e.getMessage(), e);
}
MethodNode methodNode = new MethodNode();
methodNode.writeJavaMethodDescriptor(timerNode, EjbTagNames.TIMEOUT_METHOD, desc.getTimeoutMethod());
appendTextChild(timerNode, EjbTagNames.TIMER_PERSISTENT, Boolean.toString(desc.getPersistent()));
String tz = desc.getTimezone();
if (tz != null) {
appendTextChild(timerNode, EjbTagNames.TIMER_TIMEZONE, tz);
}
String info = desc.getInfo();
if (info != null) {
appendTextChild(timerNode, EjbTagNames.TIMER_INFO, info);
}
return timerNode;
}
use of com.sun.enterprise.deployment.node.MethodNode in project Payara by payara.
the class CheckpointAtEndOfMethodNode method writeDescriptor.
@Override
public Node writeDescriptor(Node parent, String nodeName, CheckpointAtEndOfMethodDescriptor checkpointMethodDescriptor) {
Node checkpointMethodNode = super.writeDescriptor(parent, nodeName, checkpointMethodDescriptor);
ArrayList methodDescs = checkpointMethodDescriptor.getConvertedMethodDescs();
if (!methodDescs.isEmpty()) {
MethodNode methodNode = new MethodNode();
for (Iterator<MethodDescriptor> it = methodDescs.iterator(); it.hasNext(); ) {
// do not write out ejb-name element for the method
methodNode.writeDescriptor(checkpointMethodNode, RuntimeTagNames.METHOD, it.next(), null);
}
}
return checkpointMethodNode;
}
use of com.sun.enterprise.deployment.node.MethodNode in project Payara by payara.
the class PrefetchDisabledNode method writeDescriptor.
@Override
public Node writeDescriptor(Node parent, String nodeName, PrefetchDisabledDescriptor prefetchDisabledDescriptor) {
Node prefetchDisabledNode = super.writeDescriptor(parent, nodeName, prefetchDisabledDescriptor);
ArrayList methodDescs = prefetchDisabledDescriptor.getConvertedMethodDescs();
if (!methodDescs.isEmpty()) {
MethodNode methodNode = new MethodNode();
for (Iterator methodIterator = methodDescs.iterator(); methodIterator.hasNext(); ) {
MethodDescriptor methodDesc = (MethodDescriptor) methodIterator.next();
methodNode.writeQueryMethodDescriptor(prefetchDisabledNode, RuntimeTagNames.QUERY_METHOD, methodDesc);
}
}
return prefetchDisabledNode;
}
use of com.sun.enterprise.deployment.node.MethodNode in project Payara by payara.
the class ContainerTransactionNode method writeDescriptor.
/**
* write the descriptor class to a DOM tree and return it
*
* @param parent node in the DOM tree
* @param nodeName name for the root element of this xml fragment
* @param ejb 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 (Object o : methodToTransactions.entrySet()) {
Map.Entry entry = (Map.Entry) o;
MethodDescriptor md = (MethodDescriptor) entry.getKey();
Node ctNode = super.writeDescriptor(parent, nodeName, ejb);
ContainerTransaction ct = (ContainerTransaction) entry.getValue();
appendTextChild(ctNode, EjbTagNames.DESCRIPTION, ct.getDescription());
mn.writeDescriptor(ctNode, EjbTagNames.METHOD, md, ejb.getName());
appendTextChild(ctNode, EjbTagNames.TRANSACTION_ATTRIBUTE, ct.getTransactionAttribute());
}
return null;
}
Aggregations