use of com.sun.enterprise.deployment.node.MethodNode in project Payara by payara.
the class EjbInitNode method writeDescriptor.
@Override
public Node writeDescriptor(Node parent, String nodeName, EjbInitInfo initMethod) {
Node initNode = appendChild(parent, nodeName);
MethodNode methodNode = new MethodNode();
methodNode.writeJavaMethodDescriptor(initNode, EjbTagNames.INIT_CREATE_METHOD, initMethod.getCreateMethod());
methodNode.writeJavaMethodDescriptor(initNode, EjbTagNames.INIT_BEAN_METHOD, initMethod.getBeanMethod());
return initNode;
}
use of com.sun.enterprise.deployment.node.MethodNode in project Payara by payara.
the class EjbSessionNode method writeDescriptor.
@Override
public Node writeDescriptor(Node parent, String nodeName, EjbSessionDescriptor ejbDesc) {
Node ejbNode = super.writeDescriptor(parent, nodeName, ejbDesc);
writeDisplayableComponentInfo(ejbNode, ejbDesc);
writeCommonHeaderEjbDescriptor(ejbNode, ejbDesc);
appendTextChild(ejbNode, EjbTagNames.SESSION_TYPE, ejbDesc.getSessionType());
if (ejbDesc.hasStatefulTimeout()) {
TimeoutValueNode timeoutValueNode = new TimeoutValueNode();
TimeoutValueDescriptor timeoutDesc = new TimeoutValueDescriptor();
timeoutDesc.setValue(ejbDesc.getStatefulTimeoutValue());
timeoutDesc.setUnit(ejbDesc.getStatefulTimeoutUnit());
timeoutValueNode.writeDescriptor(ejbNode, EjbTagNames.STATEFUL_TIMEOUT, timeoutDesc);
}
MethodNode methodNode = new MethodNode();
if (ejbDesc.isTimedObject()) {
if (ejbDesc.getEjbTimeoutMethod() != null) {
methodNode.writeJavaMethodDescriptor(ejbNode, EjbTagNames.TIMEOUT_METHOD, ejbDesc.getEjbTimeoutMethod());
}
for (ScheduledTimerDescriptor timerDesc : ejbDesc.getScheduledTimerDescriptors()) {
ScheduledTimerNode timerNode = new ScheduledTimerNode();
timerNode.writeDescriptor(ejbNode, EjbTagNames.TIMER, timerDesc);
}
}
if (ejbDesc.isSingleton()) {
appendTextChild(ejbNode, EjbTagNames.INIT_ON_STARTUP, Boolean.toString(ejbDesc.getInitOnStartup()));
}
if (!ejbDesc.isStateless()) {
appendTextChild(ejbNode, EjbTagNames.CONCURRENCY_MANAGEMENT_TYPE, ejbDesc.getConcurrencyManagementType().toString());
}
for (EjbSessionDescriptor.AccessTimeoutHolder next : ejbDesc.getAccessTimeoutInfo()) {
ConcurrentMethodDescriptor cDesc = new ConcurrentMethodDescriptor();
cDesc.setConcurrentMethod(next.method);
TimeoutValueDescriptor timeoutDesc = new TimeoutValueDescriptor();
timeoutDesc.setValue(next.value);
timeoutDesc.setUnit(next.unit);
cDesc.setAccessTimeout(timeoutDesc);
ConcurrentMethodNode cNode = new ConcurrentMethodNode();
cNode.writeDescriptor(ejbNode, EjbTagNames.CONCURRENT_METHOD, cDesc);
}
for (MethodDescriptor nextReadLock : ejbDesc.getReadLockMethods()) {
ConcurrentMethodDescriptor cDesc = new ConcurrentMethodDescriptor();
cDesc.setConcurrentMethod(nextReadLock);
cDesc.setWriteLock(false);
ConcurrentMethodNode cNode = new ConcurrentMethodNode();
cNode.writeDescriptor(ejbNode, EjbTagNames.CONCURRENT_METHOD, cDesc);
}
if (ejbDesc.hasDependsOn()) {
Node dependsOnNode = appendChild(ejbNode, EjbTagNames.DEPENDS_ON);
for (String depend : ejbDesc.getDependsOn()) {
appendTextChild(dependsOnNode, EjbTagNames.EJB_NAME, depend);
}
}
if (ejbDesc.hasInitMethods()) {
EjbInitNode initNode = new EjbInitNode();
for (EjbInitInfo next : ejbDesc.getInitMethods()) {
initNode.writeDescriptor(ejbNode, EjbTagNames.INIT_METHOD, next);
}
}
if (ejbDesc.hasRemoveMethods()) {
EjbRemoveNode removeNode = new EjbRemoveNode();
for (EjbRemovalInfo next : ejbDesc.getAllRemovalInfo()) {
removeNode.writeDescriptor(ejbNode, EjbTagNames.REMOVE_METHOD, next);
}
}
for (MethodDescriptor nextDesc : ejbDesc.getAsynchronousMethods()) {
methodNode.writeDescriptor(ejbNode, EjbTagNames.ASYNC_METHOD, nextDesc, ejbDesc.getName());
}
appendTextChild(ejbNode, EjbTagNames.TRANSACTION_TYPE, ejbDesc.getTransactionType());
MethodDescriptor afterBeginMethod = ejbDesc.getAfterBeginMethod();
if (afterBeginMethod != null) {
methodNode.writeJavaMethodDescriptor(ejbNode, EjbTagNames.AFTER_BEGIN_METHOD, afterBeginMethod);
}
MethodDescriptor beforeCompletionMethod = ejbDesc.getBeforeCompletionMethod();
if (beforeCompletionMethod != null) {
methodNode.writeJavaMethodDescriptor(ejbNode, EjbTagNames.BEFORE_COMPLETION_METHOD, beforeCompletionMethod);
}
MethodDescriptor afterCompletionMethod = ejbDesc.getAfterCompletionMethod();
if (afterCompletionMethod != null) {
methodNode.writeJavaMethodDescriptor(ejbNode, EjbTagNames.AFTER_COMPLETION_METHOD, afterCompletionMethod);
}
// around-invoke-method
writeAroundInvokeDescriptors(ejbNode, ejbDesc.getAroundInvokeDescriptors().iterator());
// around-timeout-method
writeAroundTimeoutDescriptors(ejbNode, ejbDesc.getAroundTimeoutDescriptors().iterator());
// env-entry*
writeEnvEntryDescriptors(ejbNode, ejbDesc.getEnvironmentProperties().iterator());
// ejb-ref * and ejb-local-ref*
writeEjbReferenceDescriptors(ejbNode, ejbDesc.getEjbReferenceDescriptors().iterator());
// service-ref*
writeServiceReferenceDescriptors(ejbNode, ejbDesc.getServiceReferenceDescriptors().iterator());
// resource-ref*
writeResourceRefDescriptors(ejbNode, ejbDesc.getResourceReferenceDescriptors().iterator());
// resource-env-ref*
writeResourceEnvRefDescriptors(ejbNode, ejbDesc.getResourceEnvReferenceDescriptors().iterator());
// message-destination-ref*
writeMessageDestinationRefDescriptors(ejbNode, ejbDesc.getMessageDestinationReferenceDescriptors().iterator());
// persistence-context-ref*
writeEntityManagerReferenceDescriptors(ejbNode, ejbDesc.getEntityManagerReferenceDescriptors().iterator());
// persistence-unit-ref*
writeEntityManagerFactoryReferenceDescriptors(ejbNode, ejbDesc.getEntityManagerFactoryReferenceDescriptors().iterator());
// post-construct
writeLifeCycleCallbackDescriptors(ejbNode, TagNames.POST_CONSTRUCT, ejbDesc.getPostConstructDescriptors());
// pre-destroy
writeLifeCycleCallbackDescriptors(ejbNode, TagNames.PRE_DESTROY, ejbDesc.getPreDestroyDescriptors());
// all descriptors (includes DSD, MSD, JMSCFD, JMSDD,AOD, CFD)*
writeResourceDescriptors(ejbNode, ejbDesc.getAllResourcesDescriptors().iterator());
// post-activate-method
writeLifeCycleCallbackDescriptors(ejbNode, EjbTagNames.POST_ACTIVATE_METHOD, ejbDesc.getPostActivateDescriptors());
// pre-passivate-method
writeLifeCycleCallbackDescriptors(ejbNode, EjbTagNames.PRE_PASSIVATE_METHOD, ejbDesc.getPrePassivateDescriptors());
// security-role-ref*
writeRoleReferenceDescriptors(ejbNode, ejbDesc.getRoleReferences().iterator());
// security-identity
writeSecurityIdentityDescriptor(ejbNode, ejbDesc);
// passivation-capable
if (ejbDesc.isStateful()) {
appendTextChild(ejbNode, EjbTagNames.PASSIVATION_CAPABLE, Boolean.toString(ejbDesc.isPassivationCapable()));
}
return ejbNode;
}
use of com.sun.enterprise.deployment.node.MethodNode in project Payara by payara.
the class MethodPermissionNode method writeDescriptorInNode.
/**
* Write the descriptor in a DOM tree which root element is provided
*
* @param subNode the root element for the DOM fragment
* @param descriptor the method permisison descriptor
* @param ejb the ejb descriptor the above method permission belongs to
*/
public Node writeDescriptorInNode(Node subNode, MethodPermissionDescriptor descriptor, EjbDescriptor ejb) {
writeLocalizedDescriptions(subNode, descriptor);
MethodPermission[] mps = descriptor.getMethodPermissions();
if (mps.length == 0)
return null;
if (!mps[0].isExcluded()) {
if (mps[0].isUnchecked()) {
appendChild(subNode, EjbTagNames.UNCHECKED);
} else {
for (int i = 0; i < mps.length; i++) {
appendTextChild(subNode, TagNames.ROLE_NAME, mps[i].getRole().getName());
}
}
}
MethodDescriptor[] methods = descriptor.getMethods();
MethodNode mn = new MethodNode();
for (int i = 0; i < methods.length; i++) {
String ejbName = ejb.getName();
mn.writeDescriptor(subNode, EjbTagNames.METHOD, methods[i], ejbName);
}
return subNode;
}
use of com.sun.enterprise.deployment.node.MethodNode in project Payara by payara.
the class QueryNode method writeDescriptor.
@Override
public Node writeDescriptor(Node parent, String nodeName, QueryDescriptor descriptor) {
Node queryNode = super.writeDescriptor(parent, nodeName, descriptor);
writeLocalizedDescriptions(queryNode, descriptor);
// query-method
MethodNode methodNode = new MethodNode();
methodNode.writeQueryMethodDescriptor(queryNode, EjbTagNames.QUERY_METHOD, descriptor.getQueryMethodDescriptor());
if (descriptor.getHasRemoteReturnTypeMapping()) {
appendTextChild(queryNode, EjbTagNames.QUERY_RESULT_TYPE_MAPPING, EjbTagNames.QUERY_REMOTE_TYPE_MAPPING);
} else {
if (descriptor.getHasLocalReturnTypeMapping()) {
appendTextChild(queryNode, EjbTagNames.QUERY_RESULT_TYPE_MAPPING, EjbTagNames.QUERY_LOCAL_TYPE_MAPPING);
}
}
// ejbql element is mandatory. If no EJB QL query has been
// specified for the method, the xml element will be empty
String ejbqlText = descriptor.getIsEjbQl() ? descriptor.getQuery() : "";
Node child = appendChild(queryNode, EjbTagNames.EJB_QL);
child.appendChild(getOwnerDocument(child).createTextNode(ejbqlText));
return queryNode;
}
use of com.sun.enterprise.deployment.node.MethodNode in project Payara by payara.
the class FlushAtEndOfMethodNode method writeDescriptor.
@Override
public Node writeDescriptor(Node parent, String nodeName, FlushAtEndOfMethodDescriptor flushMethodDescriptor) {
Node flushMethodNode = super.writeDescriptor(parent, nodeName, flushMethodDescriptor);
ArrayList methodDescs = flushMethodDescriptor.getConvertedMethodDescs();
if (!methodDescs.isEmpty()) {
MethodNode methodNode = new MethodNode();
for (Iterator methodIterator = methodDescs.iterator(); methodIterator.hasNext(); ) {
MethodDescriptor methodDesc = (MethodDescriptor) methodIterator.next();
// do not write out ejb-name element for the method
methodNode.writeDescriptor(flushMethodNode, RuntimeTagNames.METHOD, methodDesc, null);
}
}
return flushMethodNode;
}
Aggregations