container/components/components/src/main/java/org/mobicents/slee/container/component/validator/SbbComponentValidator.java
boolean validateAbstractClassConstraints(Map<String, Method> concreteMethods, Map<String, Method> concreteSuperClassesMethods) {

		String errorBuffer = new String("");
		boolean passed = true;
		// Presence of those classes must be checked elsewhere
		Class sbbAbstractClass = this.component.getAbstractSbbClass();

		// Must be public and abstract
		int modifiers = sbbAbstractClass.getModifiers();
		// check that the class modifiers contain abstratc and public
		if (!Modifier.isAbstract(modifiers) || !Modifier.isPublic(modifiers)) {
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + "sbb abstract class must be public and abstract", "6.1", errorBuffer);
		}

		// 1.1 - must be in package
		if (this.component.isSlee11()) {
			Package declaredPackage = sbbAbstractClass.getPackage();
			if (declaredPackage == null || declaredPackage.getName().compareTo("") == 0) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + "sbb abstract class must be defined inside package space", "6.1",
						errorBuffer);
			}

		}

		// Public no arg constructor - can it have more ?
		// sbbAbstractClass.getConstructor
		// FIXME: no arg constructor has signature "()V" when added from
		// javaassist we check for such constructor and if its public
		try {
			Constructor constructor = sbbAbstractClass.getConstructor();
			int conMod = constructor.getModifiers();
			if (!Modifier.isPublic(conMod)) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + "sbb abstract class must have public constructor ", "6.1",
						errorBuffer);
			}
		} catch (SecurityException e) {

			e.printStackTrace();
			passed = false;
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + "sbb abstract class must have no arg constructor, error:"
					+ e.getMessage(), "6.1", errorBuffer);
		} catch (NoSuchMethodException e) {

			e.printStackTrace();
			passed = false;
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + "sbb abstract class must have no arg constructor, error:"
					+ e.getMessage(), "6.1", errorBuffer);
		}

		// Must implements javax.slee.Sbb - and each method there defined, only
		// those methods and two above can have "sbb" prefix
		// those methods MUST be in concrete methods map, later we will use them
		// to see if there is ant "sbbXXXX" method

		// Check if we implement javax.slee.Sbb - either directly or from super
		// class
		Class javaxSleeSbbInterface = ClassUtils.checkInterfaces(sbbAbstractClass, "javax.slee.Sbb");
		
		// sbbAbstractClass.getI
		if (javaxSleeSbbInterface == null) {

			passed = false;
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
					+ "sbb abstract class  must implement, directly or indirectly, the javax.slee.Sbb interface.", "6.1", errorBuffer);
		}

		// FIXME: add check for finalize method

		// Now we have to check methods from javax.slee.Sbb
		// This takes care of method throws clauses
		if (javaxSleeSbbInterface != null) {
			// if it is, we dont have those methods for sure, or maybe we do,
			// implemnted by hand
			// either way its a failure
			// We want only java.slee.Sbb methods :)
			Method[] sbbLifecycleMethods = javaxSleeSbbInterface.getDeclaredMethods();
			for (Method lifecycleMehtod : sbbLifecycleMethods) {
				// It must be implemented - so only in concrete methods, if we
				// are left with one not checked bang, its an error

				String methodKey = ClassUtils.getMethodKey(lifecycleMehtod);
				Method concreteLifeCycleImpl = null;
				if (concreteMethods.containsKey(methodKey)) {
					concreteLifeCycleImpl = concreteMethods.remove(methodKey);
				} else if (concreteSuperClassesMethods.containsKey(methodKey)) {
					concreteLifeCycleImpl = concreteSuperClassesMethods.remove(methodKey);
				} else {
					passed = false;
					errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
							+ "sbb abstract class must implement life cycle methods, it lacks concrete implementation of: "
							+ lifecycleMehtod.getName(), "6.1.1", errorBuffer);
					continue;
				}

				// now we now there is such method, its not private and abstract
				// If we are here its not null
				int lifeCycleModifier = concreteLifeCycleImpl.getModifiers();
				if (!Modifier.isPublic(lifeCycleModifier) || Modifier.isStatic(lifeCycleModifier) || Modifier.isFinal(lifeCycleModifier)) {
					passed = false;
					errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
							+ "sbb abstract class must implement life cycle methods, which can not be static, final or not public, method: "
							+ lifecycleMehtod.getName(), "6.1.1", errorBuffer);
				}

			}
		}

		// there can not be any method which start with ejb/sbb - we removed
		// every from concrete, lets iterate over those sets
		for (Method concreteMethod : concreteMethods.values()) {

			if (concreteMethod.getName().startsWith("ejb") || concreteMethod.getName().startsWith("sbb")) {

				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " with method:  " + concreteMethod.getName(), "6.12", errorBuffer);

			}

			if (concreteMethod.getName().compareTo("finalize") == 0) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + "sbb abstract class  must not implement \"finalize\" method.",
						"6.1", errorBuffer);
			}
		}

		for (Method concreteMethod : concreteSuperClassesMethods.values()) {
			if (concreteMethod.getName().startsWith("ejb") || concreteMethod.getName().startsWith("sbb")) {

				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " with method from super classes:  " + concreteMethod.getName(),
						"6.12", errorBuffer);

			}

			if (concreteMethod.getName().compareTo("finalize") == 0) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
						+ "sbb abstract class  must not implement \"finalize\" method. Its implemented by super class.", "6.1", errorBuffer);
			}

		}

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

		return passed;

	}
boolean validateAbstractClassConstraints(Map<String, Method> concreteMethods, Map<String, Method> concreteSuperClassesMethods) {

		String errorBuffer = new String("");
		boolean passed = true;
		// Presence of those classes must be checked elsewhere
		Class sbbAbstractClass = this.component.getAbstractSbbClass();

		// Must be public and abstract
		int modifiers = sbbAbstractClass.getModifiers();
		// check that the class modifiers contain abstratc and public
		if (!Modifier.isAbstract(modifiers) || !Modifier.isPublic(modifiers)) {
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + "sbb abstract class must be public and abstract", "6.1", errorBuffer);
		}

		// 1.1 - must be in package
		if (this.component.isSlee11()) {
			Package declaredPackage = sbbAbstractClass.getPackage();
			if (declaredPackage == null || declaredPackage.getName().compareTo("") == 0) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + "sbb abstract class must be defined inside package space", "6.1",
						errorBuffer);
			}

		}

		// Public no arg constructor - can it have more ?
		// sbbAbstractClass.getConstructor
		// FIXME: no arg constructor has signature "()V" when added from
		// javaassist we check for such constructor and if its public
		try {
			Constructor constructor = sbbAbstractClass.getConstructor();
			int conMod = constructor.getModifiers();
			if (!Modifier.isPublic(conMod)) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + "sbb abstract class must have public constructor ", "6.1",
						errorBuffer);
			}
		} catch (SecurityException e) {

			e.printStackTrace();
			passed = false;
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + "sbb abstract class must have no arg constructor, error:"
					+ e.getMessage(), "6.1", errorBuffer);
		} catch (NoSuchMethodException e) {

			e.printStackTrace();
			passed = false;
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + "sbb abstract class must have no arg constructor, error:"
					+ e.getMessage(), "6.1", errorBuffer);
		}

		// Must implements javax.slee.Sbb - and each method there defined, only
		// those methods and two above can have "sbb" prefix
		// those methods MUST be in concrete methods map, later we will use them
		// to see if there is ant "sbbXXXX" method

		// Check if we implement javax.slee.Sbb - either directly or from super
		// class
		Class javaxSleeSbbInterface = ClassUtils.checkInterfaces(sbbAbstractClass, "javax.slee.Sbb");
		
		// sbbAbstractClass.getI
		if (javaxSleeSbbInterface == null) {

			passed = false;
			errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
					+ "sbb abstract class  must implement, directly or indirectly, the javax.slee.Sbb interface.", "6.1", errorBuffer);
		}

		// FIXME: add check for finalize method

		// Now we have to check methods from javax.slee.Sbb
		// This takes care of method throws clauses
		if (javaxSleeSbbInterface != null) {
			// if it is, we dont have those methods for sure, or maybe we do,
			// implemnted by hand
			// either way its a failure
			// We want only java.slee.Sbb methods :)
			Method[] sbbLifecycleMethods = javaxSleeSbbInterface.getDeclaredMethods();
			for (Method lifecycleMehtod : sbbLifecycleMethods) {
				// It must be implemented - so only in concrete methods, if we
				// are left with one not checked bang, its an error

				String methodKey = ClassUtils.getMethodKey(lifecycleMehtod);
				Method concreteLifeCycleImpl = null;
				if (concreteMethods.containsKey(methodKey)) {
					concreteLifeCycleImpl = concreteMethods.remove(methodKey);
				} else if (concreteSuperClassesMethods.containsKey(methodKey)) {
					concreteLifeCycleImpl = concreteSuperClassesMethods.remove(methodKey);
				} else {
					passed = false;
					errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
							+ "sbb abstract class must implement life cycle methods, it lacks concrete implementation of: "
							+ lifecycleMehtod.getName(), "6.1.1", errorBuffer);
					continue;
				}

				// now we now there is such method, its not private and abstract
				// If we are here its not null
				int lifeCycleModifier = concreteLifeCycleImpl.getModifiers();
				if (!Modifier.isPublic(lifeCycleModifier) || Modifier.isStatic(lifeCycleModifier) || Modifier.isFinal(lifeCycleModifier)) {
					passed = false;
					errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
							+ "sbb abstract class must implement life cycle methods, which can not be static, final or not public, method: "
							+ lifecycleMehtod.getName(), "6.1.1", errorBuffer);
				}

			}
		}

		// there can not be any method which start with ejb/sbb - we removed
		// every from concrete, lets iterate over those sets
		for (Method concreteMethod : concreteMethods.values()) {

			if (concreteMethod.getName().startsWith("ejb") || concreteMethod.getName().startsWith("sbb")) {

				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " with method:  " + concreteMethod.getName(), "6.12", errorBuffer);

			}

			if (concreteMethod.getName().compareTo("finalize") == 0) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + "sbb abstract class  must not implement \"finalize\" method.",
						"6.1", errorBuffer);
			}
		}

		for (Method concreteMethod : concreteSuperClassesMethods.values()) {
			if (concreteMethod.getName().startsWith("ejb") || concreteMethod.getName().startsWith("sbb")) {

				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass() + " with method from super classes:  " + concreteMethod.getName(),
						"6.12", errorBuffer);

			}

			if (concreteMethod.getName().compareTo("finalize") == 0) {
				passed = false;
				errorBuffer = appendToBuffer(this.component.getAbstractSbbClass()
						+ "sbb abstract class  must not implement \"finalize\" method. Its implemented by super class.", "6.1", errorBuffer);
			}

		}

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

		return passed;

	}
boolean validateAbstractClassConstraints ( Map < String , Method > concreteMethods , Map < String , Method > concreteSuperClassesMethods ) { String errorBuffer = new String ( "" ) ; boolean passed = true ; // Presence of those classes must be checked elsewhere
 Class sbbAbstractClass = this . component . getAbstractSbbClass ( ) ; // Must be public and abstract
 int modifiers = sbbAbstractClass . getModifiers ( ) ; // check that the class modifiers contain abstratc and public
 if ( ! Modifier . isAbstract ( modifiers ) || ! Modifier . isPublic ( modifiers ) ) { errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must be public and abstract" , "6.1" , errorBuffer ) ; } // 1.1 - must be in package
 if ( this . component . isSlee11 ( ) ) { Package declaredPackage = sbbAbstractClass . getPackage ( ) ; if ( declaredPackage == null || declaredPackage . getName ( ) . compareTo ( "" ) == 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must be defined inside package space" , "6.1" , errorBuffer ) ; } } // Public no arg constructor - can it have more ?
 // sbbAbstractClass.getConstructor
 // FIXME: no arg constructor has signature "()V" when added from
 // javaassist we check for such constructor and if its public
 try { Constructor constructor = sbbAbstractClass . getConstructor ( ) ; int conMod = constructor . getModifiers ( ) ; if ( ! Modifier . isPublic ( conMod ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must have public constructor " , "6.1" , errorBuffer ) ; } } catch ( SecurityException e ) { e . printStackTrace ( ) ; passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must have no arg constructor, error:" + e . getMessage ( ) , "6.1" , errorBuffer ) ; } catch ( NoSuchMethodException e ) { e . printStackTrace ( ) ; passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must have no arg constructor, error:" + e . getMessage ( ) , "6.1" , errorBuffer ) ; } // Must implements javax.slee.Sbb - and each method there defined, only
 // those methods and two above can have "sbb" prefix
 // those methods MUST be in concrete methods map, later we will use them
 // to see if there is ant "sbbXXXX" method
 // Check if we implement javax.slee.Sbb - either directly or from super
 // class
 Class javaxSleeSbbInterface = ClassUtils . checkInterfaces ( sbbAbstractClass , "javax.slee.Sbb" ) ; // sbbAbstractClass.getI
 if ( javaxSleeSbbInterface == null ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class  must implement, directly or indirectly, the javax.slee.Sbb interface." , "6.1" , errorBuffer ) ; } // FIXME: add check for finalize method
 // Now we have to check methods from javax.slee.Sbb
 // This takes care of method throws clauses
 if ( javaxSleeSbbInterface != null ) { // if it is, we dont have those methods for sure, or maybe we do,
 // implemnted by hand
 // either way its a failure
 // We want only java.slee.Sbb methods :)
 Method [ ] sbbLifecycleMethods = javaxSleeSbbInterface . getDeclaredMethods ( ) ; for ( Method lifecycleMehtod : sbbLifecycleMethods ) { // It must be implemented - so only in concrete methods, if we
 // are left with one not checked bang, its an error
 String methodKey = ClassUtils . getMethodKey ( lifecycleMehtod ) ; Method concreteLifeCycleImpl = null ; if ( concreteMethods . containsKey ( methodKey ) ) { concreteLifeCycleImpl = concreteMethods . remove ( methodKey ) ; } else if ( concreteSuperClassesMethods . containsKey ( methodKey ) ) { concreteLifeCycleImpl = concreteSuperClassesMethods . remove ( methodKey ) ; } else { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must implement life cycle methods, it lacks concrete implementation of: " + lifecycleMehtod . getName ( ) , "6.1.1" , errorBuffer ) ; continue ; } // now we now there is such method, its not private and abstract
 // If we are here its not null
 int lifeCycleModifier = concreteLifeCycleImpl . getModifiers ( ) ; if ( ! Modifier . isPublic ( lifeCycleModifier ) || Modifier . isStatic ( lifeCycleModifier ) || Modifier . isFinal ( lifeCycleModifier ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class must implement life cycle methods, which can not be static, final or not public, method: " + lifecycleMehtod . getName ( ) , "6.1.1" , errorBuffer ) ; } } } // there can not be any method which start with ejb/sbb - we removed
 // every from concrete, lets iterate over those sets
 for ( Method concreteMethod : concreteMethods . values ( ) ) { if ( concreteMethod . getName ( ) . startsWith ( "ejb" ) || concreteMethod . getName ( ) . startsWith ( "sbb" ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " with method:  " + concreteMethod . getName ( ) , "6.12" , errorBuffer ) ; } if ( concreteMethod . getName ( ) . compareTo ( "finalize" ) == 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class  must not implement \"finalize\" method." , "6.1" , errorBuffer ) ; } } for ( Method concreteMethod : concreteSuperClassesMethods . values ( ) ) { if ( concreteMethod . getName ( ) . startsWith ( "ejb" ) || concreteMethod . getName ( ) . startsWith ( "sbb" ) ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + " with method from super classes:  " + concreteMethod . getName ( ) , "6.12" , errorBuffer ) ; } if ( concreteMethod . getName ( ) . compareTo ( "finalize" ) == 0 ) { passed = false ; errorBuffer = appendToBuffer ( this . component . getAbstractSbbClass ( ) + "sbb abstract class  must not implement \"finalize\" method. Its implemented by super class." , "6.1" , errorBuffer ) ; } } if ( ! passed ) { logger . error ( errorBuffer ) ; } return passed ; }
Sbb abstract class(general rule � methods cannot start neither with �ejb�
nor �sbb�)
<ul>
<li>(1.1 ?) must have package declaration
<li>must implement in some way javax.slee.Sbb(only methods from interface
can have �sbb� prefix)
<ul>
<li>each method defined must be implemented as public � not abstract,
final or static
</ul>
<li>must be public and abstract
<li>must have public no arg constructor
<li>must implement sbbExceptionThrown method
<ul>
<li>
public, not abstract, final or static no return type 3 arguments:
java.lang.Exception, java.lang.Object,
javax.slee.ActivityContextInterface
</ul>
<li>must implement sbbRolledBack
<ul>
<li>method must be public, not abstract, final or static
<li>no return type
<li>with single argument - javax.slee.RoledBackContext
</ul>
<li>there is no finalize method
</ul>

@return
Sbb abstract class ( general rule � methods cannot start neither with �ejb� nor �sbb� ) <ul > <li > ( 1 . 1 ? ) must have package declaration <li > must implement in some way javax . slee . Sbb ( only methods from interface can have �sbb� prefix ) <ul > <li > each method defined must be implemented as public � not abstract final or static < / ul > <li > must be public and abstract <li > must have public no arg constructor <li > must implement sbbExceptionThrown method <ul > <li > public not abstract final or static no return type 3 arguments : java . lang . Exception java . lang . Object javax . slee . ActivityContextInterface < / ul > <li > must implement sbbRolledBack <ul > <li > method must be public not abstract final or static <li > no return type <li > with single argument - javax . slee . RoledBackContext < / ul > <li > there is no finalize method < / ul >