public Class generateActivityContextInterfaceConcreteClass ( ) throws DeploymentException { String tmpClassName = ConcreteClassGeneratorUtils . CONCRETE_ACTIVITY_INTERFACE_CLASS_NAME_PREFIX + activityContextInterfaceName + ConcreteClassGeneratorUtils . CONCRETE_ACTIVITY_INTERFACE_CLASS_NAME_SUFFIX ; concreteActivityContextInterface = pool . makeClass ( tmpClassName ) ; CtClass sbbActivityContextInterface = null ; try { activityContextInterface = pool . get ( activityContextInterfaceName ) ; sbbActivityContextInterface = pool . get ( SbbActivityContextInterfaceImpl . class . getName ( ) ) ; } catch ( NotFoundException nfe ) { throw new DeploymentException ( "Could not find aci " + activityContextInterfaceName , nfe ) ; } // Generates the extends link ConcreteClassGeneratorUtils . createInheritanceLink ( concreteActivityContextInterface , sbbActivityContextInterface ) ; // Generates the implements link ConcreteClassGeneratorUtils . createInterfaceLinks ( concreteActivityContextInterface , new CtClass [ ] { activityContextInterface } ) ; // Generates the methods to implement from the interface Map interfaceMethods = ClassUtils . getInterfaceMethodsFromInterface ( activityContextInterface ) ; generateConcreteMethods ( interfaceMethods ) ; // generates the class String sbbDeploymentPathStr = deployDir ; try { concreteActivityContextInterface . writeFile ( sbbDeploymentPathStr ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Concrete Class " + tmpClassName + " generated in the following path " + sbbDeploymentPathStr ) ; } } catch ( Exception e ) { logger . error ( "problem generating concrete class" , e ) ; throw new DeploymentException ( "problem generating concrete class! " , e ) ; } // load the class Class clazz = null ; try { clazz = Thread . currentThread ( ) . getContextClassLoader ( ) . loadClass ( tmpClassName ) ; } catch ( Exception e1 ) { logger . error ( "problem loading generated class" , e1 ) ; throw new DeploymentException ( "problem loading the generated class! " , e1 ) ; } this . concreteActivityContextInterface . defrost ( ) ; return clazz ; }
Generate the Activity Context Interface Class