container/services/src/main/java/org/mobicents/slee/container/deployment/ConcreteSbbGenerator.java
protected void createGetSbbActivityContextInterfaceMethod(
			CtClass activityContextInterface,
			Class<?> concreteActivityContextInterfaceClass)
			throws DeploymentException {
		String methodToAdd = "public "
				+ activityContextInterface.getName()
				+ " asSbbActivityContextInterface(javax.slee.ActivityContextInterface aci) {"
				+ "if(aci==null)"
				+ "     throw new "
				+ IllegalStateException.class.getName()
				+ "(\"Passed argument can not be of null value.\");"
				+ " if(sbbEntity == null || sbbEntity.getSbbObject().getState() != "
				+ SbbObjectState.class.getName() + ".READY) { throw new "
				+ IllegalStateException.class.getName()
				+ "(\"Cannot call asSbbActivityContextInterface\"); } "
				+ "else if ( aci instanceof "
				+ concreteActivityContextInterfaceClass.getName()
				+ ") return aci;" + "else return  new "
				+ concreteActivityContextInterfaceClass.getName() + " ( (" + ActivityContextInterface.class.getName() + ") $1, "
				+ "sbbEntity.getSbbComponent());" + "}";
		CtMethod methodTest;
		try {
			methodTest = CtNewMethod.make(methodToAdd, sbbConcreteClass);
			sbbConcreteClass.addMethod(methodTest);
			if (logger.isTraceEnabled()) {
				logger.trace("Method " + methodToAdd + " added");
			}
		} catch (CannotCompileException e) {
			throw new DeploymentException(e.getMessage(), e);
		}
	}
protected void createGetSbbActivityContextInterfaceMethod(
			CtClass activityContextInterface,
			Class<?> concreteActivityContextInterfaceClass)
			throws DeploymentException {
		String methodToAdd = "public "
				+ activityContextInterface.getName()
				+ " asSbbActivityContextInterface(javax.slee.ActivityContextInterface aci) {"
				+ "if(aci==null)"
				+ "     throw new "
				+ IllegalStateException.class.getName()
				+ "(\"Passed argument can not be of null value.\");"
				+ " if(sbbEntity == null || sbbEntity.getSbbObject().getState() != "
				+ SbbObjectState.class.getName() + ".READY) { throw new "
				+ IllegalStateException.class.getName()
				+ "(\"Cannot call asSbbActivityContextInterface\"); } "
				+ "else if ( aci instanceof "
				+ concreteActivityContextInterfaceClass.getName()
				+ ") return aci;" + "else return  new "
				+ concreteActivityContextInterfaceClass.getName() + " ( (" + ActivityContextInterface.class.getName() + ") $1, "
				+ "sbbEntity.getSbbComponent());" + "}";
		CtMethod methodTest;
		try {
			methodTest = CtNewMethod.make(methodToAdd, sbbConcreteClass);
			sbbConcreteClass.addMethod(methodTest);
			if (logger.isTraceEnabled()) {
				logger.trace("Method " + methodToAdd + " added");
			}
		} catch (CannotCompileException e) {
			throw new DeploymentException(e.getMessage(), e);
		}
	}
protected void createGetSbbActivityContextInterfaceMethod ( CtClass activityContextInterface , Class < ? > concreteActivityContextInterfaceClass ) throws DeploymentException { String methodToAdd = "public " + activityContextInterface . getName ( ) + " asSbbActivityContextInterface(javax.slee.ActivityContextInterface aci) {" + "if(aci==null)" + "     throw new " + IllegalStateException . class . getName ( ) + "(\"Passed argument can not be of null value.\");" + " if(sbbEntity == null || sbbEntity.getSbbObject().getState() != " + SbbObjectState . class . getName ( ) + ".READY) { throw new " + IllegalStateException . class . getName ( ) + "(\"Cannot call asSbbActivityContextInterface\"); } " + "else if ( aci instanceof " + concreteActivityContextInterfaceClass . getName ( ) + ") return aci;" + "else return  new " + concreteActivityContextInterfaceClass . getName ( ) + " ( (" + ActivityContextInterface . class . getName ( ) + ") $1, " + "sbbEntity.getSbbComponent());" + "}" ; CtMethod methodTest ; try { methodTest = CtNewMethod . make ( methodToAdd , sbbConcreteClass ) ; sbbConcreteClass . addMethod ( methodTest ) ; if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Method " + methodToAdd + " added" ) ; } } catch ( CannotCompileException e ) { throw new DeploymentException ( e . getMessage ( ) , e ) ; } }
Create the narrow method to get the activity context interface

@param activityContextInterface
the activity context interface return type of the narrow
method
@param concreteActivityContextInterfaceClass
@throws DeploymentException
Create the narrow method to get the activity context interface