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;
}
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());
}
Aggregations