private void initStack ( ) { if ( log . isInfoEnabled ( ) ) { log . info ( "Initializing Stack..." ) ; } InputStream is = null ; try { //Parse dictionary, it is used for user friendly info. dictionary . parseDictionary ( this . getClass ( ) . getClassLoader ( ) . getResourceAsStream ( dictionaryFile ) ) ; log . info ( "AVP Dictionary successfully parsed." ) ; this . stack = new StackImpl ( ) ; //Parse stack configuration is = this . getClass ( ) . getClassLoader ( ) . getResourceAsStream ( configFile ) ; Configuration config = new XMLConfiguration ( is ) ; factory = stack . init ( config ) ; if ( log . isInfoEnabled ( ) ) { log . info ( "Stack Configuration successfully loaded." ) ; } //Print info about applicatio Set < org . jdiameter . api . ApplicationId > appIds = stack . getMetaData ( ) . getLocalPeer ( ) . getCommonApplications ( ) ; log . info ( "Diameter Stack :: Supporting " + appIds . size ( ) + " applications." ) ; for ( org . jdiameter . api . ApplicationId x : appIds ) { log . info ( "Diameter Stack :: Common :: " + x ) ; } is . close ( ) ; //Register network req listener, even though we wont receive requests //this has to be done to inform stack that we support application Network network = stack . unwrap ( Network . class ) ; network . addNetworkReqListener ( new NetworkReqListener ( ) { @ Override public Answer processRequest ( Request request ) { //this wontbe called. return null ; } } , this . authAppId ) ; //passing our example app id. } catch ( Exception e ) { e . printStackTrace ( ) ; if ( this . stack != null ) { this . stack . destroy ( ) ; } if ( is != null ) { try { is . close ( ) ; } catch ( IOException e1 ) { // TODO Auto-generated catch block e1 . printStackTrace ( ) ; } } return ; } MetaData metaData = stack . getMetaData ( ) ; //ignore for now. if ( metaData . getStackType ( ) != StackType . TYPE_SERVER || metaData . getMinorVersion ( ) <= 0 ) { stack . destroy ( ) ; if ( log . isEnabledFor ( org . apache . log4j . Level . ERROR ) ) { log . error ( "Incorrect driver" ) ; } return ; } try { if ( log . isInfoEnabled ( ) ) { log . info ( "Starting stack" ) ; } stack . start ( ) ; if ( log . isInfoEnabled ( ) ) { log . info ( "Stack is running." ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; stack . destroy ( ) ; return ; } if ( log . isInfoEnabled ( ) ) { log . info ( "Stack initialization successfully completed." ) ; } }
boolean telling if we finished our interaction