FileDocCategorySizeDatePackage
RoleNameNMTOKEN.javaAPI DocGlassfish v2 API4358Fri May 04 22:33:32 BST 2007com.sun.enterprise.tools.verifier.tests.ejb

RoleNameNMTOKEN

public class RoleNameNMTOKEN extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest implements EjbCheck
The role-name element must conform to the lexical rules for an NMTOKEN

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(EjbDescriptor descriptor)
The role-name element must conform to the lexical rules for an NMTOKEN

param
descriptor the Enterprise Java Bean deployment descriptor
return
Result the results for this assertion


	Result result = getInitializedResult();
	ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();

	if (!descriptor.getPermissionedRoles().isEmpty()) {
	    for (Iterator itr = descriptor.getPermissionedRoles().iterator();
		 itr.hasNext();) {

		Role nextRole = (Role) itr.next();
		if (NameToken.isNMTOKEN(nextRole.getName()))  {
		    result.addGoodDetails(smh.getLocalString
					  ("tests.componentNameConstructor",
					   "For [ {0} ]",
					   new Object[] {compName.toString()}));
		    result.addGoodDetails
			(smh.getLocalString
			 (getClass().getName() + ".passed",
			  "Role name [ {0} ] conforms to the lexical rules of NMTOKEN within bean [ {1} ]",
			  new Object[] {nextRole.getName(), descriptor.getName()}));
		    if (result.getStatus()!= Result.FAILED)
			result.setStatus(Result.PASSED);
		} else {
		    result.addErrorDetails(smh.getLocalString
					   ("tests.componentNameConstructor",
					    "For [ {0} ]",
					    new Object[] {compName.toString()}));
		    result.failed
			(smh.getLocalString
			 (getClass().getName() + ".failed",
			  "Role name [ {0} ] does not conform to the lexical rules of NMTOKEN within bean [ {1} ]",
			  new Object[] {nextRole.getName(), descriptor.getName()}));
		}
	    } 
	} else {
	    result.addNaDetails(smh.getLocalString
				("tests.componentNameConstructor",
				 "For [ {0} ]",
				 new Object[] {compName.toString()}));
	    result.notApplicable(smh.getLocalString
				 (getClass().getName() + ".notApplicable",
				  "No permissioned roles defined for this bean [ {0} ]",
				  new Object[] {descriptor.getName()}));
	} 
	return result;