Search in sources :

Example 11 with MethodNode

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;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) DatatypeFactory(javax.xml.datatype.DatatypeFactory) MethodNode(com.sun.enterprise.deployment.node.MethodNode) Node(org.w3c.dom.Node) MethodNode(com.sun.enterprise.deployment.node.MethodNode) DeploymentDescriptorNode(com.sun.enterprise.deployment.node.DeploymentDescriptorNode) GregorianCalendar(java.util.GregorianCalendar) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar)

Example 12 with MethodNode

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;
}
Also used : MethodNode(com.sun.enterprise.deployment.node.MethodNode) Node(org.w3c.dom.Node) MethodNode(com.sun.enterprise.deployment.node.MethodNode) DeploymentDescriptorNode(com.sun.enterprise.deployment.node.DeploymentDescriptorNode) ArrayList(java.util.ArrayList) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor) CheckpointAtEndOfMethodDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.CheckpointAtEndOfMethodDescriptor)

Example 13 with MethodNode

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;
}
Also used : MethodNode(com.sun.enterprise.deployment.node.MethodNode) Node(org.w3c.dom.Node) MethodNode(com.sun.enterprise.deployment.node.MethodNode) DeploymentDescriptorNode(com.sun.enterprise.deployment.node.DeploymentDescriptorNode) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor)

Example 14 with MethodNode

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;
}
Also used : MethodNode(com.sun.enterprise.deployment.node.MethodNode) ContainerTransaction(org.glassfish.ejb.deployment.descriptor.ContainerTransaction) MethodNode(com.sun.enterprise.deployment.node.MethodNode) DeploymentDescriptorNode(com.sun.enterprise.deployment.node.DeploymentDescriptorNode) Node(org.w3c.dom.Node) Map(java.util.Map) MethodDescriptor(com.sun.enterprise.deployment.MethodDescriptor)

Aggregations

MethodNode (com.sun.enterprise.deployment.node.MethodNode)14 Node (org.w3c.dom.Node)13 DeploymentDescriptorNode (com.sun.enterprise.deployment.node.DeploymentDescriptorNode)12 MethodDescriptor (com.sun.enterprise.deployment.MethodDescriptor)6 ArrayList (java.util.ArrayList)3 Iterator (java.util.Iterator)2 TimeoutValueDescriptor (org.glassfish.ejb.deployment.descriptor.TimeoutValueDescriptor)2 EjbInterceptor (com.sun.enterprise.deployment.EjbInterceptor)1 MethodPermission (com.sun.enterprise.deployment.MethodPermission)1 DataSourceDefinitionNode (com.sun.enterprise.deployment.node.DataSourceDefinitionNode)1 LifecycleCallbackNode (com.sun.enterprise.deployment.node.LifecycleCallbackNode)1 MailSessionNode (com.sun.enterprise.deployment.node.MailSessionNode)1 XMLNode (com.sun.enterprise.deployment.node.XMLNode)1 GregorianCalendar (java.util.GregorianCalendar)1 Map (java.util.Map)1 DatatypeFactory (javax.xml.datatype.DatatypeFactory)1 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)1 ConcurrentMethodDescriptor (org.glassfish.ejb.deployment.descriptor.ConcurrentMethodDescriptor)1 ContainerTransaction (org.glassfish.ejb.deployment.descriptor.ContainerTransaction)1 EjbInitInfo (org.glassfish.ejb.deployment.descriptor.EjbInitInfo)1