Search in sources :

Example 1 with BeanCacheDescriptor

use of org.glassfish.ejb.deployment.descriptor.runtime.BeanCacheDescriptor in project Payara by payara.

the class EjbNode method writeDescriptor.

/**
 * write the descriptor class to a DOM tree and return it
 *
 * @param parent node for the DOM tree
 * @param node name for the descriptor
 * @param the descriptor to write
 * @return the DOM tree top node
 */
@Override
public Node writeDescriptor(Node parent, String nodeName, EjbDescriptor ejbDescriptor) {
    Element ejbNode = (Element) super.writeDescriptor(parent, nodeName, ejbDescriptor);
    appendTextChild(ejbNode, RuntimeTagNames.EJB_NAME, ejbDescriptor.getName());
    appendTextChild(ejbNode, RuntimeTagNames.JNDI_NAME, ejbDescriptor.getJndiName());
    RuntimeDescriptorNode.writeCommonComponentInfo(ejbNode, ejbDescriptor);
    appendTextChild(ejbNode, RuntimeTagNames.PASS_BY_REFERENCE, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getPassByReference()));
    if (ejbDescriptor instanceof IASEjbCMPEntityDescriptor) {
        CmpNode cmpNode = new CmpNode();
        cmpNode.writeDescriptor(ejbNode, RuntimeTagNames.CMP, (IASEjbCMPEntityDescriptor) ejbDescriptor);
    }
    // principal
    if (Boolean.FALSE.equals(ejbDescriptor.getUsesCallerIdentity())) {
        RunAsIdentityDescriptor raid = ejbDescriptor.getRunAsIdentity();
        if (raid != null && raid.getPrincipal() != null) {
            Node principalNode = appendChild(ejbNode, RuntimeTagNames.PRINCIPAL);
            appendTextChild(principalNode, RuntimeTagNames.NAME, raid.getPrincipal());
        }
    }
    if (ejbDescriptor instanceof EjbMessageBeanDescriptor) {
        EjbMessageBeanDescriptor msgBeanDesc = (EjbMessageBeanDescriptor) ejbDescriptor;
        // mdb-connection-factory?
        if (ejbDescriptor.getIASEjbExtraDescriptors().getMdbConnectionFactory() != null) {
            MDBConnectionFactoryNode mcfNode = new MDBConnectionFactoryNode();
            mcfNode.writeDescriptor(ejbNode, RuntimeTagNames.MDB_CONNECTION_FACTORY, ejbDescriptor.getIASEjbExtraDescriptors().getMdbConnectionFactory());
        }
        // jms-durable-subscription-name
        if (msgBeanDesc.hasDurableSubscription()) {
            appendTextChild(ejbNode, RuntimeTagNames.DURABLE_SUBSCRIPTION, msgBeanDesc.getDurableSubscriptionName());
        }
        appendTextChild(ejbNode, RuntimeTagNames.JMS_MAX_MESSAGES_LOAD, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getJmsMaxMessagesLoad()));
    }
    // ior-configuration
    IORConfigurationNode iorNode = new IORConfigurationNode();
    for (EjbIORConfigurationDescriptor iorConf : ejbDescriptor.getIORConfigurationDescriptors()) {
        iorNode.writeDescriptor(ejbNode, RuntimeTagNames.IOR_CONFIG, iorConf);
    }
    appendTextChild(ejbNode, RuntimeTagNames.IS_READ_ONLY_BEAN, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().isIsReadOnlyBean()));
    appendTextChild(ejbNode, RuntimeTagNames.REFRESH_PERIOD_IN_SECONDS, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getRefreshPeriodInSeconds()));
    appendTextChild(ejbNode, RuntimeTagNames.COMMIT_OPTION, ejbDescriptor.getIASEjbExtraDescriptors().getCommitOption());
    appendTextChild(ejbNode, RuntimeTagNames.CMT_TIMEOUT_IN_SECONDS, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getCmtTimeoutInSeconds()));
    appendTextChild(ejbNode, RuntimeTagNames.USE_THREAD_POOL_ID, ejbDescriptor.getIASEjbExtraDescriptors().getUseThreadPoolId());
    // gen-classes
    writeGenClasses(ejbNode, ejbDescriptor);
    // bean-pool
    BeanPoolDescriptor beanPoolDesc = ejbDescriptor.getIASEjbExtraDescriptors().getBeanPool();
    if (beanPoolDesc != null) {
        BeanPoolNode bpNode = new BeanPoolNode();
        bpNode.writeDescriptor(ejbNode, RuntimeTagNames.BEAN_POOL, beanPoolDesc);
    }
    // bean-cache
    BeanCacheDescriptor beanCacheDesc = ejbDescriptor.getIASEjbExtraDescriptors().getBeanCache();
    if (beanCacheDesc != null) {
        BeanCacheNode bcNode = new BeanCacheNode();
        bcNode.writeDescriptor(ejbNode, RuntimeTagNames.BEAN_CACHE, beanCacheDesc);
    }
    if (ejbDescriptor instanceof EjbMessageBeanDescriptor) {
        EjbMessageBeanDescriptor msgBeanDesc = (EjbMessageBeanDescriptor) ejbDescriptor;
        if (msgBeanDesc.hasResourceAdapterMid()) {
            MDBResourceAdapterNode mdb = new MDBResourceAdapterNode();
            mdb.writeDescriptor(ejbNode, RuntimeTagNames.MDB_RESOURCE_ADAPTER, msgBeanDesc);
        }
    } else if (ejbDescriptor instanceof EjbSessionDescriptor) {
        // web-services
        WebServiceEndpointRuntimeNode wsRuntime = new WebServiceEndpointRuntimeNode();
        wsRuntime.writeWebServiceEndpointInfo(ejbNode, ejbDescriptor);
    }
    // flush-at-end-of-method
    FlushAtEndOfMethodDescriptor flushMethodDesc = ejbDescriptor.getIASEjbExtraDescriptors().getFlushAtEndOfMethodDescriptor();
    if (flushMethodDesc != null) {
        FlushAtEndOfMethodNode flushNode = new FlushAtEndOfMethodNode();
        flushNode.writeDescriptor(ejbNode, RuntimeTagNames.FLUSH_AT_END_OF_METHOD, flushMethodDesc);
    }
    // checkpointed-methods
    // checkpoint-at-end-of-method
    CheckpointAtEndOfMethodDescriptor checkpointMethodDesc = ejbDescriptor.getIASEjbExtraDescriptors().getCheckpointAtEndOfMethodDescriptor();
    if (checkpointMethodDesc != null) {
        CheckpointAtEndOfMethodNode checkpointNode = new CheckpointAtEndOfMethodNode();
        checkpointNode.writeDescriptor(ejbNode, RuntimeTagNames.CHECKPOINT_AT_END_OF_METHOD, checkpointMethodDesc);
    }
    if (ejbDescriptor.getIASEjbExtraDescriptors().getPerRequestLoadBalancing() != null) {
        appendTextChild(ejbNode, RuntimeTagNames.PER_REQUEST_LOAD_BALANCING, String.valueOf(ejbDescriptor.getIASEjbExtraDescriptors().getPerRequestLoadBalancing()));
    }
    // availability-enabled
    setAttribute(ejbNode, RuntimeTagNames.AVAILABILITY_ENABLED, ejbDescriptor.getIASEjbExtraDescriptors().getAttributeValue(IASEjbExtraDescriptors.AVAILABILITY_ENABLED));
    return ejbNode;
}
Also used : BeanCacheDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.BeanCacheDescriptor) WebServiceEndpointRuntimeNode(com.sun.enterprise.deployment.node.runtime.WebServiceEndpointRuntimeNode) RunAsIdentityDescriptor(com.sun.enterprise.deployment.RunAsIdentityDescriptor) XMLElement(com.sun.enterprise.deployment.node.XMLElement) Element(org.w3c.dom.Element) ResourceEnvRefNode(com.sun.enterprise.deployment.node.runtime.ResourceEnvRefNode) WebServiceEndpointRuntimeNode(com.sun.enterprise.deployment.node.runtime.WebServiceEndpointRuntimeNode) EjbRefNode(com.sun.enterprise.deployment.node.runtime.EjbRefNode) ServiceRefNode(com.sun.enterprise.deployment.node.runtime.ServiceRefNode) DeploymentDescriptorNode(com.sun.enterprise.deployment.node.DeploymentDescriptorNode) ResourceRefNode(com.sun.enterprise.deployment.node.runtime.ResourceRefNode) Node(org.w3c.dom.Node) RuntimeDescriptorNode(com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode) MessageDestinationRefNode(com.sun.enterprise.deployment.node.runtime.MessageDestinationRefNode) EjbIORConfigurationDescriptor(com.sun.enterprise.deployment.EjbIORConfigurationDescriptor) IASEjbCMPEntityDescriptor(org.glassfish.ejb.deployment.descriptor.IASEjbCMPEntityDescriptor) EjbMessageBeanDescriptor(org.glassfish.ejb.deployment.descriptor.EjbMessageBeanDescriptor) EjbSessionDescriptor(com.sun.enterprise.deployment.EjbSessionDescriptor) FlushAtEndOfMethodDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.FlushAtEndOfMethodDescriptor) BeanPoolDescriptor(com.sun.enterprise.deployment.runtime.BeanPoolDescriptor) CheckpointAtEndOfMethodDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.CheckpointAtEndOfMethodDescriptor)

Example 2 with BeanCacheDescriptor

use of org.glassfish.ejb.deployment.descriptor.runtime.BeanCacheDescriptor in project Payara by payara.

the class CacheProperties method init.

public void init(EjbDescriptor desc) {
    BeanCacheDescriptor beanCacheDes = null;
    IASEjbExtraDescriptors iased = desc.getIASEjbExtraDescriptors();
    if (iased != null) {
        beanCacheDes = iased.getBeanCache();
    }
    loadProperties(ejbContainer, desc, beanCacheDes);
// container.setMonitorOn(ejbContainer.isMonitoringEnabled());
}
Also used : BeanCacheDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.BeanCacheDescriptor) IASEjbExtraDescriptors(org.glassfish.ejb.deployment.descriptor.runtime.IASEjbExtraDescriptors)

Aggregations

BeanCacheDescriptor (org.glassfish.ejb.deployment.descriptor.runtime.BeanCacheDescriptor)2 EjbIORConfigurationDescriptor (com.sun.enterprise.deployment.EjbIORConfigurationDescriptor)1 EjbSessionDescriptor (com.sun.enterprise.deployment.EjbSessionDescriptor)1 RunAsIdentityDescriptor (com.sun.enterprise.deployment.RunAsIdentityDescriptor)1 DeploymentDescriptorNode (com.sun.enterprise.deployment.node.DeploymentDescriptorNode)1 XMLElement (com.sun.enterprise.deployment.node.XMLElement)1 EjbRefNode (com.sun.enterprise.deployment.node.runtime.EjbRefNode)1 MessageDestinationRefNode (com.sun.enterprise.deployment.node.runtime.MessageDestinationRefNode)1 ResourceEnvRefNode (com.sun.enterprise.deployment.node.runtime.ResourceEnvRefNode)1 ResourceRefNode (com.sun.enterprise.deployment.node.runtime.ResourceRefNode)1 RuntimeDescriptorNode (com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode)1 ServiceRefNode (com.sun.enterprise.deployment.node.runtime.ServiceRefNode)1 WebServiceEndpointRuntimeNode (com.sun.enterprise.deployment.node.runtime.WebServiceEndpointRuntimeNode)1 BeanPoolDescriptor (com.sun.enterprise.deployment.runtime.BeanPoolDescriptor)1 EjbMessageBeanDescriptor (org.glassfish.ejb.deployment.descriptor.EjbMessageBeanDescriptor)1 IASEjbCMPEntityDescriptor (org.glassfish.ejb.deployment.descriptor.IASEjbCMPEntityDescriptor)1 CheckpointAtEndOfMethodDescriptor (org.glassfish.ejb.deployment.descriptor.runtime.CheckpointAtEndOfMethodDescriptor)1 FlushAtEndOfMethodDescriptor (org.glassfish.ejb.deployment.descriptor.runtime.FlushAtEndOfMethodDescriptor)1 IASEjbExtraDescriptors (org.glassfish.ejb.deployment.descriptor.runtime.IASEjbExtraDescriptors)1 Element (org.w3c.dom.Element)1