public Class generateSbbLocalObjectConcreteClass ( ) { //Generates the implements link if ( logger . isTraceEnabled ( ) ) { logger . trace ( "generateSbbLocalObjectConcreteClass: sbbLocalObjectInterface = " + sbbLocalObjectName + " deployPath = " + deployPath ) ; } try { concreteSbbLocalObject = pool . makeClass ( ConcreteClassGeneratorUtils . SBB_LOCAL_OBJECT_CLASS_NAME_PREFIX + sbbLocalObjectName + ConcreteClassGeneratorUtils . SBB_LOCAL_OBJECT_CLASS_NAME_SUFFIX ) ; try { sleeSbbLocalObject = pool . get ( SbbLocalObjectImpl . class . getName ( ) ) ; sbbLocalObjectInterface = pool . get ( sbbLocalObjectName ) ; } catch ( NotFoundException nfe ) { nfe . printStackTrace ( ) ; String s = "Problem with pool " ; logger . error ( s , nfe ) ; throw new RuntimeException ( s , nfe ) ; } // This is our implementation interface. CtClass concreteClassInterface ; try { concreteClassInterface = pool . get ( SbbLocalObjectConcrete . class . getName ( ) ) ; } catch ( NotFoundException nfe ) { nfe . printStackTrace ( ) ; String s = "Problem with the pool! " ; logger . error ( s , nfe ) ; throw new RuntimeException ( s , nfe ) ; } ConcreteClassGeneratorUtils . createInterfaceLinks ( concreteSbbLocalObject , new CtClass [ ] { sbbLocalObjectInterface , concreteClassInterface } ) ; //Generates an inheritance link to the slee implementation of the // SbbLocalObject interface ConcreteClassGeneratorUtils . createInheritanceLink ( concreteSbbLocalObject , sleeSbbLocalObject ) ; //Generates the methods to implement from the interface Map interfaceMethods = ClassUtils . getInterfaceMethodsFromInterface ( sbbLocalObjectInterface ) ; generateConcreteMethods ( interfaceMethods , sbbAbstractClassName ) ; try { concreteSbbLocalObject . writeFile ( deployPath ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Concrete Class " + concreteSbbLocalObject . getName ( ) + " generated in the following path " + deployPath ) ; } } catch ( CannotCompileException e ) { String s = " Unexpected exception ! " ; logger . fatal ( s , e ) ; throw new RuntimeException ( s , e ) ; } catch ( IOException e ) { String s = "IO Exception!" ; logger . error ( s , e ) ; return null ; } //load the class try { return Thread . currentThread ( ) . getContextClassLoader ( ) . loadClass ( concreteSbbLocalObject . getName ( ) ) ; } catch ( ClassNotFoundException e ) { logger . error ( "unable to load sbb local object impl class" , e ) ; return null ; } } finally { if ( this . concreteSbbLocalObject != null ) this . concreteSbbLocalObject . defrost ( ) ; } }
Generate the Sbb Local Object Class