container/components/components/src/main/java/org/mobicents/slee/container/component/validator/SbbComponentValidator.java
boolean validateSbbActivityContextInterface(Map<String, Method> sbbAbstractClassAbstraMethod,
			Map<String, Method> sbbAbstractClassAbstraMethodFromSuperClasses) {

		if (this.component.getDescriptor().getSbbActivityContextInterface() == null) {
			// FIXME: add check for asSbbActivityContextInteface method ? This
			// will be catched at the end of check anyway
			if (logger.isTraceEnabled()) {
				logger.trace(this.component.getDescriptor().getSbbID() + " : No Sbb activity context interface defined");
			}
			return true;
		}

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

		Method asACIMethod = null;

		// lets go through methods of sbbAbstract class,
		Iterator<Method> it = sbbAbstractClassAbstraMethod.values().iterator();
		while(it.hasNext())
		{
			Method someMethod = it.next();
	
			if (someMethod.getName().compareTo(_SBB_AS_SBB_ACTIVITY_CONTEXT_INTERFACE) == 0) {
				// we have a winner, possibly - we have to check parameter
				// list, cause someone can create abstract method(or crap,
				// it can be concrete) with different parametrs, in case its
				// abstract, it will fail later on	


				if (someMethod.getParameterTypes().length == 1
						&& someMethod.getParameterTypes()[0].getName().compareTo("javax.slee.ActivityContextInterface") == 0) {
					asACIMethod = someMethod;

					it.remove();
					break;
				}
			}
		}
		

		if (asACIMethod == null)
			it = sbbAbstractClassAbstraMethodFromSuperClasses.values().iterator();
		while(it.hasNext())
		{
			Method someMethod = it.next();

				if (someMethod.getName().compareTo(_SBB_AS_SBB_ACTIVITY_CONTEXT_INTERFACE) == 0) {
					// we have a winner, possibly - we have to check
					// parameter
					// list, cause someone can create abstract method(or
					// crap,
					// it can be concrete) with different parametrs, in case
					// its
					// abstract, it will fail later on

					if (someMethod.getParameterTypes().length == 1
							&& someMethod.getParameterTypes()[0].getName().compareTo("javax.slee.ActivityContextInterface") == 0) {
						asACIMethod = someMethod;
	
						it.remove();
						break;
					}
				}
			}
		if (asACIMethod == null) {
			passed = false;
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " must imlement narrow method asSbbActivityContextInterface",
					"7.7.2", errorBuffer);

		} else {
			// must be public, abstract? FIXME: not native?
			int asACIMethodModifiers = asACIMethod.getModifiers();
			if (!Modifier.isPublic(asACIMethodModifiers) || !Modifier.isAbstract(asACIMethodModifiers) || Modifier.isNative(asACIMethodModifiers)) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
						+ " narrow method asSbbActivityContextInterface must be public,abstract and not native.", "7.7.2", errorBuffer);
			}

			// now this misery comes to play, return type check
			Class returnType = asACIMethod.getReturnType();
			// Must return something from Sbb defined aci class inheritance
			// tree
			Class definedReturnType = this.component.getActivityContextInterface();

			if (returnType.getName().compareTo("void") == 0) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
						+ " narrow method asSbbActivityContextInterface must have return type.", "7.7.2", errorBuffer);
			} else if (returnType.equals(definedReturnType)) {
				// its ok

				// } else if (ClassUtils.checkInterfaces(definedReturnType,
				// returnType
				// .getName()) != null) {

			} else {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
						+ " narrow method asSbbActivityContextInterface has wrong return type: " + returnType, "7.7.2", errorBuffer);

			}

			// no throws clause
			if (asACIMethod.getExceptionTypes() != null && asACIMethod.getExceptionTypes().length > 0) {

				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
						+ " narrow method asSbbActivityContextInterface must not have throws clause.", "7.7.2", errorBuffer);
			}

		}

		// Even if we fail above we can do some checks on ACI if its present.
		// this has to be present
		Class sbbActivityContextInterface = this.component.getActivityContextInterface();

		// ACI VALIDATION
		// (1.1) = must be declared in package

		if (this.component.isSlee11() && sbbActivityContextInterface.getPackage() == null) {
			passed = false;
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " sbb activity context interface must be declared in package.",
					"7.5", errorBuffer);
		}

		if (!Modifier.isPublic(sbbActivityContextInterface.getModifiers())) {
			passed = false;
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " sbb activity context interface must be declared as public.", "7.5",
					errorBuffer);
		}

		// We can have here ACI objects and java primitives, ugh, both methods
		// dont have to be shown
		passed = checkSbbAciFieldsConstraints(this.component.getActivityContextInterface());

		// finally lets remove asSbb method form abstract lists, this is used
		// later to determine methods that didnt match any sbb definition
		if (asACIMethod != null) {
			sbbAbstractClassAbstraMethod.remove(ClassUtils.getMethodKey(asACIMethod));
			sbbAbstractClassAbstraMethodFromSuperClasses.remove(ClassUtils.getMethodKey(asACIMethod));
		}

		if (!passed) {
			logger.error(errorBuffer);		
		}

		return passed;
	}
boolean validateSbbActivityContextInterface(Map<String, Method> sbbAbstractClassAbstraMethod,
			Map<String, Method> sbbAbstractClassAbstraMethodFromSuperClasses) {

		if (this.component.getDescriptor().getSbbActivityContextInterface() == null) {
			// FIXME: add check for asSbbActivityContextInteface method ? This
			// will be catched at the end of check anyway
			if (logger.isTraceEnabled()) {
				logger.trace(this.component.getDescriptor().getSbbID() + " : No Sbb activity context interface defined");
			}
			return true;
		}

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

		Method asACIMethod = null;

		// lets go through methods of sbbAbstract class,
		Iterator<Method> it = sbbAbstractClassAbstraMethod.values().iterator();
		while(it.hasNext())
		{
			Method someMethod = it.next();
	
			if (someMethod.getName().compareTo(_SBB_AS_SBB_ACTIVITY_CONTEXT_INTERFACE) == 0) {
				// we have a winner, possibly - we have to check parameter
				// list, cause someone can create abstract method(or crap,
				// it can be concrete) with different parametrs, in case its
				// abstract, it will fail later on	


				if (someMethod.getParameterTypes().length == 1
						&& someMethod.getParameterTypes()[0].getName().compareTo("javax.slee.ActivityContextInterface") == 0) {
					asACIMethod = someMethod;

					it.remove();
					break;
				}
			}
		}
		

		if (asACIMethod == null)
			it = sbbAbstractClassAbstraMethodFromSuperClasses.values().iterator();
		while(it.hasNext())
		{
			Method someMethod = it.next();

				if (someMethod.getName().compareTo(_SBB_AS_SBB_ACTIVITY_CONTEXT_INTERFACE) == 0) {
					// we have a winner, possibly - we have to check
					// parameter
					// list, cause someone can create abstract method(or
					// crap,
					// it can be concrete) with different parametrs, in case
					// its
					// abstract, it will fail later on

					if (someMethod.getParameterTypes().length == 1
							&& someMethod.getParameterTypes()[0].getName().compareTo("javax.slee.ActivityContextInterface") == 0) {
						asACIMethod = someMethod;
	
						it.remove();
						break;
					}
				}
			}
		if (asACIMethod == null) {
			passed = false;
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " must imlement narrow method asSbbActivityContextInterface",
					"7.7.2", errorBuffer);

		} else {
			// must be public, abstract? FIXME: not native?
			int asACIMethodModifiers = asACIMethod.getModifiers();
			if (!Modifier.isPublic(asACIMethodModifiers) || !Modifier.isAbstract(asACIMethodModifiers) || Modifier.isNative(asACIMethodModifiers)) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
						+ " narrow method asSbbActivityContextInterface must be public,abstract and not native.", "7.7.2", errorBuffer);
			}

			// now this misery comes to play, return type check
			Class returnType = asACIMethod.getReturnType();
			// Must return something from Sbb defined aci class inheritance
			// tree
			Class definedReturnType = this.component.getActivityContextInterface();

			if (returnType.getName().compareTo("void") == 0) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
						+ " narrow method asSbbActivityContextInterface must have return type.", "7.7.2", errorBuffer);
			} else if (returnType.equals(definedReturnType)) {
				// its ok

				// } else if (ClassUtils.checkInterfaces(definedReturnType,
				// returnType
				// .getName()) != null) {

			} else {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
						+ " narrow method asSbbActivityContextInterface has wrong return type: " + returnType, "7.7.2", errorBuffer);

			}

			// no throws clause
			if (asACIMethod.getExceptionTypes() != null && asACIMethod.getExceptionTypes().length > 0) {

				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
						+ " narrow method asSbbActivityContextInterface must not have throws clause.", "7.7.2", errorBuffer);
			}

		}

		// Even if we fail above we can do some checks on ACI if its present.
		// this has to be present
		Class sbbActivityContextInterface = this.component.getActivityContextInterface();

		// ACI VALIDATION
		// (1.1) = must be declared in package

		if (this.component.isSlee11() && sbbActivityContextInterface.getPackage() == null) {
			passed = false;
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " sbb activity context interface must be declared in package.",
					"7.5", errorBuffer);
		}

		if (!Modifier.isPublic(sbbActivityContextInterface.getModifiers())) {
			passed = false;
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " sbb activity context interface must be declared as public.", "7.5",
					errorBuffer);
		}

		// We can have here ACI objects and java primitives, ugh, both methods
		// dont have to be shown
		passed = checkSbbAciFieldsConstraints(this.component.getActivityContextInterface());

		// finally lets remove asSbb method form abstract lists, this is used
		// later to determine methods that didnt match any sbb definition
		if (asACIMethod != null) {
			sbbAbstractClassAbstraMethod.remove(ClassUtils.getMethodKey(asACIMethod));
			sbbAbstractClassAbstraMethodFromSuperClasses.remove(ClassUtils.getMethodKey(asACIMethod));
		}

		if (!passed) {
			logger.error(errorBuffer);		
		}

		return passed;
	}
boolean validateSbbActivityContextInterface ( Map < String , Method > sbbAbstractClassAbstraMethod , Map < String , Method > sbbAbstractClassAbstraMethodFromSuperClasses ) { if ( this . component . getDescriptor ( ) . getSbbActivityContextInterface ( ) == null ) { // FIXME: add check for asSbbActivityContextInteface method ? This
 // will be catched at the end of check anyway
 if ( logger . isTraceEnabled ( ) ) { logger . trace ( this . component . getDescriptor ( ) . getSbbID ( ) + " : No Sbb activity context interface defined" ) ; } return true ; } String errorBuffer = new String ( "" ) ; boolean passed = true ; Method asACIMethod = null ; // lets go through methods of sbbAbstract class,
 Iterator < Method > it = sbbAbstractClassAbstraMethod . values ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Method someMethod = it . next ( ) ; if ( someMethod . getName ( ) . compareTo ( _SBB_AS_SBB_ACTIVITY_CONTEXT_INTERFACE ) == 0 ) { // we have a winner, possibly - we have to check parameter
 // list, cause someone can create abstract method(or crap,
 // it can be concrete) with different parametrs, in case its
 // abstract, it will fail later on	
 if ( someMethod . getParameterTypes ( ) . length == 1 && someMethod . getParameterTypes ( ) [ 0 ] . getName ( ) . compareTo ( "javax.slee.ActivityContextInterface" ) == 0 ) { asACIMethod = someMethod ; it . remove ( ) ; break ; } } } if ( asACIMethod == null ) it = sbbAbstractClassAbstraMethodFromSuperClasses . values ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Method someMethod = it . next ( ) ; if ( someMethod . getName ( ) . compareTo ( _SBB_AS_SBB_ACTIVITY_CONTEXT_INTERFACE ) == 0 ) { // we have a winner, possibly - we have to check
 // parameter
 // list, cause someone can create abstract method(or
 // crap,
 // it can be concrete) with different parametrs, in case
 // its
 // abstract, it will fail later on
 if ( someMethod . getParameterTypes ( ) . length == 1 && someMethod . getParameterTypes ( ) [ 0 ] . getName ( ) . compareTo ( "javax.slee.ActivityContextInterface" ) == 0 ) { asACIMethod = someMethod ; it . remove ( ) ; break ; } } } if ( asACIMethod == null ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " must imlement narrow method asSbbActivityContextInterface" , "7.7.2" , errorBuffer ) ; } else { // must be public, abstract? FIXME: not native?
 int asACIMethodModifiers = asACIMethod . getModifiers ( ) ; if ( ! Modifier . isPublic ( asACIMethodModifiers ) || ! Modifier . isAbstract ( asACIMethodModifiers ) || Modifier . isNative ( asACIMethodModifiers ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " narrow method asSbbActivityContextInterface must be public,abstract and not native." , "7.7.2" , errorBuffer ) ; } // now this misery comes to play, return type check
 Class returnType = asACIMethod . getReturnType ( ) ; // Must return something from Sbb defined aci class inheritance
 // tree
 Class definedReturnType = this . component . getActivityContextInterface ( ) ; if ( returnType . getName ( ) . compareTo ( "void" ) == 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " narrow method asSbbActivityContextInterface must have return type." , "7.7.2" , errorBuffer ) ; } else if ( returnType . equals ( definedReturnType ) ) { // its ok
 // } else if (ClassUtils.checkInterfaces(definedReturnType,
 // returnType
 // .getName()) != null) {
 } else { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " narrow method asSbbActivityContextInterface has wrong return type: " + returnType , "7.7.2" , errorBuffer ) ; } // no throws clause
 if ( asACIMethod . getExceptionTypes ( ) != null && asACIMethod . getExceptionTypes ( ) . length > 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " narrow method asSbbActivityContextInterface must not have throws clause." , "7.7.2" , errorBuffer ) ; } } // Even if we fail above we can do some checks on ACI if its present.
 // this has to be present
 Class sbbActivityContextInterface = this . component . getActivityContextInterface ( ) ; // ACI VALIDATION
 // (1.1) = must be declared in package
 if ( this . component . isSlee11 ( ) && sbbActivityContextInterface . getPackage ( ) == null ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface must be declared in package." , "7.5" , errorBuffer ) ; } if ( ! Modifier . isPublic ( sbbActivityContextInterface . getModifiers ( ) ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " sbb activity context interface must be declared as public." , "7.5" , errorBuffer ) ; } // We can have here ACI objects and java primitives, ugh, both methods
 // dont have to be shown
 passed = checkSbbAciFieldsConstraints ( this . component . getActivityContextInterface ( ) ) ; // finally lets remove asSbb method form abstract lists, this is used
 // later to determine methods that didnt match any sbb definition
 if ( asACIMethod != null ) { sbbAbstractClassAbstraMethod . remove ( ClassUtils . getMethodKey ( asACIMethod ) ) ; sbbAbstractClassAbstraMethodFromSuperClasses . remove ( ClassUtils . getMethodKey ( asACIMethod ) ) ; } if ( ! passed ) { logger . error ( errorBuffer ) ; } return passed ; }
This method checks for presence of

@param sbbAbstractClassAbstraMethod
@param sbbAbstractClassAbstraMethodFromSuperClasses
@return
This method checks for presence of