use of org.glassfish.ejb.deployment.descriptor.EjbCMPEntityDescriptor in project Payara by payara.
the class QueryMethodTest method commonToBothInterfaces.
/**
* This method is responsible for the logic of the test. It is called for both local and remote interfaces.
* @param descriptor the Enterprise Java Bean deployment descriptor
* @param ejbHome for the Home interface of the Ejb.
* @param result Result of the test
* @param remote Remote/Local interface
* @return boolean the results for this assertion i.e if a test has failed or not
*/
private boolean commonToBothInterfaces(String ejbHome, String remote, EjbDescriptor descriptor, Result result) {
boolean allIsWell = true;
boolean found = false;
String ejbClassName = descriptor.getEjbClassName();
VerifierTestContext context = getVerifierContext();
ClassLoader jcl = context.getClassLoader();
try {
Class ejbClass = Class.forName(ejbClassName, false, getVerifierContext().getClassLoader());
Method[] methods = Class.forName(ejbHome, false, getVerifierContext().getClassLoader()).getMethods();
for (int i = 0; i < methods.length; i++) {
String methodName = methods[i].getName();
// get the expected return type
String methodReturnType = methods[i].getReturnType().getName();
if (methodName.startsWith("find")) {
found = true;
if (methodReturnType.equals(remote) || isSubclassOf(Class.forName(methodReturnType, false, getVerifierContext().getClassLoader()), "java.util.Collection") || isImplementorOf(Class.forName(methodReturnType, false, getVerifierContext().getClassLoader()), "java.util.Collection")) {
if (!runIndividualQueryTest(methods[i], (EjbCMPEntityDescriptor) descriptor, ejbClass, result))
allIsWell = false;
}
}
}
if (found == false) {
result.addGoodDetails(smh.getLocalString("com.sun.enterprise.tools.verifier.tests.ejb.EjbTest.passed", "Not Applicable : No find methods found", new Object[] {}));
}
return allIsWell;
} catch (ClassNotFoundException e) {
Verifier.debug(e);
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString("com.sun.enterprise.tools.verifier.tests.ejb.EjbTest.failedException", "Error: [ {0} ] class not found.", new Object[] { descriptor.getEjbClassName() }));
allIsWell = false;
return allIsWell;
}
}
use of org.glassfish.ejb.deployment.descriptor.EjbCMPEntityDescriptor in project Payara by payara.
the class EjbFinderMethodException method check.
/**
* ejbFind<METHOD>(...) methods test.
*
* EJB class contains all ejbFind<METHOD>(...) methods declared in the bean
* class.
*
* The signatures of the finder methods must follow the following rules:
*
* A finder method name must start with the prefix ``ejbFind''
* (e.g. ejbFindByPrimaryKey, ejbFindLargeAccounts, ejbFindLateShipments).
*
* Compatibility Note: EJB 1.0 allowed the finder methods to throw the
* java.rmi.RemoteException to indicate a non-application exception. This
* practice is deprecated in EJB 1.1---an EJB 1.1 compliant enterprise
* bean should throw the javax.ejb.EJBException or another
* java.lang.RuntimeException to indicate non-application exceptions to
* the Container.
*
* @param descriptor the Enterprise Java Bean deployment descriptor
*
* @return <code>Result</code> the results for this assertion
*/
public Result check(EjbDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
if (descriptor instanceof EjbEntityDescriptor) {
String persistence = ((EjbEntityDescriptor) descriptor).getPersistenceType();
if (EjbEntityDescriptor.BEAN_PERSISTENCE.equals(persistence)) {
boolean ejbFindMethodFound = false;
boolean throwsRemoteException = false;
boolean throwsFinderException = false;
boolean isValidFinderException = false;
boolean oneFailed = false;
int foundWarning = 0;
int foundAtLeastOne = 0;
try {
// retrieve the EJB Class Methods
VerifierTestContext context = getVerifierContext();
ClassLoader jcl = context.getClassLoader();
Class EJBClass = Class.forName(descriptor.getEjbClassName(), false, getVerifierContext().getClassLoader());
// start do while loop here....
do {
Method[] ejbFinderMethods = EJBClass.getDeclaredMethods();
for (int j = 0; j < ejbFinderMethods.length; ++j) {
throwsRemoteException = false;
throwsFinderException = false;
ejbFindMethodFound = false;
if (ejbFinderMethods[j].getName().startsWith("ejbFind")) {
ejbFindMethodFound = true;
foundAtLeastOne++;
// Compatibility Note: EJB 1.0 allowed the ejbFind<METHOD> to
// throw the java.rmi.RemoteException to indicate a non-application
// exception. This practice is deprecated in EJB 1.1---an EJB 1.1
// compliant enterprise bean should throw the javax.ejb.EJBException
// or another RuntimeException to indicate non-application
// exceptions to the Container (see Section 12.2.2).
// Note: Treat as a warning to user in this instance.
Class[] exceptions = ejbFinderMethods[j].getExceptionTypes();
if (EjbUtils.isValidRemoteException(exceptions)) {
throwsRemoteException = true;
}
if (EjbUtils.isValidFinderException(exceptions)) {
throwsFinderException = true;
}
if (ejbFindMethodFound && throwsRemoteException == false && throwsFinderException == true) {
result.addGoodDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ] Finder Method [ {1} ]", new Object[] { EJBClass.getName(), ejbFinderMethods[j].getName() }));
result.addGoodDetails(smh.getLocalString(getClass().getName() + ".passed", "[ {0} ] declares [ {1} ] method, which properly does not throw java.rmi.RemoteException, but throws FinderException", new Object[] { EJBClass.getName(), ejbFinderMethods[j].getName() }));
} else if (ejbFindMethodFound && throwsRemoteException == true) {
if (descriptor instanceof EjbCMPEntityDescriptor) {
if (((EjbCMPEntityDescriptor) descriptor).getCMPVersion() == EjbCMPEntityDescriptor.CMP_2_x) {
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ] Finder method [ {1} ]", new Object[] { descriptor.getEjbClassName(), ejbFinderMethods[j].getName() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".error", "Error: Compatibility Note:" + "\n An [ {0} ] method was found, but" + "\n EJB 1.0 allowed the ejbFind<METHOD> method to throw the " + "\n java.rmi.RemoteException to indicate a non-application" + "\n exception. This practice was deprecated in EJB 1.1" + "\n ---an EJB 2.0 compliant enterprise bean must" + "\n throw the javax.ejb.EJBException or another " + "\n RuntimeException to indicate non-application exceptions" + "\n to the Container. ", new Object[] { ejbFinderMethods[j].getName() }));
oneFailed = true;
} else {
// warning for 1.1
foundWarning++;
result.addWarningDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addWarningDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ] Finder method [ {1} ]", new Object[] { descriptor.getEjbClassName(), ejbFinderMethods[j].getName() }));
result.addWarningDetails(smh.getLocalString(getClass().getName() + ".warning", "Error: Compatibility Note:" + "\n An [ {0} ] method was found, but" + "\n EJB 1.0 allowed the ejbFind<METHOD> method to throw the " + "\n java.rmi.RemoteException to indicate a non-application" + "\n exception. This practice is deprecated in EJB 1.1" + "\n ---an EJB 1.1 compliant enterprise bean should" + "\n throw the javax.ejb.EJBException or another " + "\n RuntimeException to indicate non-application exceptions" + "\n to the Container. ", new Object[] { ejbFinderMethods[j].getName() }));
}
} else {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable1", "[ {0} ] does not declare any ejbFind<METHOD>(...) methods.", new Object[] { descriptor.getEjbClassName() }));
}
} else if (ejbFindMethodFound && throwsFinderException == false) {
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".debug1", "For EJB Class [ {0} ] Finder method [ {1} ]", new Object[] { descriptor.getEjbClassName(), ejbFinderMethods[j].getName() }));
result.addErrorDetails(smh.getLocalString(getClass().getName() + ".error1", "Error: ejbFind[Method] [ {0} ] does not throw FinderException", new Object[] { ejbFinderMethods[j].getName() }));
oneFailed = true;
}
}
}
} while (((EJBClass = EJBClass.getSuperclass()) != null) && (foundAtLeastOne == 0));
if (foundAtLeastOne == 0) {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable1", "[ {0} ] does not declare any ejbFind<METHOD>(...) methods.", new Object[] { descriptor.getEjbClassName() }));
}
} catch (ClassNotFoundException e) {
Verifier.debug(e);
result.addErrorDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.failed(smh.getLocalString(getClass().getName() + ".failedException", "Error: EJB Class [ {1} ] does not exist or is not loadable.", new Object[] { descriptor.getEjbClassName() }));
oneFailed = true;
}
if (oneFailed) {
result.setStatus(result.FAILED);
} else if (foundAtLeastOne == 0) {
result.setStatus(result.NOT_APPLICABLE);
} else if (foundWarning > 0) {
result.setStatus(result.WARNING);
} else {
result.setStatus(result.PASSED);
}
return result;
} else {
// if (CONTAINER_PERSISTENCE.equals(persistence))
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable2", "Expected [ {0} ] managed persistence, but [ {1} ] bean has [ {2} ] managed persistence.", new Object[] { EjbEntityDescriptor.BEAN_PERSISTENCE, descriptor.getName(), persistence }));
return result;
}
} else {
result.addNaDetails(smh.getLocalString("tests.componentNameConstructor", "For [ {0} ]", new Object[] { compName.toString() }));
result.notApplicable(smh.getLocalString(getClass().getName() + ".notApplicable", "[ {0} ] expected {1} bean, but called with {2} bean.", new Object[] { getClass(), "Entity", "Session" }));
return result;
}
}
use of org.glassfish.ejb.deployment.descriptor.EjbCMPEntityDescriptor in project Payara by payara.
the class EjbBundleTracerVisitor method accept.
protected void accept(EjbDescriptor ejb) {
logInfo("==================");
logInfo(ejb.getType() + " Bean " + ejb.getName());
logInfo("\thomeClassName " + ejb.getHomeClassName());
logInfo("\tremoteClassName " + ejb.getRemoteClassName());
logInfo("\tlocalhomeClassName " + ejb.getLocalHomeClassName());
logInfo("\tlocalClassName " + ejb.getLocalClassName());
logInfo("\tremoteBusinessIntfs " + ejb.getRemoteBusinessClassNames());
logInfo("\tlocalBusinessIntfs " + ejb.getLocalBusinessClassNames());
logInfo("\tjndiName " + ejb.getJndiName());
logInfo("\tejbClassName " + ejb.getEjbClassName());
logInfo("\ttransactionType " + ejb.getTransactionType());
if (ejb.getUsesCallerIdentity() == false) {
logInfo("\trun-as role " + ejb.getRunAsIdentity());
} else {
logInfo("\tuse-caller-identity " + ejb.getUsesCallerIdentity());
}
for (EjbReference aRef : ejb.getEjbReferenceDescriptors()) {
accept(aRef);
}
for (Iterator e = ejb.getPermissionedMethodsByPermission().keySet().iterator(); e.hasNext(); ) {
MethodPermission mp = (MethodPermission) e.next();
Set methods = (Set) ejb.getPermissionedMethodsByPermission().get(mp);
accept(mp, methods);
}
if (ejb.getStyledPermissionedMethodsByPermission() != null) {
for (Iterator e = ejb.getStyledPermissionedMethodsByPermission().keySet().iterator(); e.hasNext(); ) {
MethodPermission mp = (MethodPermission) e.next();
Set methods = (Set) ejb.getStyledPermissionedMethodsByPermission().get(mp);
accept(mp, methods);
}
}
for (RoleReference roleRef : ejb.getRoleReferences()) {
accept(roleRef);
}
for (Iterator e = ejb.getMethodContainerTransactions().keySet().iterator(); e.hasNext(); ) {
MethodDescriptor md = (MethodDescriptor) e.next();
ContainerTransaction ct = (ContainerTransaction) ejb.getMethodContainerTransactions().get(md);
accept(md, ct);
}
for (EnvironmentProperty envProp : ejb.getEnvironmentProperties()) {
accept(envProp);
}
for (ResourceReferenceDescriptor next : ejb.getResourceReferenceDescriptors()) {
accept(next);
}
for (ResourceEnvReferenceDescriptor next : ejb.getResourceEnvReferenceDescriptors()) {
accept(next);
}
for (MessageDestinationReferencer next : ejb.getMessageDestinationReferenceDescriptors()) {
accept(next);
}
// referencer as well.
if (ejb.getType().equals(EjbMessageBeanDescriptor.TYPE)) {
MessageDestinationReferencer msgDestReferencer = (MessageDestinationReferencer) ejb;
if (msgDestReferencer.getMessageDestinationLinkName() != null) {
accept(msgDestReferencer);
}
}
for (ServiceReferenceDescriptor sref : ejb.getServiceReferenceDescriptors()) {
accept(sref);
}
if (ejb instanceof EjbCMPEntityDescriptor) {
EjbCMPEntityDescriptor cmp = (EjbCMPEntityDescriptor) ejb;
PersistenceDescriptor persistenceDesc = cmp.getPersistenceDescriptor();
for (Object fd : persistenceDesc.getCMPFields()) {
accept((FieldDescriptor) fd);
}
for (Object o : persistenceDesc.getQueriedMethods()) {
if (o instanceof MethodDescriptor) {
QueryDescriptor qd = persistenceDesc.getQueryFor((MethodDescriptor) o);
accept(qd);
}
}
}
}
use of org.glassfish.ejb.deployment.descriptor.EjbCMPEntityDescriptor in project Payara by payara.
the class EjbBundleValidator method accept.
/**
* visits an ejb descriptor
* @param ejb descriptor
*/
@Override
public void accept(EjbDescriptor ejb) {
// application
if (ejb instanceof DummyEjbDescriptor) {
throw new IllegalArgumentException(localStrings.getLocalString("enterprise.deployment.exceptionbeanbundle", "Referencing error: this bundle has no bean of name: {0}", new Object[] { ejb.getName() }));
}
this.ejb = ejb;
setDOLDefault(ejb);
computeRuntimeDefault(ejb);
checkDependsOn(ejb);
validateConcurrencyMetadata(ejb);
validateStatefulTimeout(ejb);
validatePassivationConfiguration(ejb);
try {
ClassLoader cl = ejb.getEjbBundleDescriptor().getClassLoader();
Class ejbClass = cl.loadClass(ejb.getEjbClassName());
if (Globals.getDefaultHabitat() == null) {
return;
}
if (ejb instanceof EjbSessionDescriptor) {
EjbSessionDescriptor desc = (EjbSessionDescriptor) ejb;
if (desc.isClustered()) {
if (!desc.isSingleton()) {
throw new IllegalArgumentException("Only Sinlgeton beans can be Clustered: " + desc.getName());
}
if (!Serializable.class.isAssignableFrom(ejbClass)) {
throw new IllegalStateException(String.format("Clustered Singleton %s must be Serializable", desc.getName()));
}
if (desc.getClusteredLockType() == DistributedLockType.LOCK) {
throw new IllegalStateException(String.format("Clustered Singleton %s - incompatible lock type LOCK", desc.getName()));
}
}
}
// Perform 2.x style TimedObject processing if the class
// hasn't already been identified as a timed object.
AnnotationTypesProvider provider = Globals.getDefaultHabitat().getService(AnnotationTypesProvider.class, "EJB");
if (provider == null) {
throw new RuntimeException("Cannot find AnnotationTypesProvider named 'EJB'");
}
if (ejb.getEjbTimeoutMethod() == null && provider.getType("javax.ejb.TimedObject").isAssignableFrom(ejbClass)) {
MethodDescriptor timedObjectMethod = new MethodDescriptor("ejbTimeout", "TimedObject timeout method", new String[] { "javax.ejb.Timer" }, MethodDescriptor.TIMER_METHOD);
ejb.setEjbTimeoutMethod(timedObjectMethod);
} else if (ejb.getEjbTimeoutMethod() != null) {
// If timeout-method was only processed from the descriptor,
// we need to create a MethodDescriptor using the actual
// Method object corresponding to the timeout method. The
// timeout method can have any access type and be anywhere
// in the bean class hierarchy.
MethodDescriptor timeoutMethodDescOrig = ejb.getEjbTimeoutMethod();
MethodDescriptor timeoutMethodDesc = processTimeoutMethod(ejb, timeoutMethodDescOrig, provider, ejbClass);
ejb.setEjbTimeoutMethod(timeoutMethodDesc);
}
for (ScheduledTimerDescriptor sd : ejb.getScheduledTimerDescriptors()) {
try {
// This method creates new schedule and attempts to calculate next timeout.
// The second part ensures that all values that are not verified up-front
// are also validated.
// It does not check that such timeout date is a valid date.
EJBTimerSchedule.isValid(sd);
} catch (Exception e) {
throw new RuntimeException(ejb.getName() + ": Invalid schedule " + "defined on method " + sd.getTimeoutMethod().getFormattedString() + ": " + e.getMessage());
}
MethodDescriptor timeoutMethodDescOrig = sd.getTimeoutMethod();
MethodDescriptor timeoutMethodDesc = processTimeoutMethod(ejb, timeoutMethodDescOrig, provider, ejbClass);
sd.setTimeoutMethod(timeoutMethodDesc);
}
} catch (Exception e) {
RuntimeException re = new RuntimeException("Error processing EjbDescriptor");
re.initCause(e);
throw re;
}
// has to be derived from target inject method or inject field.
for (InjectionCapable injectable : ejb.getEjbBundleDescriptor().getInjectableResources(ejb)) {
accept(injectable);
}
for (Iterator itr = ejb.getEjbReferenceDescriptors().iterator(); itr.hasNext(); ) {
EjbReference aRef = (EjbReference) itr.next();
accept(aRef);
}
for (Iterator it = ejb.getResourceReferenceDescriptors().iterator(); it.hasNext(); ) {
ResourceReferenceDescriptor next = (ResourceReferenceDescriptor) it.next();
accept(next);
}
for (Iterator it = ejb.getResourceEnvReferenceDescriptors().iterator(); it.hasNext(); ) {
ResourceEnvReferenceDescriptor next = (ResourceEnvReferenceDescriptor) it.next();
accept(next);
}
for (Iterator it = ejb.getMessageDestinationReferenceDescriptors().iterator(); it.hasNext(); ) {
MessageDestinationReferencer next = (MessageDestinationReferencer) it.next();
accept(next);
}
// referencer as well.
if (ejb.getType().equals(EjbMessageBeanDescriptor.TYPE)) {
if (ejb instanceof MessageDestinationReferencer) {
MessageDestinationReferencer msgDestReferencer = (MessageDestinationReferencer) ejb;
if (msgDestReferencer.getMessageDestinationLinkName() != null) {
accept(msgDestReferencer);
}
}
}
Set serviceRefs = ejb.getServiceReferenceDescriptors();
for (Iterator itr = serviceRefs.iterator(); itr.hasNext(); ) {
accept((ServiceReferenceDescriptor) itr.next());
}
if (ejb instanceof EjbCMPEntityDescriptor) {
EjbCMPEntityDescriptor cmp = (EjbCMPEntityDescriptor) ejb;
PersistenceDescriptor persistenceDesc = cmp.getPersistenceDescriptor();
for (Iterator e = persistenceDesc.getCMPFields().iterator(); e.hasNext(); ) {
FieldDescriptor fd = (FieldDescriptor) e.next();
accept(fd);
}
}
}
use of org.glassfish.ejb.deployment.descriptor.EjbCMPEntityDescriptor in project Payara by payara.
the class EjbEntityNode method writeDescriptor.
@Override
public Node writeDescriptor(Node parent, String nodeName, EjbEntityDescriptor ejbDesc) {
Node ejbNode = super.writeDescriptor(parent, nodeName, ejbDesc);
writeDisplayableComponentInfo(ejbNode, ejbDesc);
writeCommonHeaderEjbDescriptor(ejbNode, ejbDesc);
appendTextChild(ejbNode, EjbTagNames.PERSISTENCE_TYPE, ejbDesc.getPersistenceType());
appendTextChild(ejbNode, EjbTagNames.PRIMARY_KEY_CLASS, ejbDesc.getPrimaryKeyClassName());
appendTextChild(ejbNode, EjbTagNames.REENTRANT, ejbDesc.getReentrant());
// cmp entity beans related tags
if (ejbDesc instanceof EjbCMPEntityDescriptor) {
EjbCMPEntityDescriptor cmpDesc = (EjbCMPEntityDescriptor) ejbDesc;
if (cmpDesc.getCMPVersion() == EjbCMPEntityDescriptor.CMP_1_1) {
appendTextChild(ejbNode, EjbTagNames.CMP_VERSION, EjbTagNames.CMP_1_VERSION);
} else {
appendTextChild(ejbNode, EjbTagNames.CMP_VERSION, EjbTagNames.CMP_2_VERSION);
}
appendTextChild(ejbNode, EjbTagNames.ABSTRACT_SCHEMA_NAME, cmpDesc.getAbstractSchemaName());
// cmp-field*
CmpFieldNode cmpNode = new CmpFieldNode();
for (Iterator fields = cmpDesc.getPersistenceDescriptor().getCMPFields().iterator(); fields.hasNext(); ) {
FieldDescriptor aField = (FieldDescriptor) fields.next();
cmpNode.writeDescriptor(ejbNode, EjbTagNames.CMP_FIELD, aField);
}
if (cmpDesc.getPrimaryKeyFieldDesc() != null) {
appendTextChild(ejbNode, EjbTagNames.PRIMARY_KEY_FIELD, cmpDesc.getPrimaryKeyFieldDesc().getName());
}
}
// 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());
// security-role-ref*
writeRoleReferenceDescriptors(ejbNode, ejbDesc.getRoleReferences().iterator());
// security-identity
writeSecurityIdentityDescriptor(ejbNode, ejbDesc);
// query
if (ejbDesc instanceof EjbCMPEntityDescriptor) {
EjbCMPEntityDescriptor cmpDesc = (EjbCMPEntityDescriptor) ejbDesc;
Set queriedMethods = cmpDesc.getPersistenceDescriptor().getQueriedMethods();
if (queriedMethods.size() > 0) {
QueryNode queryNode = new QueryNode();
for (Iterator e = queriedMethods.iterator(); e.hasNext(); ) {
queryNode.writeDescriptor(ejbNode, EjbTagNames.QUERY, cmpDesc.getPersistenceDescriptor().getQueryFor((MethodDescriptor) e.next()));
}
}
}
return ejbNode;
}
Aggregations