container/components/components/src/main/java/org/mobicents/slee/container/component/validator/SbbComponentValidator.java
boolean checkSbbAciFieldsConstraints(Class sbbAciInterface) {

		boolean passed = true;
		String errorBuffer = new String("");
		try {

			if (!sbbAciInterface.isInterface()) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " sbb activity context interface MUST be an interface.", "7.5",
						errorBuffer);
				return passed;
			}

			// here we need all fields :)
			HashSet<String> ignore = new HashSet<String>();
			ignore.add(ActivityContextInterfaceExt.class.getName());
			ignore.add(ActivityContextInterface.class.getName());

			// FIXME: we could go other way, run this for each super interface
			// we
			// have???

			Map<String, Method> aciInterfacesDefinedMethods = ClassUtils.getAllInterfacesMethods(sbbAciInterface, ignore);

			// Here we will store fields name-type - if there is getter and
			// setter,
			// type must match!!!
			Map<String, Class> localNameToType = new HashMap<String, Class>();

			for (String methodKey : aciInterfacesDefinedMethods.keySet()) {

				Method fieldMethod = aciInterfacesDefinedMethods.get(methodKey);
				String methodName = fieldMethod.getName();
				if (!(methodName.startsWith("get") || methodName.startsWith("set"))) {
					passed = false;
					errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
							+ " sbb activity context interface can have only getter/setter  methods.", "7.5.1", errorBuffer);
					continue;
				}

				// let us get field name:

				String fieldName = methodName.replaceFirst("set", "").replaceFirst("get", "");

				if (!Character.isUpperCase(fieldName.charAt(0))) {
					passed = false;
					errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
							+ " sbb activity context interface can have only getter/setter  methods - 4th char in those methods must be capital.",
							"7.5.1", errorBuffer);

				}

				// check throws clause.
				// number of parameters

				if (fieldMethod.getExceptionTypes().length > 0) {
					passed = false;
					errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
							+ " sbb activity context interface getter method must have empty throws clause: " + fieldMethod.getName(), "7.5.1",
							errorBuffer);

				}

				boolean isGetter = methodName.startsWith("get");
				Class fieldType = null;
				if (isGetter) {
					// no params
					if (fieldMethod.getParameterTypes() != null && fieldMethod.getParameterTypes().length > 0) {
						passed = false;
						errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
								+ " sbb activity context interface getter method must not have parameters: " + fieldMethod.getName(), "7.5.1",
								errorBuffer);

					}

					fieldType = fieldMethod.getReturnType();
					if (fieldType.getName().compareTo("void") == 0) {
						passed = false;
						errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
								+ " sbb activity context interface getter method must have return type: " + fieldMethod.getName(), "7.5.1",
								errorBuffer);

					}

				} else {
					if (fieldMethod.getParameterTypes() != null && fieldMethod.getParameterTypes().length != 1) {
						passed = false;
						errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
								+ " sbb activity context interface setter method must single parameter: " + fieldMethod.getName(), "7.5.1",
								errorBuffer);

						// Here we quick fail
						continue;
					}

					fieldType = fieldMethod.getParameterTypes()[0];
					if (fieldMethod.getReturnType().getName().compareTo("void") != 0) {
						passed = false;
						errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
								+ " sbb activity context interface setter method must not have return type: " + fieldMethod.getName(), "7.5.1",
								errorBuffer);

					}

				}

				// Field type can be primitive and serialzable
				if (!(_PRIMITIVES.contains(fieldType.getName()) || ClassUtils.checkInterfaces(fieldType, "java.io.Serializable") != null)) {
					passed = false;
					errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " sbb activity context interface field(" + fieldName
							+ ") has wrong type, only primitives and serializable: " + fieldType, "7.5.1", errorBuffer);
					// we fail here
					continue;
				}

				if (localNameToType.containsKey(fieldName)) {
					Class storedType = localNameToType.get(fieldName);
					if (!storedType.equals(fieldType)) {
						passed = false;

						errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
								+ " sbb activity context interface has wrong definition of parameter - setter and getter types do not match: "
								+ fieldName + ", type1: " + fieldType.getName() + " typ2:" + storedType.getName(), "7.5.1", errorBuffer);

						// we fail here
						continue;
					}
				} else {
					// simply store
					localNameToType.put(fieldName, fieldType);
				}

			}

			// FIXME: add check against components get aci fields ?
		} finally {
			if (!passed) {
				logger.error(errorBuffer);				
			}
		}

		return passed;
	}
boolean checkSbbAciFieldsConstraints(Class sbbAciInterface) {

		boolean passed = true;
		String errorBuffer = new String("");
		try {

			if (!sbbAciInterface.isInterface()) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " sbb activity context interface MUST be an interface.", "7.5",
						errorBuffer);
				return passed;
			}

			// here we need all fields :)
			HashSet<String> ignore = new HashSet<String>();
			ignore.add(ActivityContextInterfaceExt.class.getName());
			ignore.add(ActivityContextInterface.class.getName());

			// FIXME: we could go other way, run this for each super interface
			// we
			// have???

			Map<String, Method> aciInterfacesDefinedMethods = ClassUtils.getAllInterfacesMethods(sbbAciInterface, ignore);

			// Here we will store fields name-type - if there is getter and
			// setter,
			// type must match!!!
			Map<String, Class> localNameToType = new HashMap<String, Class>();

			for (String methodKey : aciInterfacesDefinedMethods.keySet()) {

				Method fieldMethod = aciInterfacesDefinedMethods.get(methodKey);
				String methodName = fieldMethod.getName();
				if (!(methodName.startsWith("get") || methodName.startsWith("set"))) {
					passed = false;
					errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
							+ " sbb activity context interface can have only getter/setter  methods.", "7.5.1", errorBuffer);
					continue;
				}

				// let us get field name:

				String fieldName = methodName.replaceFirst("set", "").replaceFirst("get", "");

				if (!Character.isUpperCase(fieldName.charAt(0))) {
					passed = false;
					errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
							+ " sbb activity context interface can have only getter/setter  methods - 4th char in those methods must be capital.",
							"7.5.1", errorBuffer);

				}

				// check throws clause.
				// number of parameters

				if (fieldMethod.getExceptionTypes().length > 0) {
					passed = false;
					errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
							+ " sbb activity context interface getter method must have empty throws clause: " + fieldMethod.getName(), "7.5.1",
							errorBuffer);

				}

				boolean isGetter = methodName.startsWith("get");
				Class fieldType = null;
				if (isGetter) {
					// no params
					if (fieldMethod.getParameterTypes() != null && fieldMethod.getParameterTypes().length > 0) {
						passed = false;
						errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
								+ " sbb activity context interface getter method must not have parameters: " + fieldMethod.getName(), "7.5.1",
								errorBuffer);

					}

					fieldType = fieldMethod.getReturnType();
					if (fieldType.getName().compareTo("void") == 0) {
						passed = false;
						errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
								+ " sbb activity context interface getter method must have return type: " + fieldMethod.getName(), "7.5.1",
								errorBuffer);

					}

				} else {
					if (fieldMethod.getParameterTypes() != null && fieldMethod.getParameterTypes().length != 1) {
						passed = false;
						errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
								+ " sbb activity context interface setter method must single parameter: " + fieldMethod.getName(), "7.5.1",
								errorBuffer);

						// Here we quick fail
						continue;
					}

					fieldType = fieldMethod.getParameterTypes()[0];
					if (fieldMethod.getReturnType().getName().compareTo("void") != 0) {
						passed = false;
						errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
								+ " sbb activity context interface setter method must not have return type: " + fieldMethod.getName(), "7.5.1",
								errorBuffer);

					}

				}

				// Field type can be primitive and serialzable
				if (!(_PRIMITIVES.contains(fieldType.getName()) || ClassUtils.checkInterfaces(fieldType, "java.io.Serializable") != null)) {
					passed = false;
					errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " sbb activity context interface field(" + fieldName
							+ ") has wrong type, only primitives and serializable: " + fieldType, "7.5.1", errorBuffer);
					// we fail here
					continue;
				}

				if (localNameToType.containsKey(fieldName)) {
					Class storedType = localNameToType.get(fieldName);
					if (!storedType.equals(fieldType)) {
						passed = false;

						errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
								+ " sbb activity context interface has wrong definition of parameter - setter and getter types do not match: "
								+ fieldName + ", type1: " + fieldType.getName() + " typ2:" + storedType.getName(), "7.5.1", errorBuffer);

						// we fail here
						continue;
					}
				} else {
					// simply store
					localNameToType.put(fieldName, fieldType);
				}

			}

			// FIXME: add check against components get aci fields ?
		} finally {
			if (!passed) {
				logger.error(errorBuffer);				
			}
		}

		return passed;
	}
boolean checkSbbAciFieldsConstraints ( Class sbbAciInterface ) { boolean passed = true ; String errorBuffer = new String ( "" ) ; try { if ( ! sbbAciInterface . isInterface ( ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface MUST be an interface." , "7.5" , errorBuffer ) ; return passed ; } // here we need all fields :)
 HashSet < String > ignore = new HashSet < String > ( ) ; ignore . add ( ActivityContextInterfaceExt . class . getName ( ) ) ; ignore . add ( ActivityContextInterface . class . getName ( ) ) ; // FIXME: we could go other way, run this for each super interface
 // we
 // have???
 Map < String , Method > aciInterfacesDefinedMethods = ClassUtils . getAllInterfacesMethods ( sbbAciInterface , ignore ) ; // Here we will store fields name-type - if there is getter and
 // setter,
 // type must match!!!
 Map < String , Class > localNameToType = new HashMap < String , Class > ( ) ; for ( String methodKey : aciInterfacesDefinedMethods . keySet ( ) ) { Method fieldMethod = aciInterfacesDefinedMethods . get ( methodKey ) ; String methodName = fieldMethod . getName ( ) ; if ( ! ( methodName . startsWith ( "get" ) || methodName . startsWith ( "set" ) ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface can have only getter/setter  methods." , "7.5.1" , errorBuffer ) ; continue ; } // let us get field name:
 String fieldName = methodName . replaceFirst ( "set" , "" ) . replaceFirst ( "get" , "" ) ; if ( ! Character . isUpperCase ( fieldName . charAt ( 0 ) ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface can have only getter/setter  methods - 4th char in those methods must be capital." , "7.5.1" , errorBuffer ) ; } // check throws clause.
 // number of parameters
 if ( fieldMethod . getExceptionTypes ( ) . length > 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface getter method must have empty throws clause: " + fieldMethod . getName ( ) , "7.5.1" , errorBuffer ) ; } boolean isGetter = methodName . startsWith ( "get" ) ; Class fieldType = null ; if ( isGetter ) { // no params
 if ( fieldMethod . getParameterTypes ( ) != null && fieldMethod . getParameterTypes ( ) . length > 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface getter method must not have parameters: " + fieldMethod . getName ( ) , "7.5.1" , errorBuffer ) ; } fieldType = fieldMethod . getReturnType ( ) ; if ( fieldType . getName ( ) . compareTo ( "void" ) == 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface getter method must have return type: " + fieldMethod . getName ( ) , "7.5.1" , errorBuffer ) ; } } else { if ( fieldMethod . getParameterTypes ( ) != null && fieldMethod . getParameterTypes ( ) . length != 1 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface setter method must single parameter: " + fieldMethod . getName ( ) , "7.5.1" , errorBuffer ) ; // Here we quick fail
 continue ; } fieldType = fieldMethod . getParameterTypes ( ) [ 0 ] ; if ( fieldMethod . getReturnType ( ) . getName ( ) . compareTo ( "void" ) != 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface setter method must not have return type: " + fieldMethod . getName ( ) , "7.5.1" , errorBuffer ) ; } } // Field type can be primitive and serialzable
 if ( ! ( _PRIMITIVES . contains ( fieldType . getName ( ) ) || ClassUtils . checkInterfaces ( fieldType , "java.io.Serializable" ) != null ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface field(" + fieldName + ") has wrong type, only primitives and serializable: " + fieldType , "7.5.1" , errorBuffer ) ; // we fail here
 continue ; } if ( localNameToType . containsKey ( fieldName ) ) { Class storedType = localNameToType . get ( fieldName ) ; if ( ! storedType . equals ( fieldType ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface has wrong definition of parameter - setter and getter types do not match: " + fieldName + ", type1: " + fieldType . getName ( ) + " typ2:" + storedType . getName ( ) , "7.5.1" , errorBuffer ) ; // we fail here
 continue ; } } else { // simply store
 localNameToType . put ( fieldName , fieldType ) ; } } // FIXME: add check against components get aci fields ?
 } finally { if ( ! passed ) { logger . error ( errorBuffer ) ; } } return passed ; }
This method validates all methods in ACI interface:
<ul>
<li>set/get methods and parameter names as in CMP fields decalration
<li>methods must
<ul>
<li>be public, abstract
<li>setters must have one param
<li>getters return type must match setter type
<li>allowe types are: primitives and serilizable types
</ul>
</ul>
<br>
Sbb descriptor provides method to obtain aci field names, if this test
passes it means that all fields there should be correct and can be used
to verify aliases

@param sbbAciInterface
@return
This method validates all methods in ACI interface : <ul > <li > set / get methods and parameter names as in CMP fields decalration <li > methods must <ul > <li > be public abstract <li > setters must have one param <li > getters return type must match setter type <li > allowe types are : primitives and serilizable types < / ul > < / ul > <br > Sbb descriptor provides method to obtain aci field names if this test passes it means that all fields there should be correct and can be used to verify aliases